下面列出了javax.sound.sampled.BooleanControl#setValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
}
/**
* 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);
}
}
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);
}
}
}
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);
}
}
}