FLslidBnk2Setk
Prev | Orchestra Opcodes and Operators | Next

## FLslidBnk2Setk

FLslidBnk2Setk — modify the values of a slider bank.

## Description

FLslidBnk2Setk modifies the values of a slider bank according to an array of values stored in a table.

## Syntax

    FLslidBnk2Setk  ktrig, ihandle, ifn [, istartIndex, istartSlid, inumSlid]

## Initialization

ihandle - handle of the sliderBnk (to be used to set its values).

ifn - number of a table containing an array of values to set each slider to.

istartIndex - (optional) starting index of the table element of to be evaluated firstly. Default value is zero

istartSlid - (optional) starting slider to be evaluated. Default 0, denoting the first slider.

inumSlid - (optional) number of sliders to be updated. Default 0, denoting all sliders.

## Performance

ktrig – the output of FLslidBnk2Setk consists of a trigger that informs if sliders have to be updated or not. A non-zero value forces the slider to be updated.

FLslidBnk2Setk is similar to FLslidBnkSet but allows k-rate to modify the values of FLslidBnk2 (FLslidBnk2Setk can also be used with FLvslidBnk2, obtaining identical result). It also allows the slider bank to be joined with MIDI. If you are using MIDI (for instance, when using the slider8table opcode), FLslidBnk2Setk changes the values of FLslidBnk2 bank of sliders to a set of values located in a table. This opcode is actually able to serve as a MIDI bridge to the FLslidBnk2 widget when used together with the sliderXXtable set of opcodes (see slider8table entry for more information). Notice, that, when you want to use table indexing as a curve response, it is not possible to do it directly in the iconfigtable configuration of FLslidBnk2, when you intend to use the FLslidBnk2Setk opcode. In fact, corresponding inputTable element of FLslidBnk2Setk must be set in linear mode and respect the 0 to 1 range. Even the corresponding elements of sliderXXtable must be set in linear mode and in the normalized range. You can do table indexing later, by using the tab and tb opcodes, and rescaling output according to max and min values. By the other hand, it is possible to use linear and exponential curve response directly, by setting the actual min-max range and flag both in the iconfigtable of corresponding FLslidBnk2 and in sliderXXtable.

FLslidBnk2Setk the k-rate version of FLslidBnk2Set.

## Examples

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

Example 331. Example of the FLslidBnk2Setk opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    ; Audio out   Audio in    No messages
    -odac           -iadc     -d     ;;;RT audio I/O
    </CsOptions>
    <CsInstruments>

    sr     = 44100
    ksmps  = 10
    nchnls = 2

    ;Example by Gabriel Maldonado 2007
    giElem	init	8
    giOutTab	ftgen	1,0,128, 2, 	0
    giSine	ftgen	3,0,256,10,	1
    giOutTab2	ftgen	4,0,128, 2, 	0
    itab	ftgen	29, 0, 129, 5,  .002, 128, 1		;** exponential ascending curve for slider mapping
    giExpTab	ftgen	30, 0, 129, -24, itab, 0, 1                    ;** rescaled curve for slider mapping
    giConfigTab ftgen	2,0,128,-2,         	1, 	500,	-1, 	13, \
    				     	1, 	500,	-1,  	13, \
    				          1, 	500,	-1, 	13, \
     					1, 	5000,	-1, 	13, \
    \
    					1, 	1000, 	-1,  	5, \
    					1, 	1000, 	-1,  	5, \
    					1, 	1000, 	-1,  	5, \
    					1, 	5000, 	-1,  	5

    	FLpanel	"Multiple FM",600,600
    	FLslidBnk2 "mod1@mod2@mod3@amp@freq1@freq2@freq3@freqPo", giElem, giOutTab2, giConfigTab, 400, 500, 100, 10
    giHandle	FLslidBnkGetHandle
    	FLpanel_end

    	FLrun
    	instr 1
    ktrig slider8table  1, giOutTab, 0, \ ;	ctl	min	max	init	func
    	27,	1, 	500,	3,	-1,	\ ;1 repeat rate
    	28,	1, 	500,	4,	-1,	\ ;2 random freq. amount
    	29,	1, 	500,	1,	-1,	\ ;3 random amp. amount
    	30,	1,	5000,	1,	-1,	\ ;4 number of concurrent loop points
    \
    	31,	1, 	1000,	1,	-1,	\;5 kloop1
    	32,	1, 	1000,	1,	-1,	\;6 kloop2
    	33,	1, 	1000,	1,	-1,	\;7 kloop3
    	34,	1, 	1000,	1,	-1	;8 kloop4
    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  giOutTab2, kmodindex1, kmodindex2, kmodindex3, kamp, kfreq1, kfreq2, kfreq3, kfreq4
    ;	 *kflag, *ihandle, *ifn, *startInd, *startSlid, *numSlid;
    	FLslidBnk2Setk  ktrig, giHandle, giOutTab, 0, 0, giElem
    printk2 kmodindex1
    printk2 kmodindex2,10
    printk2 kmodindex3,20
    printk2 kamp,30
    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
    </CsScore>

    </CsoundSynthesizer>

## See Also

FLslider, FLslidBnkGetHandle, FLslidBnk, FLslidBnk2, FLvslidBnk, FLvslidBnk2 FLslidBnkSet, FLslidBnk2Set, slider8table

## Credits

Author: Gabriel Maldonado

New in version 5.06

Prev | Up | Next
FLslidBnk2Set | Home | FLslider