Package javax.sound.midi

Examples of javax.sound.midi.MidiChannel



    public void open() {
        model.open();

        MidiChannel midiChannels[] = model.getMidiChannels();
        channels = new ChannelData[midiChannels.length];
        for (int i = 0; i < channels.length; i++) {
            channels[i] = new ChannelData(midiChannels[i], i);
        }
        cc = channels[0];
View Full Code Here


        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
View Full Code Here

        // Load the test soundbank into the synthesizer
        synth.unloadAllInstruments(synth.getDefaultSoundbank());
        synth.loadAllInstruments(sf2);
       
        // Send out one midi on message
        MidiChannel ch1 = synth.getChannels()[0];
        ch1.programChange(0);
        ch1.noteOn(64, 64);
       
        // Read 1 sec from stream
        stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 2)));

        // Close the synthesizer after use
View Full Code Here

TOP

Related Classes of javax.sound.midi.MidiChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.