Wohlstand / libOPNMIDI

A Software MIDI Synthesizer library with OPN2 (YM2612) emulator
GNU Lesser General Public License v3.0
96 stars 6 forks source link

Implement a User-mode MIDI Driver for Windows #95

Closed Wohlstand closed 1 year ago

Wohlstand commented 4 years ago

By a request of Kuzu (くず) who is a creator of Sekaiju MIDI editor, I use myself.

Here are examples of working MIDI drivers made by @nukeykt: https://www.vogons.org/viewtopic.php?f=9&t=36667

jpcima commented 4 years ago

The build of adljack for windows is a software MIDI driver, based on Kernel-mode. It will work if you install the driver in the LoopMidi software package.

It does the same functionality as a User-space driver. However yeah, if you really need User-space, Nuke.YKT's code is easy to reuse for it. It's based itself on Microsoft sample code for such drivers.

freq-mod commented 3 years ago

Hello, I have a problem with libOPNMIDI driver synth -it bulds fine, installs fine, drvtest.exe reports it's working, but depending on MIDI mapper/selector it either gives no audio or throws an error "can't open target device". OS is Windows 10 x64.

Wohlstand commented 3 years ago

@freq-mod , you need to install both 32 and 64-bit drivers on 64-bit OS.

freq-mod commented 3 years ago

I see. But, would it be possible to add binary driver (or rather its' installer) to AppVeyor CI? Setting up another 32-bit environment can be a hassle...

Wohlstand commented 3 years ago

I have such plan to simplify the whole usage of this.

Wohlstand commented 3 years ago

@freq-mod, I found some thing that on Windows 10 it's also hard to change default MIDI device, however, good that such of workarounds are exist: https://coolsoft.altervista.org/en/midimapper

freq-mod commented 3 years ago

Coolsoft's MIDI mapper? I tried that one as well of course, unfortunately the result was error box with "can't open the device" message.

Wohlstand commented 3 years ago

Very odd, yesterday I literally ran the thing on Windows 10 x64 in VM, and it worked... 🤔 At me is LTSC 1804 1809. Note that backend of drivers does use of WinMM WaveOut to play the result. Is that matter?

freq-mod commented 3 years ago

I tried it on LTSC 1809. How do I setup WinMM?

Wohlstand commented 3 years ago

WinMM is a built-in Windows' multimedia libray, its shoukd just work

Wohlstand commented 3 years ago

can't open the device

Btw, what the application you do use?

freq-mod commented 3 years ago

Coolsoft MIDI mapper + either Windows Media player or hoot. Also had installed Coolsoft's Virtual MIDI synth, just in case back then, didn't help

freq-mod commented 3 years ago

OK, I'm trying once again on a different PC with Win 10 x64 2004 - should I disable MIDI sequencer if I'm building this driver?

EDIT: Compiled it without sequencer, installed it, MIDI mapper has one thing to say for me: Can't open the targer device Do you want to select the device now? Clicikng OK, or Cancel, nothing happens, eror box disappers and MIDI plays without sound.

Wohlstand commented 3 years ago

Note that you need both 32 and 64 bit, because each of them will be used by 32 or 64bit apps, internally, user mode drivers are loading as plugins to every application

freq-mod commented 3 years ago

ok, i will try to build 32-bit driver with 32-bit mingw then...

freq-mod commented 3 years ago

fail

with 32 bits it has a weird problem

Wohlstand commented 3 years ago

Did you built this in the same directory as 64bit? You need to build this in different

freq-mod commented 3 years ago

Different, but few days ago when I built it in the same, it also errored out :thinking:

freq-mod commented 3 years ago

Used both vanilla MinGW, and 32-bit MinGW-w64(mingw32) toolchains, no success...

Wohlstand commented 3 years ago

@freq-mod , try to see the build guide at AppVeyor script, here is a tricky a bit, especially you need to build the thing being static

freq-mod commented 3 years ago

OK, good news, I managed to compile it after deleting 64-bit toolchain :rofl:

...and IT WORKS! Thanks!

SirForte commented 3 years ago

how bout you stop being lazy and make premade binarys for windows

sure you can argue that i'm being lazy and not compiling it myself, but i don't know anything about CMake

Wohlstand commented 3 years ago

how bout you stop being lazy and make premade binarys for windows

They are already here, look at my dev builds hive: https://builds.wohlsoft.ru/win32/ find libADLMIDI-winmm-driver-* and libOPNMIDI-winmm-driver-* here to get them working. :wink:

SirForte commented 3 years ago

They are already here, look at my dev builds hive: https://builds.wohlsoft.ru/win32/ find libADLMIDI-winmm-driver-* and libOPNMIDI-winmm-driver-* here to get them working.

oh if i known you made those i would've not been so mean. i'm sorry

raekuul commented 3 years ago

I'm running into an interesting situation, and I'm not sure if it's specific to the driver or if it's a problem with usermode drivers in general.

Essentially, the driver "disappears" after so long - as though it hadn't been installed at all (I'm on a machine that frequently flips between operating systems so at first I thought it was just windows being silly, but the driver has now disappeared on me no less than three times since booting windows today).

Wohlstand commented 3 years ago

the driver "disappears"

If you do use the Windows 10 version 2004 and newer, that means, it introduces the bug "feature" that auto-removes any drivers that were "incorrectly" installed during the boot. For that mess, a workaround is required...

Here is some discussion https://www.vogons.org/viewtopic.php?p=946265#p946265. It's related to NukeYkt's MIDI drivers, however, the same mess is applying to libADLMIDI and libOPNMIDI-based drivers as they do use the same core and the same way of install.

Wohlstand commented 1 year ago

The WinMM driver was done a while ago. Closing this as completed. Any bugs related to this driver (for example, the problem of Windows 10 2004+) should be posted as new issues.