I'm making some progress in playing WAV files from PBDLL
programs. The following program seems to work, except for
the proper call to PLAYSOUND function when passing a copy
of a file in a string, instead of the file name.
Questions I have:
1. Where can I find the documentation for the
function PLAYSOUND. It works but is nowhere
to be found in PDDLL HELP, or WIN32API.HLP.
2. By experimentation I've found giving PLAYSOUND
a file name that does not exist, e.g. "" causes
sound to terminate. Does doing so mess up any
memory structures that will cause me problems
later. Or perhaps there is a documented legal
way to stop sound from being played?
3. I'd like to have the .WAV files in memory and
pass them to the PLAYSOUND function. Is there
a mechanism to create memory files and use a
memory handle as if it were a file. I'd
appreciate any references or examples that do this.
Can anyone help me with calarification/info references?
--------------------------------------------------------------
' In the program below Fname must be the path and file
' name for a .WAV file (or maybe other file types are
' accepted?
--------------------------------------------------------------
programs. The following program seems to work, except for
the proper call to PLAYSOUND function when passing a copy
of a file in a string, instead of the file name.
Questions I have:
1. Where can I find the documentation for the
function PLAYSOUND. It works but is nowhere
to be found in PDDLL HELP, or WIN32API.HLP.
2. By experimentation I've found giving PLAYSOUND
a file name that does not exist, e.g. "" causes
sound to terminate. Does doing so mess up any
memory structures that will cause me problems
later. Or perhaps there is a documented legal
way to stop sound from being played?
3. I'd like to have the .WAV files in memory and
pass them to the PLAYSOUND function. Is there
a mechanism to create memory files and use a
memory handle as if it were a file. I'd
appreciate any references or examples that do this.
Can anyone help me with calarification/info references?
--------------------------------------------------------------
' In the program below Fname must be the path and file
' name for a .WAV file (or maybe other file types are
' accepted?
--------------------------------------------------------------
Code:
#COMPILE EXE #REGISTER NONE $INCLUDE "WIN32API.INC" GLOBAL MemoryString AS STRING SUB PlayWave(Fn AS STRING) PlaySound BYCOPY Fn,BYVAL NULL%,%SND_ASYNC END SUB CALLBACK FUNCTION CBPlay:CALL PlayWave("1c-1.wav"):END FUNCTION CALLBACK FUNCTION CBStop:CALL PlayWave(""):END FUNCTION CALLBACK FUNCTION CBMem:CALL PlayWave(MemoryString):END FUNCTION FUNCTION PBMAIN() AS LONG LOCAL hDlg AS LONG LOCAL Fname AS STRING Fname="1c-1.wav" OPEN Fname FOR RANDOM AS #1:GET$ 1,LOF(1),MemoryString:CLOSE #1 DIALOG NEW 0,"Play Wav",,,320,240,_ %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MAXIMIZEBOX OR _ %WS_MINIMIZEBOX OR %DS_CONTEXTHELP,0 TO hDlg IF hDlg=0 THEN EXIT FUNCTION ' Error occurred CONTROL ADD BUTTON,hDlg,200,"Play "+Fname,130,60,60,20,0 CALL CBPlay() CONTROL ADD BUTTON,hDlg,201,"Play Memory Copy",130,100,100,20,0 CALL CBMem() CONTROL ADD BUTTON,hDlg,202,"Stop Playing",130,140,60,20,0 CALL CBStop() DIALOG SHOW MODAL hDlg END FUNCTION
Comment