sfryers / MT32Editor

Timbre editor and patch librarian for MT-32 compatible devices
https://www.vogons.org/viewtopic.php?f=29&t=93609
GNU General Public License v3.0
18 stars 0 forks source link

Linux builds? #7

Open dromer opened 9 months ago

dromer commented 9 months ago

Maybe far-fetched for now, but I'm really looking for a modern MT-32 editor that works cross-platform :)

sfryers commented 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.

dromer commented 9 months ago

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 :)

maximilien-noal commented 5 months ago

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)

dromer commented 5 months ago

@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)

maximilien-noal commented 5 months ago

Yeah this is why I deleted my comment.

dromer commented 5 months ago

@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

maximilien-noal commented 5 months ago

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... :/

maximilien-noal commented 5 months ago

There is managed-midi:

https://github.com/atsushieno/managed-midi

Or rather ther WAS because it's been abandonned.

maximilien-noal commented 4 months ago

Huge hope for IKVM to come to the rescue for cross platform MIDI ports access:

https://github.com/ikvmnet/ikvm/issues/468

dromer commented 4 months ago

@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?

maximilien-noal commented 4 months ago

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 !

dromer commented 4 months ago

Sorry but I don't understand what a java vm has to do with a .NET project :shrug:

maximilien-noal commented 4 months ago

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.

dromer commented 4 months ago

Ok, some weird kind of magic then :)

If it gets us there, then great!

sfryers commented 4 months ago

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