use of com.sun.media.sound.SimpleSoundbank in project jdk8u_jdk by JetBrains.
the class TestPreciseTimestampRendering method createTestSoundbankWithChannelMixer.
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;
}
Aggregations