FLslidBnk2

FLslidBnk2 — A FLTK widget containing a bank of horizontal sliders.

Description

FLslidBnk2 is a widget containing a bank of horizontal sliders.

Syntax

FLslidBnk2 "names", inumsliders, ioutable, iconfigtable [,iwidth, iheight, ix, iy, istart_index] 

Initialization

names -- a double-quoted string containing the names of each slider. Each slider can have a different name. Separate each name with @ character, for example: frequency@amplitude@cutoff. It is possible to not provide any name by giving a single space . In this case, the opcode will automatically assign a progressive number as a label for each slider.

inumsliders -- the number of sliders.

ioutable (optional, default=0) -- number of a previously-allocated table in which to store output values of each slider. The user must be sure that table size is large enough to contain all output cells, otherwise a segfault will crash Csound. By assigning zero to this argument, the output will be directed to the zak space in the k-rate zone. In this case, the zak space must be previously allocated with the zakinit opcode and the user must be sure that the allocation size is big enough to cover all sliders. The default value is zero (i.e. store output in zak space).

iconfigtable -- in the FLslidBnk2 and FLvslidBnk2 opcodes, this table replaces iminmaxtable, iexptable and istyletable, all these parameters being placed into a single table. This table has to be filled with a group of 4 parameters for each slider in this way:

min1, max1, exp1, style1, min2, max2, exp2, style2, min3, max3, exp3, style3 etc.

for example using GEN02 you can type:

inum ftgen 1,0,256, -2,     0,1,0,1,    100, 5000, -1, 3,      50, 200, -1, 5,….. [etcetera]

In this example the first slider will be affected by the [0,1,0,1] parameters (the range will be 0 to 1, it will have linear response, and its aspect will be a fill slider), the second slider will be affected by the [100,5000,-1,3] parameters (the range is 100 to 5000, the response is exponential and the aspect is a normal slider), the third slider will be affected by the [50,200,-1,5] parameters (the range is 50 to 200, the behavior exponential, and the aspect is a nice slider), and so on.

iwidth (optional) -- width of the rectangular area containing all sliders of the bank, excluding text labels, that are placed to the left of that area.

iheight (optional) -- height of the rectangular area containing all sliders of the bank, excluding text labels, that are placed to the left of that area.

ix (optional) -- horizontal position of the upper left corner of the rectangular area containing all sliders belonging to the bank. You have to leave enough space, at the left of that rectangle, in order to make sure labels of sliders to be visible. This is because the labels themselves are external to the rectangular area.

iy (optional) -- vertical position of the upper left corner of the rectangular area containing all sliders belonging to the bank. You have to leave enough space, at the left of that rectangle, in order to make sure labels of sliders to be visible. This is because the labels themselves are external to the rectangular area.

istart_index (optional, default=0) -- an integer number referring to a starting offset of output cell locations. It can be positive to allow multiple banks of sliders to output in the same table or in the zak space. The default value is zero (no offset).

Performance

There are no k-rate arguments, even if cells of the output table (or the zak space) are updated at k-rate.

FLslidBnk2 is a widget containing a bank of horizontal sliders. Any number of sliders can be placed into the bank (inumsliders argument). The output of all sliders is stored into a previously allocated table or into the zak space (ioutable argument). It is possible to determine the first location of the table (or of the zak space) in which to store the output of the first slider by means of istart_index argument.

Each slider can have an individual label that is placed to the left of it. Labels are defined by the names argument. The output range of each slider can be individually set by means of the min and max values inside the iconfigtable table. The curve response of each slider can be set individually, by means of a list of identifiers placed in the iconfigtable table (exp argument). It is possible to define the aspect of each slider independently or to make all sliders have the same aspect (style argument in the iconfigtable table).

The iwidth, iheight, ix, and iy arguments determine width, height, horizontal and vertical position of the rectangular area containing sliders. Notice that the label of each slider is placed to the left of them and is not included in the rectangular area containing sliders. So the user should leave enough space to the left of the bank by assigning a proper ix value in order to leave labels visible.

[Warning] IMPORTANT!

Notice that the tables used by FLslidBnk2 must be created with the ftgen opcode and placed in the orchestra before the corresponding valuator. They can not placed in the score. This is because tables placed in the score are created later than the initialization of the opcodes placed in the header section of the orchestra.

Examples

Here is an example of the FLslidBnk2 opcode. It uses the file FLslidBnk2.csd.

Example 285. Example of the FLslidBnk2 opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc       -M0 ;;;RT audio I/O with MIDI in
</CsOptions>
<CsInstruments>

sr	=	44100
ksmps	=	100
nchnls	=	2

;Example by Gabriel Maldonado

giElem	init	8
giOutTab	ftgen	1,0,128, 2, 	0

              ;min1, max1, exp1, type1, min2, max2, exp2, type2, min3, max3, exp3, type3 etc.
giConfigTab ftgen	2,0,128,-2,         .1, 1000, -1, 3,      .1, 1000, -1, 3,     .1, 1000, -1, 3,     30, 2000, -1, 3, \
                                        .1, 5000, -1,  5,      .1, 5000, -1,  5,     .1, 5000, -1,  5,     .1, 5000, -1,  5
giSine	ftgen	3,0,256,10,	1

	FLpanel	"This Panel contains a Slider Bank",600,600
	FLslidBnk2 "mod1@mod2@mod3@amp@freq1@freq2@freq3@freqPo", giElem, giOutTab, giConfigTab, 400, 500, 100, 10
	FLpanel_end

	FLrun

	instr 1

kmodindex1 	init 0
kmodindex2 	init 0 
kmodindex3 	init 0 
kamp 		init 0 
kfreq1 		init 0 
kfreq2	  	init 0 
kfreq3	 	init 0 
kfreq4 		init 0


       vtable1k  giOutTab, kmodindex1 , kmodindex2, kmodindex3, kamp, kfreq1, kfreq2 , kfreq3, kfreq4

amod1	oscili	kmodindex1, kfreq1, giSine
amod2	oscili	kmodindex2, kfreq2, giSine
amod3	oscili	kmodindex3, kfreq3, giSine
aout	oscili	kamp,       kfreq4+amod1+amod2+amod3, giSine
	
	outs	aout, aout
	endin


</CsInstruments>
<CsScore>

i1 0 3600
f0 3600

</CsScore>
</CsoundSynthesizer>


See Also

FLslider, FLslidBnk, FLvslidBnk, FLvslidBnk2

Credits

Author: Gabriel Maldonado

New in version 5.06