JustinReno Posted January 5, 2008 Share Posted January 5, 2008 I've been having problems with the function _SoundLength(). _SoundLength() is failing, its not an error, but it just keeps failing. And I'm not sure why. Any help is appreciated. Thanks. Here is a reproducer: $Sound = @WindowsDir&"\Media\Notify.wav" $Open = _SoundOpen($Sound) MsgBox(0, "", _SoundLength($Open, 2)) Link to comment Share on other sites More sharing options...
GaryFrost Posted January 6, 2008 Share Posted January 6, 2008 Seems like Jos and someone else was working on those functions. Might want to check in bug reports. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 6, 2008 Share Posted January 6, 2008 try using this Func _SoundLength($sSnd_id, $iMode = 1) ;Declare variables Local $iSnd_len_ms, $iSnd_len_min, $iSnd_len_hour, $iSnd_len_sec, $sSnd_len_format ;validate $iMode If $iMode <> 1 And $iMode <> 2 Then Return SetError(1, 0, 0) ;tell mci to use time in milliseconds mciSendString("set " & FileGetShortName($sSnd_id) & " time format miliseconds") ;recieve length of sound $iSnd_len_ms = mciSendString("status " & FileGetShortName($sSnd_id) & " length") ;assign modified data to variables $iSnd_len_min = Int($iSnd_len_ms / 60000) $iSnd_len_hour = Int($iSnd_len_min / 60) $iSnd_len_sec = Int(Int($iSnd_len_ms / 1000) - ($iSnd_len_min * 60)) ;assign formatted data to $sSnd_len_format $sSnd_len_format = StringFormat("%02i:%02i:%02i", $iSnd_len_hour, $iSnd_len_min, $iSnd_len_sec) ;return correct variable If $iMode = 1 Then Return $sSnd_len_format If $iMode = 2 Then Return $iSnd_len_ms EndFunc ;==>_SoundLength its from 3.2.6.x Should work fine! [center][/center] Link to comment Share on other sites More sharing options...
JustinReno Posted January 6, 2008 Author Share Posted January 6, 2008 I found the updated version from Jos. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now