Пример #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();
 }