javax.sound.sampled.Control Java Examples

The following examples show how to use javax.sound.sampled.Control. 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: AbstractMixer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a new AbstractMixer.
 * @param mixer the mixer with which this line is associated
 * @param controls set of supported controls
 */
protected AbstractMixer(Mixer.Info mixerInfo,
                        Control[] controls,
                        Line.Info[] sourceLineInfo,
                        Line.Info[] targetLineInfo) {

    // Line.Info, AbstractMixer, Control[]
    super(new Line.Info(Mixer.class), null, controls);

    // setup the line part
    this.mixer = this;
    if (controls == null) {
        controls = new Control[0];
    }

    // setup the mixer part
    this.mixerInfo = mixerInfo;
    this.sourceLineInfo = sourceLineInfo;
    this.targetLineInfo = targetLineInfo;
}
 
Example #2
Source File: PortMixer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void implOpen() throws LineUnavailableException {
    if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
    long newID = ((PortMixer) mixer).getID();
    if ((id == 0) || (newID != id) || (controls.length == 0)) {
        id = newID;
        Vector vector = new Vector();
        synchronized (vector) {
            nGetControls(id, portIndex, vector);
            controls = new Control[vector.size()];
            for (int i = 0; i < controls.length; i++) {
                controls[i] = (Control) vector.elementAt(i);
            }
        }
    } else {
        enableControls(controls, true);
    }
    if (Printer.trace) Printer.trace("<< PortMixerPort: implOpen() succeeded");
}
 
Example #3
Source File: AbstractMixer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a new AbstractMixer.
 * @param mixer the mixer with which this line is associated
 * @param controls set of supported controls
 */
protected AbstractMixer(Mixer.Info mixerInfo,
                        Control[] controls,
                        Line.Info[] sourceLineInfo,
                        Line.Info[] targetLineInfo) {

    // Line.Info, AbstractMixer, Control[]
    super(new Line.Info(Mixer.class), null, controls);

    // setup the line part
    this.mixer = this;
    if (controls == null) {
        controls = new Control[0];
    }

    // setup the mixer part
    this.mixerInfo = mixerInfo;
    this.sourceLineInfo = sourceLineInfo;
    this.targetLineInfo = targetLineInfo;
}
 
Example #4
Source File: AbstractMixer.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new AbstractMixer.
 * @param mixerInfo the mixer with which this line is associated
 * @param controls set of supported controls
 */
protected AbstractMixer(Mixer.Info mixerInfo,
                        Control[] controls,
                        Line.Info[] sourceLineInfo,
                        Line.Info[] targetLineInfo) {

    // Line.Info, AbstractMixer, Control[]
    super(new Line.Info(Mixer.class), null, controls);

    // setup the line part
    this.mixer = this;
    if (controls == null) {
        controls = new Control[0];
    }

    // setup the mixer part
    this.mixerInfo = mixerInfo;
    this.sourceLineInfo = sourceLineInfo;
    this.targetLineInfo = targetLineInfo;
}
 
Example #5
Source File: PortMixer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void implOpen() throws LineUnavailableException {
    if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
    long newID = ((PortMixer) mixer).getID();
    if ((id == 0) || (newID != id) || (controls.length == 0)) {
        id = newID;
        Vector vector = new Vector();
        synchronized (vector) {
            nGetControls(id, portIndex, vector);
            controls = new Control[vector.size()];
            for (int i = 0; i < controls.length; i++) {
                controls[i] = (Control) vector.elementAt(i);
            }
        }
    } else {
        enableControls(controls, true);
    }
    if (Printer.trace) Printer.trace("<< PortMixerPort: implOpen() succeeded");
}
 
Example #6
Source File: PortMixer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
void implOpen() throws LineUnavailableException {
    if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
    long newID = ((PortMixer) mixer).getID();
    if ((id == 0) || (newID != id) || (controls.length == 0)) {
        id = newID;
        Vector vector = new Vector();
        synchronized (vector) {
            nGetControls(id, portIndex, vector);
            controls = new Control[vector.size()];
            for (int i = 0; i < controls.length; i++) {
                controls[i] = (Control) vector.elementAt(i);
            }
        }
    } else {
        enableControls(controls, true);
    }
    if (Printer.trace) Printer.trace("<< PortMixerPort: implOpen() succeeded");
}
 
Example #7
Source File: PortMixer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void implOpen() throws LineUnavailableException {
    if (Printer.trace) Printer.trace(">> PortMixerPort: implOpen().");
    long newID = ((PortMixer) mixer).getID();
    if ((id == 0) || (newID != id) || (controls.length == 0)) {
        id = newID;
        Vector<Control> vector = new Vector<>();
        synchronized (vector) {
            nGetControls(id, portIndex, vector);
            controls = new Control[vector.size()];
            for (int i = 0; i < controls.length; i++) {
                controls[i] = vector.elementAt(i);
            }
        }
    } else {
        enableControls(controls, true);
    }
    if (Printer.trace) Printer.trace("<< PortMixerPort: implOpen() succeeded");
}
 
Example #8
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 #9
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 #10
Source File: SoftMixingDataLine.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public final Control getControl(Type control) {
    if (control != null) {
        for (int i = 0; i < controls.length; i++) {
            if (controls[i].getType() == control) {
                return controls[i];
            }
        }
    }
    throw new IllegalArgumentException("Unsupported control type : "
            + control);
}
 
Example #11
Source File: SoftMixingDataLine.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public final Control getControl(Type control) {
    if (control != null) {
        for (int i = 0; i < controls.length; i++) {
            if (controls[i].getType() == control) {
                return controls[i];
            }
        }
    }
    throw new IllegalArgumentException("Unsupported control type : "
            + control);
}
 
Example #12
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 #13
Source File: AbstractLine.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the set of controls supported by the
 * line.  If no controls are supported, returns an
 * array of length 0.
 * @return control set
 */
public final Control[] getControls() {
    Control[] returnedArray = new Control[controls.length];

    for (int i = 0; i < controls.length; i++) {
        returnedArray[i] = controls[i];
    }

    return returnedArray;
}
 
Example #14
Source File: AbstractLine.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final boolean isControlSupported(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType == null) {
        return false;
    }

    for (int i = 0; i < controls.length; i++) {
        if (controlType == controls[i].getType()) {
            return true;
        }
    }

    return false;
}
 
Example #15
Source File: AbstractLine.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public final Control getControl(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType != null) {

        for (int i = 0; i < controls.length; i++) {
            if (controlType == controls[i].getType()) {
                return controls[i];
            }
        }
    }

    throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
 
Example #16
Source File: AbstractLine.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the set of controls supported by the
 * line.  If no controls are supported, returns an
 * array of length 0.
 * @return control set
 */
public final Control[] getControls() {
    Control[] returnedArray = new Control[controls.length];

    for (int i = 0; i < controls.length; i++) {
        returnedArray[i] = controls[i];
    }

    return returnedArray;
}
 
Example #17
Source File: SoftMixingDataLine.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final Control getControl(Type control) {
    if (control != null) {
        for (int i = 0; i < controls.length; i++) {
            if (controls[i].getType() == control) {
                return controls[i];
            }
        }
    }
    throw new IllegalArgumentException("Unsupported control type : "
            + control);
}
 
Example #18
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 #19
Source File: SoftMixingDataLine.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
    this.mixer = mixer;
    this.info = info;
    this.control_mutex = mixer.control_mutex;

    controls = new Control[] { gain_control, mute_control, balance_control,
            pan_control, reverbsend_control, chorussend_control,
            apply_reverb };
    calcVolume();
}
 
Example #20
Source File: AbstractLine.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Obtains the set of controls supported by the
 * line.  If no controls are supported, returns an
 * array of length 0.
 * @return control set
 */
@Override
public final Control[] getControls() {
    Control[] returnedArray = new Control[controls.length];

    for (int i = 0; i < controls.length; i++) {
        returnedArray[i] = controls[i];
    }

    return returnedArray;
}
 
Example #21
Source File: AbstractLine.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public final Control getControl(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType != null) {

        for (int i = 0; i < controls.length; i++) {
            if (controlType == controls[i].getType()) {
                return controls[i];
            }
        }
    }

    throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
 
Example #22
Source File: SoftMixingDataLine.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
    this.mixer = mixer;
    this.info = info;
    this.control_mutex = mixer.control_mutex;

    controls = new Control[] { gain_control, mute_control, balance_control,
            pan_control, reverbsend_control, chorussend_control,
            apply_reverb };
    calcVolume();
}
 
Example #23
Source File: AbstractLine.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the set of controls supported by the
 * line.  If no controls are supported, returns an
 * array of length 0.
 * @return control set
 */
public final Control[] getControls() {
    Control[] returnedArray = new Control[controls.length];

    for (int i = 0; i < controls.length; i++) {
        returnedArray[i] = controls[i];
    }

    return returnedArray;
}
 
Example #24
Source File: AbstractLine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the set of controls supported by the
 * line.  If no controls are supported, returns an
 * array of length 0.
 * @return control set
 */
public final Control[] getControls() {
    Control[] returnedArray = new Control[controls.length];

    for (int i = 0; i < controls.length; i++) {
        returnedArray[i] = controls[i];
    }

    return returnedArray;
}
 
Example #25
Source File: AbstractLine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final boolean isControlSupported(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType == null) {
        return false;
    }

    for (int i = 0; i < controls.length; i++) {
        if (controlType == controls[i].getType()) {
            return true;
        }
    }

    return false;
}
 
Example #26
Source File: AbstractLine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final Control getControl(Control.Type controlType) {
    // protect against a NullPointerException
    if (controlType != null) {

        for (int i = 0; i < controls.length; i++) {
            if (controlType == controls[i].getType()) {
                return controls[i];
            }
        }
    }

    throw new IllegalArgumentException("Unsupported control type: " + controlType);
}
 
Example #27
Source File: SoftMixingDataLine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
    this.mixer = mixer;
    this.info = info;
    this.control_mutex = mixer.control_mutex;

    controls = new Control[] { gain_control, mute_control, balance_control,
            pan_control, reverbsend_control, chorussend_control,
            apply_reverb };
    calcVolume();
}
 
Example #28
Source File: SoftMixingDataLine.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final Control getControl(Type control) {
    if (control != null) {
        for (int i = 0; i < controls.length; i++) {
            if (controls[i].getType() == control) {
                return controls[i];
            }
        }
    }
    throw new IllegalArgumentException("Unsupported control type : "
            + control);
}
 
Example #29
Source File: SoftMixingDataLine.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final Control getControl(Type control) {
    if (control != null) {
        for (int i = 0; i < controls.length; i++) {
            if (controls[i].getType() == control) {
                return controls[i];
            }
        }
    }
    throw new IllegalArgumentException("Unsupported control type : "
            + control);
}
 
Example #30
Source File: SoftMixingDataLine.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
SoftMixingDataLine(SoftMixingMixer mixer, DataLine.Info info) {
    this.mixer = mixer;
    this.info = info;
    this.control_mutex = mixer.control_mutex;

    controls = new Control[] { gain_control, mute_control, balance_control,
            pan_control, reverbsend_control, chorussend_control,
            apply_reverb };
    calcVolume();
}