/** * This sketch demonstrates how to use the getUpdatePeriod method 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. getUpdatePeriod gets the * smallest time interval, in microseconds, over which the control's value can change during a shift (see the example * Controller >> FloatControl >> shift). If the implementation does not support value shifting over time, * it should set the control's value to the final value immediately and return -1 from this method. */ import ddf.minim.*; Minim minim; AudioOutput out; void setup() { size(512, 200); minim = new Minim(this); out = minim.getLineOut(); textFont(createFont("Arial", 12)); } void draw() { background(0); if ( out.hasControl(Controller.GAIN) ) { text("The gain has an update period of " + out.gain().getUpdatePeriod() + " microseconds.", 5, 15); } else { text("There is no gain control for this output.", 5, 15); } } void stop() { // always close Minim audio classes when you are finished with them out.close(); minim.stop(); super.stop(); }