/**
* This sketch demonstrates how to use the hasControl method of a Controller object.
* The class used here is an AudioOutput but you can also use test for controls of
* AudioSample, AudioSnippet, AudioInput, and AudioPlayer objects.
* hasControl takes one of the static control types of Controller as the argument. These are
* Controller.BALANCE, Controller.GAIN, Controller.MUTE, Controller.PAN,
* Controller.SAMPLE_RATE, and Controller.VOLUME. You should always check if a control
* is available before you attempt to use it.
*/
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.PAN) )
{
text("The output has a pan control.", 5, 15);
}
else
{
text("The output doesn't have a pan control.", 5, 15);
}
if ( out.hasControl(Controller.VOLUME) )
{
text("The output has a volume control.", 5, 30);
}
else
{
text("The output doesn't have a volume control.", 5, 30);
}
if ( out.hasControl(Controller.SAMPLE_RATE) )
{
text("The output has a sample rate control.", 5, 45);
}
else
{
text("The output doesn't have a sample rate control.", 5, 45);
}
if ( out.hasControl(Controller.BALANCE) )
{
text("The output has a balance control.", 5, 60);
}
else
{
text("The output doesn't have a balance control.", 5, 60);
}
if ( out.hasControl(Controller.MUTE) )
{
text("The output has a mute control.", 5, 75);
}
else
{
text("The output doesn't have a mute control.", 5, 75);
}
if ( out.hasControl(Controller.GAIN) )
{
text("The output has a gain control.", 5, 90);
}
else
{
text("The output doesn't have a gain control.", 5, 105);
}
}
void stop()
{
// always close Minim audio classes when you are finished with them
out.close();
minim.stop();
super.stop();
}