🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #688

Re: PlaySound from memory is misbehaving

#688
From: Prof. Chuck Kelly
Date: Wed, 23 Apr 2003 21:14
66 lines
3333 bytes
I'm not trying to play the sounds simultaneously. I want to play them sequentially. According to the documentation on PlaySound the following code should return 'false' if a sound is currently being played but it should not stop the current sound.

   result = PlaySound(wavemem[waveIndex], NULL,
                          SND_ASYNC | SND_NOSTOP | 


"Marcelo R. Lopez, Jr." <marcelol@directvinternet.com> wrote:
>Chuck,
>
>What leads you to believe that your target audio device can have more than
>one MCI audio instance open at a time. Remember, DirectX's sound interface
>is NOT like the MCI ( which is what PlaySound() uses ). You can only have
>more than one audio instance open, IFF your device supports it ( many do
>not ). If you need this sort of functionality, look around on the web, I
>think there are a couple of ( at least semi ) freeware VCL's that will allow
>you to open a DirectX sound device and play multiple streams.
>
>Marcelo R. Lopez, Jr.
>
>"Professor Chuck Kelly" <ckelly@monroeccc.edu> wrote in message
>news:3e823943$1@newsgroups.borland.com...
>>
>> I am attempting to play several wav files from memory using PlaySound.
>Usually the first time I attempt to play the sounds I only hear the last
>sound. On some computers there is a random delay between playing each sound.
>Sometimes only the last sound plays.
>>
>> I am using the following function to play the sounds:
>>
>> void __fastcall TForm1::playSoundMemAsync(int waveIndex, bool &result)
>> {
>>   result = PlaySound(wavemem[waveIndex], NULL,
>>                          SND_ASYNC | SND_NOSTOP | SND_MEMORY);
>> }
>>
>> The function is called as follows:
>>
>> // attempt to play all 4 sounds asynchronously
>> void __fastcall TForm1::PlayAsyncClick(TObject *Sender)
>> {
>>   bool status;
>>
>>   playSoundMemAsync(0, status);
>>   do{
>>     playSoundMemAsync(1, status);
>>   }while(status == false);
>>   do{
>>     playSoundMemAsync(2, status);
>>   }while(status == false);
>>   do{
>>     playSoundMemAsync(3, status);
>>   }while(status == false);
>>
>> }
>>
>> A complete program using the above functions is available at
>http://www.monroeccc.edu/ckelly/Files/SoundTest.zip
>>
>> Any suggestions would be appreciated.
>>
>> Prof. Chuck Kelly
>> Monroe County Community College
>>
>
>
Technical Details
Message-ID: <3ea70237$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e823943$1@newsgroups.borland.com> <3e9c26b1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d0fc,e1c9dfc4b76a1dde
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2003-04-23 14:28:01 PST
From: "Prof. Chuck Kelly" <ckelly@monroeccc.edu>
Sender: "Prof. Chuck Kelly" <ckelly@monroeccc.edu>
Reply-To: "Prof. Chuck Kelly" <ckelly@monroeccc.edu>
Subject: Re: PlaySound from memory is misbehaving
Newsgroups: borland.public.cppbuilder.multimedia
X-User-Info: 24.247.198.9 24.247.198.9    
References: <3e823943$1@newsgroups.borland.com> <3e9c26b1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3ea70237$1@newsgroups.borland.com>
Date: 23 Apr 2003 14:14:31 -0700
X-Trace: newsgroups.borland.com 1051132471 207.105.83.65 (23 Apr 2003 14:14:31 -0700)
Lines: 67
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail