PLAYWAV statement
Purpose: PLAYWAV plays the sound contained in a .wav soundfile.
Syntax 1: PLAYWAV(SoundFile$ [, ,SoundFlags]) Parameters:
|
Syntax 2: PLAYWAV("", Resource_ID% [,SoundFlags]) Parameters:
|
Example:
$RESOURCE "$PELLES$\bin\porc.exe" $COMPILER "$PELLES$\Bin\pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff $FILE$.c" $LINKER "$PELLES$\Bin\polink _ -release _ -machine:ix86 _ -subsystem:console _ -OUT:$FILE$.exe _ $FILE$.obj " BCX_RESOURCE 1234 RCDATA "C:\Windows\Media\Windows XP Startup.wav" PLAYWAV("", 1234)
BCX Console Sample Programs using PLAYWAV statement.
Here is an alternative to the PLAYWAV statement.
'The old 16bit MCI drivers have the downside of
'not being multi-threaded and hence you can only play
'one sound at a time or you get the mmsystem device in use
'dialog thrown up.
'
'Well, We do have one 32bit multi-threaded MCI driver in the
'default windows install and thats the mciqtz.drv of ActiveMovie.
'ActiveMovie plays all the standard filetypes covered in the older
'mci drivers and is perfectly compatible.
'
'So just comment out the older drivers in system.ini and
'add new lines assigning them to mciqtz.drv and you can
'now play multiple sounds simultaneously.
'
'[mci]
'cdaudio=mcicda.drv
'avivideo=mciavi.drv
';sequencer=mciseq.drv
'sequencer=mciqtz.drv
';waveaudio=mciwave.drv
'waveaudio=mciqtz.drv
'MPEGVideo2=mciqtz.drv
'
'I have tested wave and seq(midi) so far but I am positive
'that cd and avi would work fine also since ActiveMovie supports
'them too.
'
'What this does for us is allows us to use the simple MCI
'programming commands and still get mutli-threaded operation.
'Date: Mon, 10 Jun 2002 18:02:33 -0000
'From: "Bluepagan" <BluePagan@Yahoo.com>
' waves.bcx
' created by ezide
GUI
"EZIDEPROG"
GLOBAL
ghInstAS
HANDLEGLOBAL
hInstanceAS
HANDLEGLOBAL
Form1AS
HWNDGLOBAL
Button1AS
HWNDCONST
ID_Button1=
1
GLOBAL
Button2AS
HWNDCONST
ID_Button2=
2
GLOBAL
MciCommand$SUB
FORMLOAD' Start Building Our Form
Form1=
BCX_FORM
(
"Play Some Waves"
,0
,0
,117
,37
)
SetClassLong(
Form1, GCL_STYLE, GetClassLong(
Form1, GCL_STYLE)
| CS_DBLCLKS)
' Now create all controls
Button1=
CreateControl(
1
,"Wave1"
,ID_Button1,1409351680
,0
,10
,15
,98
,40
)
Button2=
CreateControl(
1
,"Wave2"
,ID_Button2,1409351680
,0
,121
,15
,97
,40
)
DECLARE
FUNCTION
MCI_ExecuteLIB
"winmm.dll"
ALIAS
"mciExecute"
(
A$)
SHOW
(
Form1)
' Show it!
END
SUB
BEGIN
EVENTS
SELECT
CASE
CBMSG
CASE
WM_CREATEEXIT
FUNCTION
CASE
WM_COMMANDIF
CBCTL
=
ID_Button1THEN
' Need to rename the wave without spaces
MciCommand$=
"play "
&
CHR$
(
34
)
&
"c:\windows\media\TheMicrosoftSound.wav"
&
CHR$
(
34
)
MCI_Execute(
MciCommand$)
EXIT
FUNCTION
END
IF
IF
CBCTL
=
ID_Button2THEN
MciCommand$=
"play c:\windows\media\Ding.wav"
MCI_Execute(
MciCommand$)
EXIT
FUNCTION
END
IF
CASE
WM_CLOSE DestroyWindow(
Form1)
EXIT
FUNCTION
END
SELECT
END
EVENTS
FUNCTION
CreateControl(
CtlType, CtlTxtAS
PCHAR, CtlID, CtlStyle, CtlExStyle, w, x, y, z)
AS
HWNDLOCAL
hWndNewAS
HANDLE' This LOGFONT struct is used to load indvidual Fonts on all valid Controls
LOCAL
lgfAS
LOGFONTLOCAL
s$SELECT
CASE
CtlTypeCASE
1
' create button control
lgf.lfHeight=
-
11
lgf.lfWidth=
0
lgf.lfEscapement=
0
lgf.lfOrientation=
0
lgf.lfWeight=
400
lgf.lfItalic=
0
lgf.lfUnderline=
0
lgf.lfStrikeOut=
0
lgf.lfCharSet=
0
lgf.lfOutPrecision=
0
lgf.lfClipPrecision=
0
lgf.lfQuality=
0
lgf.lfPitchAndFamily=
0
sprintf(
lgf.lfFaceName,"MS Sans Serif"
)
hWndNew=
CreateWindowEx(
CtlExStyle,"BUTTON"
, _ CtlTxt, CtlStyle, w, x, y, z, Form1, CtlID, ghInst, NULL)
SetWindowPos(
hWndNew, HWND_TOPMOST, w, x, y, z, SWP_NOMOVE|SWP_NOSIZE)
SendMessage(
hWndNew, WM_SETFONT, CreateFontIndirect(
&
lgf)
,0
)
END
SELECT
FUNCTION
=
hWndNewEND
FUNCTION