IZI avatar image
0 Votes"
IZI asked NicoZhu-MSFT commented

When installed as Appx, the call to midiOutShortMsg produces no sound

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()
     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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi IZI, I found you post the same thread in the SO, and we have recorded and reported your problem. If we get any updates, we will post below.

Nico Zhu

0 Votes 0 ·

0 Answers