FLslider — Puts a slider into the corresponding FLTK container.
ihandle -- a handle value (an integer number) that unequivocally references a corresponding widget. This is used by other opcodes that modify a widget's properties (see Modifying FLTK Widget Appearance). It is automatically output by FLslider and must not be set by the user label. (The user label is a double-quoted string containing some user-provided text placed near the widget.)
“label” -- a double-quoted string containing some user-provided text, placed near the corresponding widget.
imin -- minimum value of output range (corresponds to the left value for horizontal sliders, and the top value for vertical sliders).
imax -- maximum value of output range (corresponds to the right value for horizontal sliders, and the bottom value for vertical sliders).
The imin argument may be greater than imax argument. This has the effect of “reversing” the object so the larger values are in the opposite direction. This also switches which end of the filled sliders is filled.
iexp -- an integer number denoting the behaviour of valuator:
0 = valuator output is linear
-1 = valuator output is exponential
All other positive numbers for iexp indicate the number of an existing table that is used for indexing. Linear interpolation is provided in table indexing. A negative table number suppresses interpolation.
![]() |
IMPORTANT! |
---|---|
Notice that the tables used by valuators 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. |
itype -- an integer number denoting the appearance of the valuator.
The itype argument can be set to the following values:
1 - shows a horizontal fill slider
2 - a vertical fill slider
3 - a horizontal engraved slider
4 - a vertical engraved slider
5 - a horizontal nice slider
6 - a vertical nice slider
7 - a horizontal up-box nice slider
8 - a vertical up-box nice slider
FLslider - a horizontal fill slider (itype=1).
FLslider - a horizontal engraved slider (itype=3).
FLslider - a horizontal nice slider (itype=5).
idisp -- a handle value that was output from a previous instance of the FLvalue opcode to display the current value of the current valuator in the FLvalue widget itself. If the user doesn't want to use this feature that displays current values, it must be set to a negative number by the user.
iwidth -- width of widget.
iheight -- height of widget.
ix -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
iy -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
kout -- output value
FLsliders are created with the minimum value by default in the left/at the top. If you want to reverse the slider, reverse the values. See the example below.
Here is an example of the FLslider opcode. It uses the file FLslider.csd.
Example 151. Example of the FLslider 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 No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o FLslider.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; A sine with oscillator with flslider controlled frequency sr = 44100 kr = 441 ksmps = 100 nchnls = 1 FLpanel "Frequency Slider", 900, 400, 50, 50 ; Minimum value output by the slider imin = 200 ; Maximum value output by the slider imax = 5000 ; Logarithmic type slider selected iexp = -1 ; Slider graphic type (5='nice' slider) itype = 5 ; Display handle (-1=not used) idisp = -1 ; Width of the slider in pixels iwidth = 750 ; Height of the slider in pixels iheight = 30 ; Distance of the left edge of the slider ; from the left edge of the panel ix = 125 ; Distance of the top edge of the slider ; from the top edge of the panel iy = 50 gkfreq, ihandle FLslider "Frequency", imin, imax, iexp, itype, idisp, iwidth, iheight, ix, iy ; End of panel contents FLpanelEnd ; Run the widget thread! FLrun ;Set the widget's initial value FLsetVal_i 300, ihandle instr 1 iamp = 15000 ifn = 1 asig oscili iamp, gkfreq, ifn out asig endin </CsInstruments> <CsScore> ; Function table that defines a single cycle ; of a sine wave. f 1 0 1024 10 1 ; Instrument 1 will play a note for 1 hour. i 1 0 3600 e </CsScore> </CsoundSynthesizer>
Here is another example of the FLslider opcode, showing the slider types and other options. It also shows the usage of FLvalue to display a widget's contents. It uses the file FLslider-2.csd.
Example 152. More complex example of the FLslider opcode.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o FLslider.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 kr = 441 ksmps = 100 nchnls = 1 ;By Andres Cabrera 2007 FLpanel "Slider Types", 410, 260, 50, 50 ; Distance of the left edge of the slider ; from the left edge of the panel ix = 10 ; Distance of the top edge of the slider ; from the top edge of the panel iy = 10 ; Create boxes to display widget values givalue1 FLvalue "1", 60, 20, ix + 330, iy givalue3 FLvalue "3", 60, 20, ix + 330, iy + 40 givalue5 FLvalue "5", 60, 20, ix + 330, iy + 80 givalue2 FLvalue "2", 60, 20, ix + 60, iy + 140 givalue4 FLvalue "4", 60, 20, ix + 195, iy + 140 givalue6 FLvalue "6", 60, 20, ix + 320, iy + 140 ;Horizontal sliders gkdummy1, ihandle1 FLslider "Type 1", 200, 5000, -1, 1, givalue1, 320, 20, ix, iy gkdummy3, ihandle3 FLslider "Type 3", 0, 15000, 0, 3, givalue3, 320, 20, ix, iy + 40 ; Reversed slider gkdummy5, ihandle5 FLslider "Type 5", 1, 0, 0, 5, givalue5, 320, 20, ix, iy + 80 ;Vertical sliders gkdummy2, ihandle2 FLslider "Type 2", 0, 1, 0, 2, givalue2, 20, 100, ix+ 30 , iy + 120 ; Reversed slider gkdummy4, ihandle4 FLslider "Type 4", 1, 0, 0, 4, givalue4, 20, 100, ix + 165 , iy + 120 gkdummy6, ihandle6 FLslider "Type 6", 0, 1, 0, 6, givalue6, 20, 100, ix + 290 , iy + 120 ; End of panel contents FLpanelEnd ; Run the widget thread! FLrun ; Set the color of widgets FLsetColor 200, 230, 0, ihandle1 FLsetColor 0, 123, 100, ihandle2 FLsetColor 180, 23, 12, ihandle3 FLsetColor 10, 230, 0, ihandle4 FLsetColor 0, 0, 0, ihandle5 FLsetColor 0, 0, 0, ihandle6 FLsetColor 200, 230, 0, givalue1 FLsetColor 0, 123, 100, givalue2 FLsetColor 180, 23, 12, givalue3 FLsetColor 10, 230, 0, givalue4 FLsetColor 255, 255, 255, givalue5 FLsetColor 255, 255, 255, givalue6 FLsetColor2 20, 23, 100, ihandle1 FLsetColor2 200,0 ,123 , ihandle2 FLsetColor2 180, 180, 100, ihandle3 FLsetColor2 180, 23, 12, ihandle4 FLsetColor2 180, 180, 100, ihandle5 FLsetColor2 180, 23, 12, ihandle6 ;Set some widget's initial value FLsetVal_i 500, ihandle1 FLsetVal_i 1000, ihandle3 instr 1 ;Nothing here for now... endin </CsInstruments> <CsScore> f 0 3600 ;Dumy table to make csound wait for realtime events e </CsScore> </CsoundSynthesizer>