Java Code Examples for javax.sound.sampled.BooleanControl#setValue()

The following examples show how to use javax.sound.sampled.BooleanControl#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OGGSoundClip.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public void setMute(boolean mute) {
		// Set mute value.
		this.mute = mute;

		if (outputLine == null) {
			return;
		} else if (outputLine.isControlSupported(BooleanControl.Type.MUTE)) {
			BooleanControl muteControl = (BooleanControl) outputLine.getControl(BooleanControl.Type.MUTE);
			muteControl.setValue(mute);

			 if (mute)
				 paused = true;
			 else
				 paused = false;
			 
//			 if (!mute)
//			 setGain(oldGain);
		}

	}
 
Example 2
Source File: AudioThread.java    From open-ig with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Mute or unmute the current playback.
 * @param mute the mute status
 */
public void setMute(boolean mute) {
	BooleanControl bc = (BooleanControl)sdl.getControl(BooleanControl.Type.MUTE);
	if (bc != null) {
		bc.setValue(mute);
	}
}
 
Example 3
Source File: JavaMixer.java    From Spark with Apache License 2.0 5 votes vote down vote up
public void setMicrophoneInput() {
    TreePath path = findByName(new TreePath(root), new String[]{"MICROPHONE", "Select"});

    if (path == null) {
        path = findByName(new TreePath(root), new String[]{"Capture source", "Capture", "Mute"});
    }

    if (path != null) {
        if (path.getLastPathComponent() instanceof JavaMixer.ControlNode) {
            BooleanControl bControl = (BooleanControl) (((JavaMixer.ControlNode) path.getLastPathComponent()).getControl());
            bControl.setValue(true);
        }
    }
}
 
Example 4
Source File: JavaMixer.java    From Spark with Apache License 2.0 5 votes vote down vote up
public void setMuteForMicrophoneOutput() {
    TreePath path = findByName(new TreePath(root), new String[]{"SPEAKER", "Microfone", "Mute"});

    if (path == null) {
        path = findByName(new TreePath(root), new String[]{"MIC target", "mic", "Mute"});
    }

    if (path != null) {
        if (path.getLastPathComponent() instanceof JavaMixer.ControlNode) {
            BooleanControl bControl = (BooleanControl) (((JavaMixer.ControlNode) path.getLastPathComponent()).getControl());
            bControl.setValue(true);
        }
    }
}