I'm using the following code. After I convert it to Appx using the Desktop App Converter, the midiOutShortMsg (from "winmm.dll") doesn't produce any sound.
Public Class MidiOut2
<DllImport("winmm.dll", EntryPoint:="midiOutShortMsg")>
Private Shared Function midiOutShortMsg(ByVal hMidiOut As IntPtr, ByVal msg As Integer) As UInteger
End Function
<DllImport("winmm.dll", EntryPoint:="midiOutOpen")>
Private Shared Function midiOutOpen(ByRef lphMidiOut As IntPtr, ByVal uDeviceID%, ByVal dwCallback As IntPtr, ByVal dwInstance As IntPtr, ByVal dwFlags As Integer) As UInteger
End Function
Private hMidiOut As IntPtr = IntPtr.Zero
Public Sub Send(status%, toneNum%, vol%)
shortMsg% = (vol << 16) Or (toneNum << 8) Or status
midiOutShortMsg(hMidiOut, shortMsg)
End Sub
Public Sub New(DevID%)
midiOutOpen(hMidiOut, DevID, Nothing, IntPtr.Zero, 0)
End Sub
' ...
<DllImport("winmm.dll", EntryPoint:="midiOutClose")>
Private Shared Function midiOutclose(h As IntPtr) As UInteger
End Function
Public Sub Close()
midiOutclose(hMidiOut)
End Sub
End Class
'--------------------
'I call it from class Form1:
Dim midiOut0 as New MidiOut2(0)
midiOut0.Send(153, someNote%, Velocity%)
' 153 is status byte value for drum channel note-on
' someNote can be from 35 to 81 (standard midi drum set)
' Velocity = 127 (max volume)
What must I do for the sound to work in Appx? It works before the conversion.