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. This example can play a .mid file and .wav file at the same time. With modifications, the program can play two .wav files at the same time. However, it can not play two .mid files at the same time. This demo uses the .mid and .wav files from the GUI_Demo\Breakout game. You may have to adjust the paths in the FileName1$ and FileName2$ variables. Run the demo, click on the Start button and then click on the Overlay button and you will hear the .wav voice superimposed on the .mid music.
GUI"PlayMT"$LIBRARY<winmm.lib>GLOBALForm1ASHWNDGLOBALButton1ASHWNDGLOBALButton2ASHWNDGLOBALFileName1$GLOBALFileName2$GLOBALRetStr$CONSTID_Button1=101CONSTID_Button2=102SUBFORMLOADForm1=BCX_FORM("Play Multi-Thread",0,0,120,30)Button1=BCX_BUTTON("Start", Form1, ID_Button1,10,5,45,16)Button2=BCX_BUTTON("Overlay", Form1, ID_Button2,60,5,45,16)FileName1$=BCXPATH$&"..\GUI_Demo\Breakout\Splash.mid"FileName2$=BCXPATH$&"..\GUI_Demo\Breakout\Level.wav"mciSendString("open "&CHR$(34)&FileName1$&CHR$(34)&" alias mid1", RetStr$,255, Form1)mciSendString("open "&CHR$(34)&FileName2$&CHR$(34)&" alias wav2", RetStr$,255, Form1)SHOW(Form1)' Show it!ENDSUBBEGINEVENTSSELECTCASECBMSGCASEWM_CREATEEXITFUNCTIONCASEWM_COMMANDIFCBCTL=ID_Button1THENmciSendString("seek mid1 to start", RetStr$,255, Form1)mciSendString("play mid1", RetStr$,255, Form1)EXITFUNCTIONENDIFIFCBCTL=ID_Button2THENmciSendString("seek wav2 to start", RetStr$,255, Form1)mciSendString("play wav2", RetStr$,255, Form1)EXITFUNCTIONENDIFCASEWM_CLOSE mciSendString("close all", RetStr$,255, Form1)DestroyWindow(Form1)EXITFUNCTIONENDSELECTENDEVENTS