/**
* This sketch demonstrates how to use the mute, unmute, and isMuted methods
* of a Controller object. The class used here is an AudioOutput but you can also
* mute/unmute AudioSample, AudioSnippet, AudioInput, and AudioPlayer objects.
* isMuted returns true or false depending on the current mute state. mute and unmute
* do exactly what they claim to. However, it is possible that your object will not have a mute control, in which case
* isMuted will always return false and mute and unmute will do nothing. If
* muting is available you will notice that muting the output doesn't change the waveform being drawn. The reason for
* this is that the DataLine carrying the audio to the system is what is being muted and *not* the
* output's signal generation (see the example Polyphonic >> soundNoSound for more about that).
*
* Hold down the mouse button to mute the output and release the mouse button to unmute it. */ import ddf.minim.*; import ddf.minim.signals.*; Minim minim; AudioOutput out; WaveformRenderer waveform; SawWave saw; void setup() { size(512, 200); minim = new Minim(this); out = minim.getLineOut(); waveform = new WaveformRenderer(); // see the example Recordable >> addListener for more about this out.addListener(waveform); // see the example AudioOutput >> SawWaveSignal for more about this saw = new SawWave(100, 0.2, out.sampleRate()); // see the example Polyphonic >> addSignal for more about this out.addSignal(saw); textFont(createFont("Arial", 12)); } void draw() { background(0); // see waveform.pde for more about this waveform.draw(); if ( out.hasControl(Controller.MUTE) ) { if (mousePressed) { out.mute(); } else { out.unmute(); } if ( out.isMuted() ) { text("The output is muted.", 5, 15); } else { text("The output is not muted.", 5, 15); } } else { text("The output doesn't have a mute control.", 5, 15); } } void stop() { // always close Minim audio classes when you are finished with them out.close(); minim.stop(); super.stop(); }