Sign in to follow this  
Followers 0
=sinister=

Midi Not Playing

2 posts in this topic

#1 ·  Posted (edited)

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=

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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