예제 #1
0
        public void Stop()
        {
            FluidSynth.Stop();

            _midiBuffer = null; // Clear databuffer for GC
            _state      = MidiState.Finished;
        }
예제 #2
0
        public void SetSoundFont(string path)
        {
            if (_state == MidiState.Playing)
            {
                throw new InvalidOperationException("Midi must be stopped before assigning a new soundfont");
            }

            FluidSynth.SetSoundFont(path);
        }
예제 #3
0
        public Midi(string defaultSoundFontPath)
        {
            _state = MidiState.None;

            if (!FluidSynth.Initialize(defaultSoundFontPath))
            {
                throw new Exception("Midi initializing failed");
            }
        }
예제 #4
0
        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());
        }
예제 #5
0
 public void Dispose()
 {
     FluidSynth.Destroy();
 }