MCI and sound gurus, please help 
Author Message
 MCI and sound gurus, please help

Hi,

how can I play a wave file previously stored in string
variable? ( if that is possible at all)

Here's the problem:

In my app I want to play an arbitrary sequence of numbers
(think of a phone number, e.g.).Currently I have the numbers
0-9 stored in a single wave-file and I jump to the appropriate
segment of the wavefile to play the number I want.

For various reasons I want to store each number in a separate
wave file like one.wav, two.wav, three.wav, etc. When I do it
this way, of course, each wave-file needs to be loaded and due
to this loading time there is a pause after each number. That's
ugly.

So what I need to do is to load all my wave-files into memory
at the start of the program and then play the files from
memory.

But how can I do this? I was thinking of setting up an array of
string variables and load each wave file into such a variable.

But how can I play "variables"? As far as I know, the property
MCIControl.Filename accepts only real filenames, not string
variables.

Does anyone have any idea.

Thanks a lot

Sascha

Sascha W. Felix



Mon, 24 Aug 1998 03:00:00 GMT  
 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!



Mon, 24 Aug 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. GURU/SEMI-GURU please help with ActiveX DLL threading question

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. Help with mci command for sound in vb5

4. please help with MCI control

5. Please help me with MCI Multimedia Control Error #322

6. mci help please

7. Please help with MCI control

8. Help with MCI please...

9. Guru Help Please - Special Export

10. Gurus, printing problem, help reqd, please!

11. Vb.net Guru help please!!!

12. Gurus - please help me creating a simple User class

 

 
Powered by phpBB® Forum Software