FLslider

FLslider — Puts a slider into the corresponding FLTK container.

Description

FLslider puts a slider into the corresponding container.

Syntax

kout, ihandle FLslider "label", imin, imax, iexp, itype, idisp, iwidth, iheight, ix, iy

Initialization

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.

imax -- maximum value of output range.

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.

[Warning] 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. In fact, 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 fill slider (itype=1).

FLslider - a horizontal engraved slider (itype=3).

FLslider - a horizontal engraved slider (itype=3).

FLslider - a horizontal nice slider (itype=5).

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).

Performance

kout -- output value

Examples

Here is an example of the FLslider opcode. It uses the files FLslider.orc and FLslider.sco.

Example 140. Example of the FLslider opcode.

/* flslider.orc */
; 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

instr 1
    iamp = 15000
    ifn = 1
    asig oscili iamp, gkfreq, ifn
    out asig
endin
/* flslider.orc */

        
/* flslider.sco */
; 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
/* flslider.sco */

        

See Also

FLcount, FLjoy, FLkeyb, FLknob, FLroller, FLslidBnk, FLtext

Credits

Author: Gabriel Maldonado

New in version 4.22

February 2004. Thanks to a note from Dave Phillips, deleted the extraneous istep parameter.

Example written by Iain McCurdy, edited by Kevin Conder.