Jump to content

Midi Not Playing


Recommended Posts

I'm not sure where to begin debugging this. For some reason, the midi udf:

http://www.autoitscript.com/forum/index.php?showtopic=37072&hl=midi&st=0

does not produce any sound. I've tried various amounts of scripts with it (including some posted on these boards). If anyone could help me out, I'd really appreciate it.

Running Windows 7 x64 bit (And other programs that use midi that aren't coded in autoit work properly)

Edited by =sinister=
Link to comment
Share on other sites

Hi,

Just force MCI to use the Sequencer to play the mid file, crude example.

#include <Misc.au3>

$sAlias = _RandomStr()
_mciSendString("open " & FileGetShortName(@WindowsDir & "\Media\flourish.mid") & " alias " & $sAlias & " type Sequencer")
_mciSendString("play " & $sAlias)

While (Not _IsPressed("1B")) ;Esc to exit
    Sleep(100)
WEnd

; #FUNCTION# ==============================================================================================
; Name...........: _RandomStr
; Description....: Creates a random string
; Syntax.........: _RandomStr([$iLen = 10])
; Parameters ....: $iLen      - Length of string to return
; Return values .: Success    - Returns a string of random letters (a~z)
; Author ........: RazerM
; =========================================================================================================
Func _RandomStr($iLen = 10)
    Local $sTmp = ''
    For $i = 1 To $iLen
        $sTmp &= Chr(Random(97, 122, 1))
    Next
    Return $sTmp
EndFunc   ;==>_RandomStr

; #FUNCTION# ==============================================================================================
; Name...........: _mciSendString
; Description....:
; Syntax.........: _mciSendString($string[, $iLen = 0])
; Parameters ....: $string
;                  $iLen
; Return values .:
; Author ........: RazerM
; =========================================================================================================
Func _mciSendString($string, $iLen = 0)
    Local $iRet
    $iRet = DllCall("winmm.dll", "int", "mciSendStringA", "str", $string, "str", "", "long", $iLen, "long", 0)
    If Not @error Then Return $iRet[2]
EndFunc   ;==>_mciSendString

I'm using Win7 x64 and it works for me..

Cheers

Edited by smashly
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...