This sketch demonstrates how to use the getValue and setValue methods of a
FloatControl object. A FloatControl is what is returned by the gain,
volume, pan, and balance methods of a Controller object.
The class used here is an AudioOutput but these control methods are also available on
AudioSample, AudioSnippet, AudioInput, and AudioPlayer objects.
The FloatControl class is defined by the JavaSound API and it
represents a control of a DataLine. A DataLine is a low-level JavaSound class that
is used for sending audio to, or receiving audio from, the audio system. getValue and setValue
allow you to get and set the value of the control. The default implementation simply sets the value as indicated.
If the value indicated is greater than the maximum value, or smaller than the minimum value,
an IllegalArgumentException is thrown. You can avoid having to possibly deal with this exception by using
the appropriate set method of Controller, which will keep the value in the allowed range.
Move the mouse left and right to change the pan value.
Source code: getSetValue waveform
Built with Processing