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); } }
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()); }
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; }
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."); } }
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); }
@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); }
/** * 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); } }
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; }
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()); }
@Before public void setup() { mockControl=Mockito.mock(BooleanControl.class); Mockito.when(mockControl.getType()).thenReturn(BooleanControl.Type.MUTE); testee=new BooleanControlAdapter(mockControl); }
/** * 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); } } }
/** * 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; }
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); } } }
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; } }
private JComponent createControlComponent(BooleanControl control) { AbstractButton button; String strControlName = control.getType().toString(); ButtonModel model = new JavaMixer.BooleanControlButtonModel(control); button = new JCheckBox(strControlName); button.setModel(model); return button; }