Java Code Examples for javax.sound.sampled.CompoundControl#getMemberControls()

The following examples show how to use javax.sound.sampled.CompoundControl#getMemberControls() . 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: 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 2
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);
        }
    }
}