public void Stop() { FluidSynth.Stop(); _midiBuffer = null; // Clear databuffer for GC _state = MidiState.Finished; }
public void SetSoundFont(string path) { if (_state == MidiState.Playing) { throw new InvalidOperationException("Midi must be stopped before assigning a new soundfont"); } FluidSynth.SetSoundFont(path); }
public Midi(string defaultSoundFontPath) { _state = MidiState.None; if (!FluidSynth.Initialize(defaultSoundFontPath)) { throw new Exception("Midi initializing failed"); } }
public void Play(DataBuffer midiBuffer) { if (_state == MidiState.Playing) { throw new InvalidOperationException("Midi must be stopped before playing assigning a new buffer"); } _midiBuffer = midiBuffer; _state = MidiState.Playing; FluidSynth.Play(midiBuffer.GetIntPtr(), midiBuffer.GetSize()); }
public void Dispose() { FluidSynth.Destroy(); }