Java 类com.sun.media.sound.SoftSynthesizer 实例源码

项目:jdk8u-jdk    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:openjdk-jdk10    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:openjdk9    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:jdk8u_jdk    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:infobip-open-jdk-8    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:jdk8u-dev-jdk    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:jdk7-jdk    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:openjdk-source-code-learn    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:OLD-OpenJDK8    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:JAVA_UNIT    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:openjdk-jdk7u-jdk    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:openjdk-icedtea7    文件:GetReceiver2.java   
public static void main(String[] args) throws Exception {
    AudioSynthesizer synth = new SoftSynthesizer();
    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
    synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);
    synth.close();
    try
    {
        recv.send(sm, -1);
        throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
        // Just checking if exception is thrown
    }
}
项目:tuxguitar    文件:SoftLowFrequencyOscillator.java   
public void init(SoftSynthesizer synth) {
    control_time = 1.0 / synth.getControlRate();
    sin_factor = control_time * 2 * Math.PI;
    for (int i = 0; i < used_count; i++) {
        delay_counter[i] = (int)(Math.pow(2,
                this.delay[i][0] / 1200.0) / control_time);
        delay_counter[i] += (int)(delay2[i][0] / (control_time * 1000));
    }
    processControlLogic();
}
项目:jdk8u-jdk    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:jdk8u-jdk    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:openjdk-jdk10    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:openjdk-jdk10    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:openjdk9    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:openjdk9    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:jdk8u_jdk    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:jdk8u_jdk    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:lookaside_java-1.8.0-openjdk    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:lookaside_java-1.8.0-openjdk    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:TuxGuitar-1.3.1-fork    文件:SoftReceiver.java   
public SoftReceiver(SoftSynthesizer synth) {
    this.control_mutex = synth.control_mutex;
    this.synth = synth;
    this.mainmixer = synth.getMainMixer();
    if (mainmixer != null)
        this.midimessages = mainmixer.midimessages;
}
项目:TuxGuitar-1.3.1-fork    文件:SoftChannel.java   
public SoftChannel(SoftSynthesizer synth, int channel) {
    this.channel = channel;
    this.voices = synth.getVoices();
    this.synthesizer = synth;
    this.mainmixer = synth.getMainMixer();
    control_mutex = synth.control_mutex;
    resetAllControllers(true);
}
项目:TuxGuitar-1.3.1-fork    文件:SoftLowFrequencyOscillator.java   
public void init(SoftSynthesizer synth) {
    control_time = 1.0 / synth.getControlRate();
    sin_factor = control_time * 2 * Math.PI;
    for (int i = 0; i < used_count; i++) {
        delay_counter[i] = (int)(Math.pow(2,
                this.delay[i][0] / 1200.0) / control_time);
        delay_counter[i] += (int)(delay2[i][0] / (control_time * 1000));
    }
    processControlLogic();
}
项目:infobip-open-jdk-8    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:infobip-open-jdk-8    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:jdk8u-dev-jdk    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:jdk8u-dev-jdk    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:jdk7-jdk    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:jdk7-jdk    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:openjdk-source-code-learn    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:openjdk-source-code-learn    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:OLD-OpenJDK8    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:OLD-OpenJDK8    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:JAVA_UNIT    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}
项目:JAVA_UNIT    文件:GetMidiDevice.java   
public static void main(String[] args) throws Exception {

        AudioSynthesizer synth = new SoftSynthesizer();
        synth.openStream(null, null);
        Receiver recv = synth.getReceiver();
        if (((SoftReceiver) recv).getMidiDevice() != synth) {
            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
                    + "instance of the synthesizer");
        }
        synth.close();
    }
项目:openjdk-jdk7u-jdk    文件:NoteOverFlowTest.java   
public static void main(String[] args) throws Exception
{
    AudioSynthesizer synth = new SoftSynthesizer();
    AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
    AudioInputStream stream = synth.openStream(format, null);

    // Make all voices busy, e.g.
    // send midi on and midi off on all available voices
    MidiChannel ch1 = synth.getChannels()[0];
    ch1.programChange(48); // Use contionus instrument like string ensemble
    for (int i = 0; i < synth.getMaxPolyphony(); i++) {
        ch1.noteOn(64, 64);
        ch1.noteOff(64);
    }

    // Now send single midi on, and midi off message
    ch1.noteOn(64, 64);
    ch1.noteOff(64);

    // Read 10 sec from stream, by this time all voices should be inactvie
    stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 20)));

    // If no voice are active, then this test will pass
    VoiceStatus[] v = synth.getVoiceStatus();
    for (int i = 0; i < v.length; i++) {
        if(v[i].active)
        {
            throw new RuntimeException("Not all voices are inactive!");
        }
    }

    // Close the synthesizer after use
    synth.close();
}