FLjoy
Prev | Orchestra Opcodes and Operators | Next

## FLjoy

FLjoy — A FLTK opcode that acts like a joystick.

## Description

FLjoy is a squared area that allows the user to modify two output values at the same time. It acts like a joystick.

## Syntax

    koutx, kouty, ihandlex, ihandley FLjoy "label", iminx, imaxx, iminy, \
          imaxy, iexpx, iexpy, idispx, idispy, iwidth, iheight, ix, iy

## Initialization

ihandlex -- a handle value (an integer number) that unequivocally references a corresponding widget. Used by further opcodes that changes some valuator's properties. It is automatically set by the corresponding valuator.

ihandley -- a handle value (an integer number) that unequivocally references a corresponding widget. Used by further opcodes that changes some valuator's properties. It is automatically set by the corresponding valuator.

“label” -- a double-quoted string containing some user-provided text, placed near the corresponding widget.

iminx -- minimum x value of output range

imaxx -- maximum x value of output range

iminy -- minimum y value of output range

imaxy -- maximum y value of output range

iwidth -- width of widget.

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

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

iexpx -- an integer number denoting the behaviour of valuator:

- 0 = valuator output is linear

- -1 = valuator output is exponential

All other positive numbers for iexpx 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.

iexpy -- an integer number denoting the behaviour of valuator:

- 0 = valuator output is linear

- -1 = valuator output is exponential

All other positive numbers for iexpy 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. In fact, tables placed in the score are created later than the initialization of the opcodes placed in the header section of the orchestra.

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

koutx -- x output value

kouty -- y output value

## Examples

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

Example 236. Example of the FLjoy 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 FLjoy.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; Demonstration of the flpanel opcode
    ; Horizontal click-dragging controls the frequency of the oscillator
    ; Vertical click-dragging controls the amplitude of the oscillator
    sr = 44100
    kr = 441
    ksmps = 100
    nchnls = 1

    FLpanel "X Y Panel", 900, 400, 50, 50
        ; Minimum value output by x movement (frequency)
        iminx = 200
        ; Maximum value output by x movement (frequency)
        imaxx = 5000
        ; Minimum value output by y movement (amplitude)
        iminy = 0
        ; Maximum value output by y movement (amplitude)
        imaxy = 15000
        ; Logarithmic change in x direction
        iexpx = -1
        ; Linear change in y direction
        iexpy = 0
        ; Display handle x direction (-1=not used)
        idispx = -1
        ; Display handle y direction (-1=not used)
        idispy = -1
        ; Width of the x y panel in pixels
        iwidth = 800
        ; Height of the x y panel in pixels
        iheight = 300
        ; Distance of the left edge of the x y panel from
        ; the left edge of the panel
        ix = 50
        ; Distance of the top edge of the x y
        ; panel from the top edge of the panel
        iy = 50

        gkfreqx, gkampy, ihandlex, ihandley FLjoy "X - Frequency Y - Amplitude", iminx, imaxx, iminy, imaxy, iexpx, iexpy, idispx, idispy, iwidth, iheight, ix, iy
    ; End of panel contents
    FLpanelEnd
    ; Run the widget thread!
    FLrun

    instr 1
        ifn = 1
        asig oscili gkampy, gkfreqx, 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>

## See Also

FLcount, FLknob, FLroller, FLslider, FLtext

## Credits

Author: Gabriel Maldonado

New in version 4.22

Example written by Iain McCurdy, edited by Kevin Conder.

Prev | Up | Next
FLhvsBoxSetValue | Home | FLkeyIn