Package com.sun.media.sound

Examples of com.sun.media.sound.SimpleInstrument


    public static Soundbank createTestSoundbankWithChannelMixer() {
        SF2Soundbank soundbank = createTestSoundbank();

        SimpleSoundbank simplesoundbank = new SimpleSoundbank();
        SimpleInstrument simpleinstrument = new SimpleInstrument() {

            public ModelChannelMixer getChannelMixer(MidiChannel channel,
                    AudioFormat format) {
                return new ModelAbstractChannelMixer() {
                    boolean active = true;

                    public boolean process(float[][] buffer, int offset, int len) {
                        for (int i = 0; i < buffer.length; i++) {
                            float[] cbuffer = buffer[i];
                            for (int j = 0; j < cbuffer.length; j++) {
                                cbuffer[j] = -cbuffer[j];
                            }
                        }
                        return active;
                    }

                    public void stop() {
                        active = false;
                    }
                };
            }

        };
        simpleinstrument.add(soundbank.getInstruments()[0]);
        simplesoundbank.addInstrument(simpleinstrument);

        return simplesoundbank;
    }
View Full Code Here

TOP

Related Classes of com.sun.media.sound.SimpleInstrument

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.