-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Support for connecting to MIDI devices #199
Comments
Yeah, check out the Let me know if you're missing APIs and I can add them. |
I see. That is going in the right direction. If I see that correctly, those functions can be found here: https://github.com/timsneath/win32/blob/dart2.13/lib/src/winmm.dart If I understand MCI correctly though, it is rather for playing midi files (so output only) rather than recording Midi Data. So I think there are some methods missing for my usecase (which I took from here: https://docs.microsoft.com/en-us/windows/win32/multimedia/recording-midi-audio) midiInGetNumDevs midiInAddBuffer I am actually not yet sure, if that's all I'd need, but so far it seems like it. |
Hi @ghost23, thanks -- that's very useful. I've updated the development branch with these features. If you add a dependency to this package like this: dependencies:
win32:
git:
url: https://github.com/timsneath/win32.git
ref: dart2.13 you should be able to use this in your app. Please let me know if you're missing anything else, and I'll add it in for you. When Dart 2.13 is released, I'll publish this as win32 2.1.0. |
Cool. I will try this on the weekend. Thank you for the quick replies! |
Hi @timsneath . So I finally got some time to test this. To speed things up, I found this quick example that shows how to use Win32 to read in MIDI Data from a device: https://gist.github.com/yoggy/1485181 In order to be sure that this actually works, I created a quick console app in Visual Studio and simply pasted in the code from the example. Started it while I had a Midi keyboard connected and tadaa, it worked. So now I attempted at replicating this in a flutter app. I created this little test project: https://github.com/ghost23/windows_midi There are some minor issues I was facing. Namely that some constants are missing like: MIM_OPEN | Int32 | 961 CALLBACK_FUNCTION | Int32 | 196608 But that's not too much of a problem, one can find the values easily online. When I run the app, I can connect to my MIDI device just fine. You do this via:
(https://github.com/ghost23/windows_midi/blob/main/lib/main.dart#L133) My problem now is that it seems I have setup the Pointer variable
(https://github.com/ghost23/windows_midi/blob/main/lib/main.dart#L142) Then as a result I get the It is not that obvious to how to correctly port the original example into dart using your Win32 library, so I was hoping you might have an idea, what I might be doing wrong here?! |
Typical, just a few minutes after posting this I figured, instead of trying to call:
perhaps I should rather call:
Now I am one step further. But now as soon as I press a key on my Midi Keyboard I now get the error:
Am I doing something wrong with my callback function? |
I wonder if this has something to do with it: dart-lang/sdk#40529 (comment) |
Taking a brief look at the threading issue. I've added the constants -- thanks for letting me know. Those things are always a nightmare to detect. I've now merged the win32:
git: https://github.com/timsneath/win32.git |
Hello,
this is a feature request. I am interested in building a flutter app for Windows that can connect to midi devices and read data from them. I understand that the Win32 library has such functionality. It would be nice to have access to it through this flutter plugin.
Thank you 🙂
The text was updated successfully, but these errors were encountered: