false);
public static SF2Soundbank createTestSoundbank() {
// Create impulse instrument
// used to measure timing of note-on playback
SF2Soundbank soundbank = new SF2Soundbank();
float[] data = new float[100];
Arrays.fill(data, 0);
data[0] = 1.0f;
byte[] bdata = new byte[data.length * format.getFrameSize()];
AudioFloatConverter.getConverter(format).toByteArray(data, bdata);
SF2Sample sample = new SF2Sample(soundbank);
sample.setName("Test Sample");
sample.setData(bdata);
sample.setSampleRate((long) format.getSampleRate());
sample.setOriginalPitch(69);
soundbank.addResource(sample);
SF2Layer layer = new SF2Layer(soundbank);
layer.setName("Test Layer");
soundbank.addResource(layer);
SF2LayerRegion region = new SF2LayerRegion();
region.setSample(sample);
layer.getRegions().add(region);
SF2Instrument ins = new SF2Instrument(soundbank);
ins.setName("Test Instrument");
soundbank.addInstrument(ins);
SF2InstrumentRegion insregion = new SF2InstrumentRegion();
insregion.setLayer(layer);
ins.getRegions().add(insregion);
return soundbank;