use of javax.sound.sampled.FloatControl in project ChessProject by DylanSantora.
the class Sound method setVolume.
public void setVolume(float f) {
FloatControl volume = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
volume.setValue(f);
}
use of javax.sound.sampled.FloatControl in project Minim by ddf.
the class Controller method getValue.
private float getValue(FloatControl.Type type) {
float v = 0;
if (hasControl(type)) {
FloatControl c = (FloatControl) getControl(type);
v = c.getValue();
} else {
Minim.error(type.toString() + " is not supported.");
}
return v;
}
use of javax.sound.sampled.FloatControl in project Minim by ddf.
the class Controller method setValue.
private void setValue(FloatControl.Type type, float v) {
if (hasControl(type)) {
FloatControl c = (FloatControl) getControl(type);
if (v > c.getMaximum())
v = c.getMaximum();
else if (v < c.getMinimum())
v = c.getMinimum();
c.setValue(v);
} else {
Minim.error(type.toString() + " is not supported.");
}
}
use of javax.sound.sampled.FloatControl in project Minim by ddf.
the class Controller method printControls.
/** @invisible
*
* Prints the available controls and their ranges to the console. Not all
* Controllers have all of the controls available on them so this is a way to find
* out what is available.
*
*/
public void printControls() {
if (controls.length > 0) {
System.out.println("Available controls are:");
for (int i = 0; i < controls.length; i++) {
Control.Type type = controls[i].getType();
System.out.print(" " + type.toString());
if (type == VOLUME || type == GAIN || type == BALANCE || type == PAN) {
FloatControl fc = (FloatControl) controls[i];
String shiftSupported = "does";
if (fc.getUpdatePeriod() == -1) {
shiftSupported = "doesn't";
}
System.out.println(", which has a range of " + fc.getMaximum() + " to " + fc.getMinimum() + " and " + shiftSupported + " support shifting.");
} else {
System.out.println("");
}
}
} else {
System.out.println("There are no controls available.");
}
}
Aggregations