Open dromer opened 9 months ago
The current code relies on WinForms for the UI, and makes use of a Windows-only MIDI library, so most of the UI and MIDI interface code would need to be rewritten using cross-platform libraries in order to achieve Linux compatibility. I will look into this further in the future once I've tidied up the existing code base and issued a v1.0 release.
Right, I'm not too familiar with .NET ecosystem, but indeed it seems that NAudio.Midi is not suited for cross-platform work.
Anyway, thnx for not dismissing it immediately and wish you success with the project :)
Going cross platform (or simply to make the code refactoring easier) would mean first introducing the MVVM pattern.
The latest .NET 7 and furthermore .NET 8 versions of WinForms make this easier with much needed binding APIs.
Here is an example from Microsoft with the CommunityToolkit MVVM Toolkit (which writes the boring and repetitive parts of the MVVM pattern for you):
https://devblogs.microsoft.com/dotnet/winforms-cross-platform-dotnet-maui-command-binding/
(MAUI is another UI toolkit from MS, not related to WinForms)
@maximilien-noal except this project really needs proper MIDI i/o handling.
From what I can tell meltysynth only opens a midi file, not any midi hardware ports. (besides that opening soundfonts is completely out of scope for what MT32Editor needs to do, of course)
Yeah this is why I deleted my comment.
@maximilien-noal haha, sorry I didn't notice that yet :)
The only example I see with meltysynth to send midi is exactly also using NAudio: https://github.com/sinshu/meltysynth#use-meltysynth-as-a-midi-device-naudio--loopmidi
So we need a proper cross-platform replacement for NAudio for handling MIDI ports in modern .NET
Java has native cross platform Audio and MIDI support in its standard library, if the original version of spice86 source code (which was in Java) is to be believed. And the docs support this:
https://docs.oracle.com/javase/8/docs/api/javax/sound/midi/package-summary.html
Not so with .NET. And it's really frustrating when you try to write anything multimedia related... :/
There is managed-midi:
https://github.com/atsushieno/managed-midi
Or rather ther WAS because it's been abandonned.
Huge hope for IKVM to come to the rescue for cross platform MIDI ports access:
@maximilien-noal how is that exactly relevant? This project doesn't use Java at all.
Or would you then want to migrate MT32Editor to Java and IKVM?
IKVM makes the Java standard library, which has cross platform midi port access and control capabilities this issue cares about, available to .NET projects.
If IKVM enables this MIDI support, that is.
No need to move to Java. Java moves to you !
Sorry but I don't understand what a java vm has to do with a .NET project :shrug:
It's a .NET implementation of the Java runtime. It makes the Java standard library (and hopefully that will include soon the cross-platform MIDI port access part of it) available to any .NET project, along with any 3rd party Java package.
Ok, some weird kind of magic then :)
If it gets us there, then great!
Quick update- I've managed to get a version of the latest build (with a few minor tweaks to target .NET 4.7.2) to run on Linux using Wine and Mono. Whilst it's pretty laggy, it does seem to work. Link to Vogons post
Maybe far-fetched for now, but I'm really looking for a modern MT-32 editor that works cross-platform :)