Resume a paused sound
#include <Sound.au3>
_SoundResume ( $aSndID )
$aSndID | Sound ID array as returned by _SoundOpen() or a file name |
Success: | 1. |
Failure: | 0 and sets the @error flag to non-zero. |
@error: | 1 = Pause Failed 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name. |
_SoundPlay() will also resume playing after a sound has been paused in some cases.
_SoundOpen, _SoundPause, _SoundPlay
#include <MsgBoxConstants.au3>
#include <Sound.au3>
Local $aSound = _SoundOpen(@WindowsDir & "\media\tada.wav")
If @error = 2 Then
MsgBox($MB_SYSTEMMODAL, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
Local $iExtended = @extended ; Assign because @extended will be set after DllStructCreate().
Local $tText = DllStructCreate("char[128]")
DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $iExtended, "struct*", $tText, "int", 128)
MsgBox($MB_SYSTEMMODAL, "Error", "The open failed." & @CRLF & "Error Number: " & $iExtended & @CRLF & "Error Description: " & DllStructGetData($tText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox($MB_SYSTEMMODAL, "Success", "The file opened successfully")
EndIf
_SoundPlay($aSound)
Sleep(1000)
_SoundPause($aSound)
Sleep(1000)
_SoundResume($aSound)
While 1
Sleep(100)
If _SoundPos($aSound, 2) >= _SoundLength($aSound, 2) Then ExitLoop
WEnd
_SoundClose($aSound)