FLvslidBnk

FLvslidBnk — A FLTK widget containing a bank of vertical sliders.

Description

FLvslidBnk is a widget containing a bank of vertical sliders.

Syntax

FLvslidBnk "names", inumsliders [, ioutable] [, iwidth] [, iheight] [, ix] \
      [, iy] [, itypetable] [, iexptable] [, istart_index] [, iminmaxtable]

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

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

iminmaxtable (optional, default=0) -- number of a previously-defined table containing a list of min-max pairs, referred to each slider. A zero value defaults to the 0 to 1 range for all sliders without necessity to provide a table. The default value is zero.

iexptable (optional, default=0) -- number of a previously-defined table containing a list of identifiers (i.e. integer numbers) provided to modify the behaviour of each slider independently. Identifiers can assume the following values:

  • -1 -- exponential curve response

  • 0 -- linear response

  • number > than 0 -- follow the curve of a previously-defined table to shape the response of the corresponding slider. In this case, the number corresponds to table number.

You can assume that all sliders of the bank have the same response curve (exponential or linear). In this case, you can assign -1 or 0 to iexptable without worrying about previously defining any table. The default value is zero (all sliders have a linear response, without having to provide a table).

itypetable (optional, default=0) -- number of a previously-defined table containing a list of identifiers (i.e. integer numbers) provided to modify the aspect of each individual slider independently. Identifiers can assume the following values:

  • 0 = Nice slider

  • 1 = Fill slider

  • 3 = Normal slider

  • 5 = Nice slider

  • 7 = Nice slider with down-box

You can assume that all sliders of the bank have the same aspect. In this case, you can assign a negative number to itypetable without worrying about previously defining any table. Negative numbers have the same meaning of the corresponding positive identifiers with the difference that the same aspect is assigned to all sliders. You can also assign a random aspect to each slider by setting itypetable to a negative number lower than -7. The default value is zero (all sliders have the aspect of nice sliders, without having to provide a table).

You can add 20 to a value inside the table to make the slider "plastic", or subtract 20 if you want to set the value for all widgets without defining a table (e.g. -21 to set all sliders types to Plastic Fill slider).

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

iheight (optional) -- height of the rectangular area containing all sliders of the bank, excluding text labels, that are placed below 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, below 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, below 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.

Performance

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

FLvslidBnk is a widget containing a bank of vertical 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 below it. Labels are defined by the names argument. The output range of each slider can be individually set by means of an external table (iminmaxtable argument). The curve response of each slider can be set individually, by means of a list of identifiers placed in a table (iexptable argument). It is possible to define the aspect of each slider independently or to make all sliders have the same aspect (itypetable argument).

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 below them and is not included in the rectangular area containing sliders. So the user should leave enough space below the bank by assigning a proper iy value in order to leave labels visible.

FLvslidBnk is identical to FLslidBnk except it contains vertical sliders instead of horizontal. Since the width of each single slider is often small, it is recommended to leave only a single space in the names string (“ “), in this case each slider will be automatically numbered.

[Warning] IMPORTANT!

Notice that the tables used by FLvslidBnk 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 FLvslidBnk opcode. It uses the file FLvslidBnk.csd.

Example 296. Example of the FLvslidBnk 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
</CsOptions>
<CsInstruments>

sr = 44100
kr = 441
ksmps = 100
nchnls = 1

gitypetable ftgen 0, 0, 8, -2, 1, 1, 3, 3, 5, 5, 7, 7 
giouttable ftgen 0, 0, 8, -2, 0, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1

FLpanel "Slider Bank", 400, 400, 50, 50
    ;Number of sliders
    inum = 8
    ; Table to store output
    iouttable = giouttable
    ; Width of the slider bank in pixels
    iwidth = 350
    ; Height of the slider in pixels
    iheight = 160
    ; Distance of the left edge of the slider
    ; from the left edge of the panel
    ix = 30
    ; Distance of the top edge of the slider 
    ; from the top edge of the panel
    iy = 10
    ; Table containing fader types
    itypetable  = gitypetable
    FLvslidBnk "1@2@3@4@5@6@7@8@9@10@11@12@13@14@15@16", 16 , iouttable , iwidth , iheight , ix \
      , iy , itypetable
    FLvslidBnk " ", inum , iouttable , iwidth , iheight , ix \
      , iy + 200 , -23
; End of panel contents
FLpanelEnd
; Run the widget thread!
FLrun


instr 1
;Dummy instrument
endin


</CsInstruments>
<CsScore>

; Instrument 1 will play a note for 1 hour.
i 1 0 3600
e


</CsScore>
</CsoundSynthesizer>


See Also

FLslider, FLslidBnk

Credits

Author: Gabriel Maldonado

New in version 5.06