public Sf2Synth(Sf2File file, Table table, int voiceCount) { this.file = file; this.table = table; masterGain = 1; this.voiceCount = voiceCount; voices = new Voice[voiceCount]; for (int i = 0; i < voiceCount; i += 1) { voices[i].Init(i, file.data, table); } #if MIDIF_DEBUG_VISUALIZER WaveVisualizer.Request(0, 1024); WaveVisualizer.Request(1, 1024); WaveVisualizer.Request(2, 1024); WaveVisualizer.Request(3, 1024); WaveVisualizer.Request(4, 1024); WaveVisualizer.Request(5, 1024); #endif Reset(); }
public MidiSynth(Table table, float sampleRate, int voiceCount) { #if MIDIF_DEBUG_VISUALIZER WaveVisualizer.Request(0, 1024); #endif this.table = table; this.sampleRate = sampleRate; sampleRateRecip = 1f / sampleRate; masterGain = 1; envelopeConfig = new EnvelopeConfig(table, 120, .01f, 60, .1f, 100, .5f, 0, .01f); this.voiceCount = voiceCount; voices = new Voice[voiceCount]; for (int i = 0; i < voiceCount; i += 1) { voices[i].envelope = new Envelope(envelopeConfig); } Reset(); }