Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play Midi with an „internal“ driver.. #83

Closed
FischertBilligheim opened this issue Apr 18, 2020 · 2 comments
Closed

Play Midi with an „internal“ driver.. #83

FischertBilligheim opened this issue Apr 18, 2020 · 2 comments
Labels
question Just question about the library

Comments

@FischertBilligheim
Copy link
Contributor

Hi Max,

How can I do a playback without a midi-device? This sounds stupid - yes, but:

The idea is to use the „fluidsynth“-dll and and the c#-wrapper of it (Nfluidsynth) as an „internal“ player for mididata by using a soundfount.

The „Nfluidsynth“ project has a simple interface for note_on/note_off/Set_controllers etc. I would do these calls in the Midi-Event Callback. But for that I need a Midi-device, correct?

Best regards
Thomas

@melanchall
Copy link
Owner

Hi Thomas,

You have two options:

  1. Use Playback without output device.
    You can play MIDI data with Playback class without output device. There are Playback constructors that don't have outputDevice parameter. Also all GetPlayback extension methods (for example GetPlayback(midiFile, clockSettings = null)) have overloads without this parameter. More than that you can set Playback.OutputDevice property to null at any time. So you can play MIDI data without MIDI device and get all callbacks called.
  2. Create custom output device
    In fact, playback API works with IOutputDevice interface rather than with OutputDevice class. Last one is built-in inplementation of IOutputDevice. So you can create your own implementation and use it as output device for playback. In your case I suppose you can implement just SendEvent method and leave other ones empty.

In my opinion, the last option is preferred. I believe all I/O operations should be incapsulated in devices and not in general events or callbacks. Also it will be easier to reuse I/O code.

@FischertBilligheim
Copy link
Contributor Author

Hi Max,

Thanks again a lot for your great support!
I will proceed with the „Custom output device“-approach.

Best regards
Thomas

@melanchall melanchall added the question Just question about the library label Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Just question about the library
Projects
None yet
Development

No branches or pull requests

2 participants