javax.sound.sampled.CompoundControl Java Examples

The following examples show how to use javax.sound.sampled.CompoundControl. 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: PortMixer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #2
Source File: JavaMixer.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    final JavaMixer sm = new JavaMixer();
    final JFrame jf = new JFrame("Mixer Test");
    final JPanel jp = new JPanel();
    jf.add(jp);
    jp.add(sm.getTree());
    jf.setSize(600, 500);
    jf.setVisible(true);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    sm.getTree().addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getPath();
            if (path.getLastPathComponent() instanceof JavaMixer.ControlNode) {
                JavaMixer.ControlNode controlNode = (JavaMixer.ControlNode) path.getLastPathComponent();
                if (!(controlNode.getControl() instanceof CompoundControl)) {
                    if (jp.getComponentCount() > 1)
                        jp.remove(1);
                    jp.add(controlNode.getComponent(), 1);
                    jp.repaint();
                }
            }
        }
    });
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedMasterVolume());
    jp.add(sm.getPrefferedInputVolume());
    jp.repaint();
    sm.setMicrophoneInput();
    sm.setMuteForMicrophoneOutput();
}
 
Example #3
Source File: JavaMixer.java    From Spark with Apache License 2.0 5 votes vote down vote up
private void createControlChildren(JavaMixer.ControlNode controlNode) {
    if (controlNode.getControl() instanceof CompoundControl) {
        CompoundControl control = (CompoundControl) controlNode.getControl();
        Control[] aControls = control.getMemberControls();
        for (Control con : aControls) {
            JavaMixer.ControlNode conNode = new JavaMixer.ControlNode(con);
            createControlChildren(conNode);
            controlNode.add(conNode);
        }
    }
}
 
Example #4
Source File: PortMixer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #5
Source File: PortMixer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #6
Source File: PortMixer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #7
Source File: PortMixer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #8
Source File: PortMixer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #9
Source File: PortMixer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #10
Source File: PortMixer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #11
Source File: ToString.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
    System.out.println();
    System.out.println();
    System.out.println("4629190: CompoundControl: getMemberControls() and toString() throw NullPointerException");

    String firstControlTypeName = "first_Control_Type_Name";
    String secondControlTypeName = "second_Control_Type_Name";
    String thirdControlTypeName = "third_Control_Type_Name";

    Control.Type firstControlType = new TestControlType(firstControlTypeName);
    Control.Type secondControlType = new TestControlType(secondControlTypeName);
    Control.Type thirdControlType = new TestControlType(thirdControlTypeName);

    Control firstControl = new TestControl(firstControlType);
    Control secondControl = new TestControl(secondControlType);
    Control thirdControl = new TestControl(thirdControlType);

    String testCompoundControlTypeName = "CompoundControl_Type_Name";
    CompoundControl.Type testCompoundControlType
        = new TestCompoundControlType(testCompoundControlTypeName);

    Control[] setControls = { firstControl, secondControl, thirdControl };
    CompoundControl testedCompoundControl
        = new TestCompoundControl(testCompoundControlType, setControls);

    // this may throw exception if bug applies
    Control[] producedControls = testedCompoundControl.getMemberControls();
    System.out.println("Got "+producedControls.length+" member controls.");

    // this may throw exception if bug applies
    String producedString = testedCompoundControl.toString();
    System.out.println("toString() returned: "+producedString);

    System.out.println("Test passed.");
}
 
Example #12
Source File: PortMixer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #13
Source File: PortMixer.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #14
Source File: PortMixer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #15
Source File: PortMixer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #16
Source File: PortMixer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #17
Source File: PortMixer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void enableControls(Control[] controls, boolean enable) {
    for (int i = 0; i < controls.length; i++) {
        if (controls[i] instanceof BoolCtrl) {
            ((BoolCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof FloatCtrl) {
            ((FloatCtrl) controls[i]).closed = !enable;
        }
        else if (controls[i] instanceof CompoundControl) {
            enableControls(((CompoundControl) controls[i]).getMemberControls(), enable);
        }
    }
}
 
Example #18
Source File: ToString.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
TestCompoundControl(CompoundControl.Type type, Control[] memberControls) {
    super(type, memberControls);
}