Sign in to follow this  
Followers 0
Will66

vba macro - midiOutShortMsg

11 posts in this topic

#1 ·  Posted (edited)

I found this macro that plays midi notes directly through the winapi http://www.dailydoseofexcel.com/archives/2.../musical-excel/

winmm.dll has a bunch of routines for midi, try as i may i'm having no luck getting my head around dllcall to convert to autoitscript.

Demo works in Excel or msword -

create a new module in excel:

Option Explicit
Private Declare Function midiOutOpen Lib "winmm.dll" _
    (lphMidiOut As Long, _
    ByVal uDeviceID As Long, _
    ByVal dwCallback As Long, _
    ByVal dwInstance As Long, _
    ByVal dwFlags As Long) As Long
 
Private Declare Function midiOutClose Lib "winmm.dll" _
    (ByVal hMidiOut As Long) As Long
 
Private Declare Function midiOutShortMsg Lib "winmm.dll" _
    (ByVal hMidiOut As Long, _
    ByVal dwMsg As Long) As Long
 
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Dim hMidiOut As Long
Public lanote As Long
 
Sub PlayMIDI(voiceNum, noteNum, Duration)
    Dim Note As Long
    On Error Resume Next
    midiOutClose hMidiOut
    midiOutOpen hMidiOut, 0, 0, 0, 0
    midiOutShortMsg hMidiOut, RGB(192, voiceNum - 1, 127)
    lanote = 12 + CLng(noteNum)
    Note = RGB(144, lanote, 127)
    midiOutShortMsg hMidiOut, Note
    Sleep (Duration)
    midiOutClose hMidiOut
 End Sub

create a Macro to call PlayMIDI Sub:

Sub TestMidi()   
'plays a single midi note
    
        Call PlayMIDI(45, 48, 688)  'instrument - eg:0=piano,25=guitar, note - 48 is equal to middle c, duration of note in milliseconds
     
 End Sub

I've tried many things in autoitwithout success (sorry, won't let me use au code box):

Dim $result = DllCall("winmm.dll", "long", "midiOutOpen", "long", -1, "long", 0, "long", 0, "long", 0,"long",0)
    $iRet = DllCall("winmm.dll", "long", "midiOutShortMsg", "long", $result[0], "long",Hex(0x00403c90))
    sleep(1000)
    $iRet2 = DllCall("winmm.dll", "long", "midiOutShortMsg", "long", $result[0], "long",Hex(0x00003c90))
    sleep(1000)
    $iRet2 = DllCall("winmm.dll", "long", "midiOutClose","long",$result[0])
Edited by Will66

Share this post


Link to post
Share on other sites



my latest effort....left in comments pertaing to RGB conversion testing...pretty sure its wrong using hex()

Dim $hMidiOut
Global $lanote

Func midiOutOpen($lphMidiOut, $uDeviceID, $dwCallback, $dwInstance, $dwFlags)
    Global $Return
    $Return = DllCall ("winmm.dll", "int", "midiOutOpen", "int", $lphMidiOut, "int", $uDeviceID, "int", $dwCallback, "int", $dwInstance, "int", $dwFlags)
    Return $Return[0]
EndFunc

Func midiOutShortMsg($hMidiOut, $dwMsg)
    Global $Return
    $Return = DllCall ("winmm.dll", "int", "midiOutShortMsg", "int", $hMidiOut, "int", $dwMsg)
    Return $Return[0]
EndFunc

Func midiOutClose($hMidiOut)
    Global $Return
    $Return = DllCall ("winmm.dll", "int", "midiOutClose", "int", $hMidiOut)
    Return $Return[0]
EndFunc

Func PlayMIDI($voiceNum, $noteNum, $Duration)
    Dim $Note
    ;call("midiOutClose", $hMidiOut)
    call("midiOutOpen", $hMidiOut, 0, 0, 0, 0)
;MsgBox (RGB(192, voiceNum - 1, 127))
;midiOutShortMsg hMidiOut, RGB(192, voiceNum - 1, 127)  
    call("midiOutShortMsg", $hMidiOut, hex("192" & $voiceNum - 1 & "127"))
    $lanote = 12 + int($noteNum)
;Note = RGB(144, lanote, 127)
    $Note = hex("144" & $lanote & "127")
    call("midiOutShortMsg", $hMidiOut, $Note)
    Sleep ($Duration)
    call("midiOutClose", $hMidiOut)
EndFunc
;$vv=45
; MsgBox (0,"",hex("192" & $vv- 1 & "127"))
;8334528
;8338576
        Call("PlayMIDI",45, 48, 688)

Share this post


Link to post
Share on other sites

Here's the script in standard form, with the functions under the primary code, Global declarations at the top, Local declarations in the Funcs, and gettting rid of useless comments and that Call() foolishness:

Global $hMidiOut, $lanote

PlayMIDI(45, 48, 688)

Func PlayMIDI($voiceNum, $noteNum, $Duration)
    Local $Note
    midiOutOpen($hMidiOut, 0, 0, 0, 0)
    midiOutShortMsg($hMidiOut, Hex("192" & $voiceNum - 1 & "127"))
    $lanote = 12 + Int($noteNum)
    $Note = Hex("144" & $lanote & "127")
    midiOutShortMsg($hMidiOut, $Note)
    Sleep($Duration)
    midiOutClose($hMidiOut)
EndFunc   ;==>PlayMIDI

Func midiOutOpen($lphMidiOut, $uDeviceID, $dwCallback, $dwInstance, $dwFlags)
    Local $Return = DllCall("winmm.dll", "int", "midiOutOpen", "int", $lphMidiOut, "int", $uDeviceID, _
            "int", $dwCallback, "int", $dwInstance, "int", $dwFlags)
    Return $Return[0]
EndFunc   ;==>midiOutOpen

Func midiOutShortMsg($hMidiOut, $dwMsg)
    Local $Return = DllCall("winmm.dll", "int", "midiOutShortMsg", "int", $hMidiOut, "int", $dwMsg)
    Return $Return[0]
EndFunc   ;==>midiOutShortMsg

Func midiOutClose($hMidiOut)
    Local $Return = DllCall("winmm.dll", "int", "midiOutClose", "int", $hMidiOut)
    Return $Return[0]
EndFunc   ;==>midiOutClose

First problem, unless I mis-translated it into AutoIt, is nothing sets $hMidiOut before it is used.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

First problem, unless I mis-translated it into AutoIt, is nothing sets $hMidiOut before it is used.

:P

No go still.....basically you've rewritten the same code :)

$hMidiOut is not set in the excel vba script that i posted.

I read somewhere? $hMidiOut is for the midi device id....if its not specified its allocated the default midi device id.

Edited by Will66

Share this post


Link to post
Share on other sites

IFTM...any pointers on the RGB conversion

Share this post


Link to post
Share on other sites

No go still.....basically you've rewritten the same code :)

Exactly.

$hMidiOut is not set in the excel vba script that i posted.

I read somewhere? $hMidiOut is for the midi device id....if its not specified its allocated the default midi device id.

IFTM...any pointers on the RGB conversion

An RGB value is just a 24bit unsigned integer with 8bits each for R, G, and B. This will take three integers as inputs and return an RGB vlaue:

ConsoleWrite("Debug: 0x" & Hex(_RGB(16, 32, 48), 6) & @LF)

Func _RGB($R, $G, $B)
    ; Requires three integers between 0 and 255
    If IsInt($R) = 0 Or IsInt($G) = 0 Or IsInt($B) = 0 Then Return SetError(1, 0, 0)
    If $R < 0 Or $G < 0 Or $B < 0 Then Return SetError(2, 0, 0)
    If $R > 255 Or $G > 255 Or $B > 255 Then Return SetError(3, 0, 0)
    
    Return ((($R * 256) + $G) * 256) + $B
EndFuncoÝ÷ Øj¶¬!Ƨµée¶­©³*.®Ç+ZºÚ"µÍÛØ[    ÌÍÚZYSÝ]    ÌÍÛ[ÝB^SRQJ

K


B[È^SRQJ   ÌÍÝÚXÙS[K  ÌÍÛÝS[K ÌÍÑ][ÛBØØ[    ÌÍÓÝBZYSÝ]Ü[  ÌÍÚZYSÝ]
BZYSÝ]ÚÜÙÊ ÌÍÚZYSÝ]ÔÐNL  ÌÍÝÚXÙS[HHKLÊJB   ÌÍÛ[ÝHHL
È[
    ÌÍÛÝS[JB    ÌÍÓÝHHÔÐM
    ÌÍÛ[ÝKLÊBZYSÝ]ÚÜÙÊ    ÌÍÚZYSÝ]    ÌÍÓÝJBÛY
    ÌÍÑ][ÛBZYSÝ]ÛÜÙJ    ÌÍÚZYSÝ]
B[[ÈÏOIÝÔ^SRQB[ÈZYSÝ]Ü[  ÌÍÛZYSÝ]    ÌÍÝQ]XÙRQ   ÌÍÙÐØ[XÚË    ÌÍÙÒ[Ý[ÙK ÌÍÙÑYÜÊBØØ[ ÌÍÔ]HØ[
    ][ÝÝÚ[[K ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÛZYSÝ]Ü[][ÝË   ][ÝÚ[ ][ÝË  ÌÍÛZYSÝ]    ][ÝÚ[ ][ÝË  ÌÍÝQ]XÙRQÂ ][ÝÚ[ ][ÝË  ÌÍÙÐØ[XÚË    ][ÝÚ[ ][ÝË  ÌÍÙÒ[Ý[ÙK ][ÝÚ[ ][ÝË  ÌÍÙÑYÜÊB] ÌÍÔ]ÌB[[ÈÏOIÝÛZYSÝ]Ü[[ÈZYSÝ]ÚÜÙÊ    ÌÍÚZYSÝ]    ÌÍÙÓÙÊBØØ[  ÌÍÔ]HØ[
    ][ÝÝÚ[[K ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÛZYSÝ]ÚÜÙÉ][ÝË  ][ÝÚ[ ][ÝË  ÌÍÚZYSÝ]    ][ÝÚ[ ][ÝË  ÌÍÙÓÙÊB]  ÌÍÔ]ÌB[[ÈÏOIÝÛZYSÝ]ÚÜÙÂ[ÈZYSÝ]ÛÜÙJ    ÌÍÚZYSÝ]
BØØ[  ÌÍÔ]HØ[
    ][ÝÝÚ[[K ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÛZYSÝ]ÛÜÙI][ÝË   ][ÝÚ[ ][ÝË  ÌÍÚZYSÝ]
B]  ÌÍÔ]ÌB[[ÈÏOIÝÛZYSÝ]ÛÜÙB[ÈÔР ÌÍÔ  ÌÍÑË    ÌÍÐBNÈ]ZÈYH[YÙÈ]ÙY[[MBRYÒ[
    ÌÍÔHHÜÒ[
    ÌÍÑÊHHÜÒ[
    ÌÍÐHH[]Ù]ÜK
BRY ÌÍÔ  ÈÜ    ÌÍÑÈ    ÈÜ    ÌÍР È[]Ù]Ü
BRY ÌÍÔ  ÝÈMHÜ    ÌÍÑÈ    ÝÈMHÜ    ÌÍР ÝÈMH[]Ù]ÜË
BBT]


    ÌÍÔ
MH
È  ÌÍÑÊH
MH
È  ÌÍÐ[[

Still doesn't play anything for me, but maybe it's closer...

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

P.S. Where did you find the winmm.dll specs that said you could default $hmidiOut to null? Got a link?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

P.S. Where did you find the winmm.dll specs that said you could default $hmidiOut to null? Got a link?

:)

http://www.borg.com/~jglatt/tech/lowmidi.htm

http://dotnetslackers.com/articles/net/TastyBeatPart1.aspx

Midi's can be made on the fly and/or converted to delimited text files for human readable manipulation and visa versa by "walking" the binary data.

http://cnx.org/content/m15052/latest/ and/or outputted directly using winnmm.ddl functions.

#cs
;read a midi and output to console
$sFile = @ScriptDir & "\tv-gilligansisland.mid"
$hFile = FileOpen($sFile, 16) ; 16 = binary
$binData = FileRead($hFile) ; 

FileClose($hFile)
ConsoleWrite($binData & @LF)


;$binData = "0x4D546864000000060001000302D04D54726B0000000B00FF510307A12000FF2F004D54726B0000014000B0077F00C01800B0650000B0640000B0061800B1077F00C11800B1650000B1640000B10618009034688268803400009033688268803300009032688550E17538008032000091366814E1693914E15A3A14E14B3B14E13C3C14E12D3D14E11E3E14E10F3F14E10040814881360000903968826880390000903668826880360000903968826880390000904068826880400000903F688268803F0000903E688268803E0000903C688268803C0000913E6814E12C4014E1514014E1764014E11B4114E1404114E1654114E10A4214E12F4214E1544214E12F4214E10A4214E1654114E1404114E11B4114E1764014E1514014E12C4014813E0000E1004000903E688268803E0000903C688268803C0000903E688268803E0000903C688268803C0000903D688268803D00009039688268803900009034688B2080340000FF2F004D54726B0000002A00B2077F00C22100B2650000B2640000B2061800B3077F00C32100B3650000B3640000B3061800FF2F00" 

$binData = "0x4d546864000000060000000100804d54726b0000008c00ff58040402300800ff5902000000903c288100903c0000903c1e81"
$binData &= "00903c000090432d8100904300009043328100904300009045"
$binData &= "2d810090450000904532810090450000904323820090430000"
$binData &= "90413281009041000090412d81009041000090403240904000"
$binData &= "409040284090400040903e2d40903e0040903e3240903e0040"
$binData &= "903c1e8200903c0000ff2f00"
#ce

;create new midi

$binData = "0x4d546864000000060000000100604d54726b0000097600ff03"
$binData &= "1048756d6d656c204f702e36372d31310000ff580404021808"
$binData &= "00ff510307530000f00a4110421240007f0041f760f00a4110"
$binData &= "42124000047f3df702f00d41104212400000000400003cf702"
$binData &= "f00a41104212400130040bf702f00a411042124001380205f7"
$binData &= "5ab0790001b0000001b0200001c00101b0077f01b00a4001b0"
$binData &= "0b6401b05b2801b05d0004b1790001b1000001b1200001c101"
$binData &= "01b1077f01b10a4001b10b6401b15b2801b15d0004b2790001"
$binData &= "b2000001b2200001c20101b2077f01b20a4001b20b6401b25b"
$binData &= "2801b25d0004b3790001b3000001b3200001c30101b3077f01"
$binData &= "b30a4001b30b6401b35b2801b35d0004b4790001b4000001b4"
$binData &= "200001c40001b4076401b40a4001b40b6401b45b2801b45d00"
$binData &= "04b5790001b5000001b5200001c50001b5076401b50a4001b5"
$binData &= "0b6401b55b2801b55d0004b6790001b6000001b6200001c600"
$binData &= "01b6076401b60a4001b60b6401b65b2801b65d0004b7790001"
$binData &= "b7000001b7200001c70001b7076401b70a4001b70b6401b75b"
$binData &= "2801b75d0004b8790001b8000001b8200001c80001b8076401"
$binData &= "b80a4001b80b6401b85b2801b85d0004b9790001b9000001b9"
$binData &= "200001c90001b9076401b90a4001b90b6401b95b2801b95d00"
$binData &= "04ba790001ba000001ba200001ca0001ba076401ba0a4001ba"
$binData &= "0b6401ba5b2801ba5d0004bb790001bb000001bb200001cb00"
$binData &= "01bb076401bb0a4001bb0b6401bb5b2801bb5d0004bc790001"
$binData &= "bc000001bc200001cc0001bc076401bc0a4001bc0b6401bc5b"
$binData &= "2801bc5d0004bd790001bd000001bd200001cd0001bd076401"
$binData &= "bd0a4001bd0b6401bd5b2801bd5d0004be790001be000001be"
$binData &= "200001ce0001be076401be0a4001be0b6401be5b2801be5d00"
$binData &= "04bf790001bf000001bf200001cf0001bf076401bf0a4001bf"
$binData &= "0b6401bf5b2801bf5d0004ff5902050000ff510306ef9100b1"
$binData &= "407f00912f40189136401891334018913b4018b0407f00903f"
$binData &= "401890474018804740009042400d812f4000813b4000813640"
$binData &= "008133400b80424000904b400f803f4000804b4009b1407f00"
$binData &= "912f40189138401891334018913b4018b0407f009044401890"
$binData &= "4b4018804b40009047400d812f4000813b4000813840008133"
$binData &= "400b804740009050400f8044400080504009b1407f00912f40"
$binData &= "189138401891314018913b4018b0407f009041401890494018"
$binData &= "804940009044400d812f4000813b4000813840008131400b80"
$binData &= "444000904d400f80414000804d4009b1407f00912e40189136"
$binData &= "401891314018913a4018b0407f009042401890494018804940"
$binData &= "009046400d813640008131400b80464000904e400f80424000"
$binData &= "804e4009b0400000b00b6400b10b6400b1400000903f401890"
$binData &= "474018b00b6500b10b6500804740009042400d812e4000813a"
$binData &= "400bb00b6600b10b660080424000904b4018b00b6700b10b67"
$binData &= "00803f4000804b400090404000912c400091384018b00b6800"
$binData &= "b10b680090474018b00b6900b10b6900804740009044401880"
$binData &= "444000904c400f804c400080404009b00b6a00b10b6a00903e"
$binData &= "4018b00b6b00b10b6b0090464002812c400081384016b00b6c"
$binData &= "00b10b6c008046400090414018b00b6d00b10b6d0080414000"
$binData &= "904a4018b00b6e00b10b6e00803e4000804a4000903f400091"
$binData &= "364000912a401890464018b00b6f00b10b6f00804640009042"
$binData &= "4018b00b7000b10b700080424000904b400f803f4000804b40"
$binData &= "09b00b7100b10b7100903c4018b00b7200b10b720090444018"
$binData &= "b00b7300b10b730080444000903f400d812a40008136400bb0"
$binData &= "0b7400b10b7400803f40009048401880484000803c4000903d"
$binData &= "40009128400091344018b00b7500b10b750090444018b00b76"
$binData &= "00b10b76008044400090404018b00b7700b10b770080404000"
$binData &= "9049400f80494000803d4009b00b7800b10b7800903a4018b0"
$binData &= "0b7900b10b790090424002812840008134401680424000903d"
$binData &= "4018b00b7a00b10b7a00803d400090464018b00b7b00b10b7b"
$binData &= "00803a400080464000903b40009127400091334018b00b7c00"
$binData &= "b10b7c0090424018b00b7d00b10b7d0080424000903f400d81"
$binData &= "2740008133400bb00b7e00b10b7e00803f400090474d0f803b"
$binData &= "400080474009b00b7f00b10b7f0090344d0091314d0091254d"
$binData &= "18903d4d18803d400090384d188038400090404d18ff510307"
$binData &= "b189008131400081254000803440008040400090344d00912f"
$binData &= "4d0091234d18903d4d18803d400090374d188037400090404d"
$binData &= "18ff5103088e6b00812f400081234000803440008040400090"
$binData &= "344d0091224d00912e4d18903d4d18803d400090364d188036"
$binData &= "400090404d18ff510309703c0081224000812e400080404000"
$binData &= "8034400090334d0091234d00912f4d18903b4d18803b400090"
$binData &= "364d0d81234000812f400b80364000903f4d0f80334000803f"
$binData &= "4009ff510308e37c00b1407f0091284560912c3a3091313a30"
$binData &= "91343a0d91383a0e81384000913d3a0e813d400091403a0d81"
$binData &= "40400091443a0e8144400091493a0eb140000081494000914c"
$binData &= "3a0eff510311f39600814c400091503a178150400dff510308"
$binData &= "e37c0091523a0c8152400091503a0c81504000914f3a0c814f"
$binData &= "400091503a0c8150400091523a028152400aff51030b71b000"
$binData &= "ff510316e36000ff51030b71b00081284000812c4000813140"
$binData &= "00813440009153450781534005914f3a07814f400591503a07"
$binData &= "81504005914b3a07814b4005914c3a07814c400591483a0781"
$binData &= "48400591493a078149400591503a0781504005b1407f00914e"
$binData &= "3a0091364d00913b4d00913f4d0091424d09814e4027b1407f"
$binData &= "00ff510316e36000ff51030b71b000915a452c81364000813b"
$binData &= "4000813f400081424011815a4053ff510306ef910091583a0c"
$binData &= "8158400091573a0c8157400091553a0c8155400091533a0c81"
$binData &= "53400091523a0c8152400091503a0c81504000914e3a0c814e"
$binData &= "4000914c3a0c814c4000914b3a0c814b400091493a0c814940"
$binData &= "0091483a0c8148400091463a0c8146400091443a0c81444000"
$binData &= "91423a0c8142400091403a0cb140000081404000913f3a0cb1"
$binData &= "400000813f4000913d3a0c813d4000913b3a0c813b4000913a"
$binData &= "3a0c813a400091383a0c8138400091363a028136400ab1407f"
$binData &= "00ff51030b71b000911e5c00912a5c1e811e4000812a4036b1"
$binData &= "400030913a3a0091363a0091343a3d813a4000813640008134"
$binData &= "4023b1407f0091233a00912f3a0091343a0091363a00913a3a"
$binData &= "00913d3a60b0407f0090233a0d8023400090273a0d81234000"
$binData &= "812f40008134400081364000813a4000813d40018027400090"
$binData &= "2a3a0e802a4000902f3a0d802f400090333a0e803340009036"
$binData &= "3a0e80364000903b3a0eff510316e36000ff51030b71b00080"
$binData &= "3b400091233a7a81234046b14000a101ff2f00"

$sFile = @ScriptDir & "\testing.mid"
$hFile = FileOpen($sFile, 2+16) ; 16 = binary
$Data = FileWrite($hFile,$binData)

FileClose($hFile)

Share this post


Link to post
Share on other sites

I think you have misunderstood this: Opening the default MIDI device for output

When you use the MIDI Mapper for output, think of the Multimedia utility's "MIDI" page as becoming the "MIDI Setup" dialog for your own application. Whichever way the user set that page up is where your calls to midiOutShortMsg() and midiOutLongMsg() get routed. So, by opening the MIDI Mapper, you use the "default MIDI Out" setup.

The MIDI Mapper has a defined Device ID of -1, so to open MIDI Mapper for MIDI Output:

unsigned long result;
HMIDIOUT      outHandle;

/* Open the MIDI Mapper */
result = midiOutOpen(&outHandle, (UINT)-1, 0, 0, CALLBACK_WINDOW);
if (result)
{
   printf("There was an error opening MIDI Mapper!\r\n");
}
I'm not sure (there are smarter people on this forum who probably know) but that looks more like retreiving the handle with a ByRef of some kind. The device ID ($uDeviceID in your script) would be -1, not 0 or null, wouldn't it?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I'm not sure (there are smarter people on this forum who probably know) but that looks more like retreiving the handle with a ByRef of some kind. The device ID ($uDeviceID in your script) would be -1, not 0 or null, wouldn't it?

:)

There are smarter people,lol...eynstyne even....just have to find them first MIDIUDF.au3

Thanx for all your help @PsaltyDS, much appreciated!

Not sure why no one else bothered to point this "recent" topic out though...

$open = _MidiOutOpen()
$msg=_midiOutShortMsg($open,256 * 26 + 192)
$msg=_midiOutShortMsg($open,0x00402990)

Sleep(1700)
_midiOutclose($open)

    

Func _midiOutOpen($devid=0,$callback=0,$instance=0,$flags=0)

    $struct = DllStructCreate("udword")

     $ret = Dllcall("winmm.dll","long","midiOutOpen","ptr",DllStructGetPtr($struct),"int",$devid,"long",$callback,"long",$instance,"long",$flags)
      if not @error Then
           $Get = Dllstructgetdata($struct,1)
           Return $get
           else
            Return $ret[0]
       EndIf      
   EndFunc ;==>midiOutOpen

Func _MidiOutShortMsg($hmidiout,$msg)
    $ret = Dllcall("winmm.dll","long","midiOutShortMsg","long",$Hmidiout,"long",$msg)
     if not @error Then Return $ret[0]
EndFunc  ;==>midiOutShortMsg

 Func _MidiOutClose($hmidiout)
     $ret = Dllcall("winmm.dll","long","midiOutClose","long",$hmidiout)
   if not @error Then Return $ret[0]
   EndFunc   ;==>midiOutClose
Edited by Will66

Share this post


Link to post
Share on other sites

There are smarter people,lol...eynstyne even....just have to find them first MIDIUDF.au3

Thanx for all your help @PsaltyDS, much appreciated!

Not sure why no one else bothered to point this "recent" topic out though...

Glad you found the smart people, and your answer!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0