本文整理汇总了Java中javax.sound.sampled.BooleanControl类的典型用法代码示例。如果您正苦于以下问题:Java BooleanControl类的具体用法?Java BooleanControl怎么用?Java BooleanControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BooleanControl类属于javax.sound.sampled包,在下文中一共展示了BooleanControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMute
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
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)
// setGain(oldGain);
}
}
示例2: testEnumControl
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public void testEnumControl() {
BooleanControl control = new MyControl(BooleanControl.Type.MUTE, true,
"ON", "OFF");
assertTrue(control.getValue());
control.setValue(false);
assertFalse(control.getValue());
assertEquals("ON", control.getStateLabel(true));
assertEquals("OFF", control.getStateLabel(false));
assertEquals("Mute Control with current value: OFF", control
.toString());
control = new MyControl(BooleanControl.Type.APPLY_REVERB, false);
assertFalse(control.getValue());
control.setValue(true);
assertTrue(control.getValue());
assertEquals("true", control.getStateLabel(true));
assertEquals("false", control.getStateLabel(false));
assertEquals("Apply Reverb Control with current value: true", control
.toString());
}
示例3: getValue
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
private boolean getValue(BooleanControl.Type type)
{
boolean v = false;
if (hasControl(type))
{
BooleanControl c = (BooleanControl) getControl(type);
v = c.getValue();
}
else
{
Minim.error(type.toString() + " is not supported.");
}
return v;
}
示例4: setValue
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
private void setValue(BooleanControl.Type type, boolean v)
{
if (hasControl(type))
{
BooleanControl c = (BooleanControl) getControl(type);
c.setValue(v);
}
else
{
Minim.error(type.toString() + " is not supported.");
}
}
示例5: createType
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
private static BooleanControl.Type createType(String name) {
if (name.equals("Mute")) {
return BooleanControl.Type.MUTE;
}
else if (name.equals("Select")) {
// $$fb add as new static type?
//return BooleanControl.Type.SELECT;
}
return new BCT(name);
}
示例6: setMute
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
@Override
public void setMute(boolean mute) {
BooleanControl control = (BooleanControl)this.controls.get("Mute");
boolean oldVal = control.getValue();
control.setValue(mute);
this.trigger(AudioEvent.Type.MUTE_CHANGED, oldVal, mute);
}
示例7: setMute
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
/**
* 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);
}
}
示例8: BooleanControlAdapter
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
BooleanControlAdapter(final BooleanControl underlying)
{
if (underlying==null)
throw new NullPointerException("Given boolean control is null.");
if (!BooleanControl.Type.MUTE.equals(underlying.getType()))
throw new IllegalArgumentException("Given boolean control is not a mute control.");
this.underlying=underlying;
}
示例9: LineControlGroup
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public LineControlGroup(final Line underlying) throws LineUnavailableException, Exception
{
if (!underlying.isOpen())
underlying.open();
final FloatControl volumeInput=(FloatControl)new ControlLocator(FloatControl.Type.VOLUME).find(underlying);
if (volumeInput==null)
throw new Exception("Could not find volume control for line \""+underlying.getLineInfo().toString()+"\".");
volume=new FloatControlAdapter(volumeInput);
final StringBuilder log=new StringBuilder();
if (logger.isDebugEnabled())
{
log.append("Instantiated for line \"");
log.append(underlying.getLineInfo().toString());
log.append("\". ");
}
final BooleanControl muteInput=(BooleanControl)new ControlLocator(BooleanControl.Type.MUTE).find(underlying);
if (muteInput==null)
{
mute=null;
if (logger.isDebugEnabled())
log.append("Found volume control but no mute control.");
}
else
{
mute=new BooleanControlAdapter(muteInput);
if (logger.isDebugEnabled())
log.append("Found volume and mute controls.");
}
logger.debug(log.toString());
}
示例10: setup
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
@Before
public void setup()
{
mockControl=Mockito.mock(BooleanControl.class);
Mockito.when(mockControl.getType()).thenReturn(BooleanControl.Type.MUTE);
testee=new BooleanControlAdapter(mockControl);
}
示例11: setMuted
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
/**
* Sets this audio player to muted.
* @param flag true to mute the audio
*/
public void setMuted(boolean flag) {
if (this.line != null) {
if (this.line.isControlSupported(BooleanControl.Type.MUTE)) {
BooleanControl control = (BooleanControl)this.line.getControl(BooleanControl.Type.MUTE);
control.setValue(flag);
}
}
}
示例12: isMuted
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
/**
* Returns true if the audio player is muted.
* <p>
* It's possible that JavaSound doesn't support the mute control. In this
* case false will always be returned.
* @return boolean
*/
public boolean isMuted() {
if (this.line != null) {
if (this.line.isControlSupported(BooleanControl.Type.MUTE)) {
BooleanControl control = (BooleanControl)this.line.getControl(BooleanControl.Type.MUTE);
return control.getValue();
}
}
// otherwise return false
return false;
}
示例13: setMicrophoneInput
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
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);
}
}
}
示例14: setMuteForMicrophoneOutput
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
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);
}
}
}
示例15: ControlNode
import javax.sound.sampled.BooleanControl; //导入依赖的package包/类
public ControlNode(Control control) {
super(control.getType(), true);
this.control = control;
if (control instanceof BooleanControl) {
component = createControlComponent((BooleanControl) control);
} else if (control instanceof EnumControl) {
component = createControlComponent((EnumControl) control);
} else if (control instanceof FloatControl) {
component = createControlComponent((FloatControl) control);
} else {
component = null;
}
}