/
PlaySnd.VRX
42 lines (39 loc) · 1010 Bytes
/
PlaySnd.VRX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*:VRX Main
*/
Main:
Signal On Halt
Parse Arg soundfile
ok = VRRedirectStdIO("OFF")
Say soundfile
/* Load the DLL, initialize MCI REXX support */
Call Rxfuncadd 'mciRxInit', 'MCIAPI', 'mciRxInit'
Call mciRxInit
/* Open the sound file */
audiorc = mciRxSendString('open "'soundfile'" alias eventsound shareable wait', 'retstr', '0', '0')
Say 'open AudioRC = 'audiorc
If audiorc = 0 Then
Do
/* no error encountered */
audiorc = mciRxSendString('play eventsound wait', 'retstr', '0', '0')
Say 'play AudioRC = 'audiorc
If audiorc = 0 Then
Do
audiorc = mciRxSendString('close eventsound wait', 'retstr', '0', '0')
Say 'close AudioRC = 'audiorc
End
Else
Call mciRxSendString 'close eventsound wait', 'retst', '0', '0'
End
Call Halt audiorc
Exit
/*:VRX Halt
*/
Halt:
Parse Arg macrc
/* Make sure multimedia-REXX is properly terminated. */
Call mciRxExit
Exit macrc
/*:VRX LogError
*/
Logerror:
Return