
MCI and sound gurus, please help
Quote:
> Hi,
> how can I play a wave file previously stored in string
> variable? ( if that is possible at all)
It's possible, if the waveform will fit inside 64KB. The
sndPlaySound API call will accept a pointer to the waveform data
as well as a filename, depending on what flags you pass to it.
Here's the (16-bit) Declare and the relevant constants:
Declare Function sndPlaySound Lib "MMSystem.dll" (ByVal lpszSoundName As Any, ByVal uFlags As Integer) As Integer
' flag values for wFlags parameter
Global Const SND_SYNC = &H0 ' play synchronously (default)
Global Const SND_ASYNC = &H1 ' play asynchronously
Global Const SND_NODEFAULT = &H2 ' don't use default sound
Global Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Global Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Global Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
I've also had good luck using the global memory API's to store
larger waveforms in memory, but if the program crashes, those
waveforms may or may not get automatically freed. Bummer!
[chomp]
--
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!