🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

PlaySound from memory is misbehaving

#660
From: Professor Chuck Kelly
Date: Wed, 26 Mar 2003 23:35
37 lines
2057 bytes
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: <3e823943$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d0fc,e1c9dfc4b76a1dde,start
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2003-03-26 15:39:20 PST
From: "Professor Chuck Kelly" <ckelly@monroeccc.edu>
Sender: "Professor Chuck Kelly" <ckelly@monroeccc.edu>
Reply-To: "Professor Chuck Kelly" <ckelly@monroeccc.edu>
Subject: PlaySound from memory is misbehaving
Newsgroups: borland.public.cppbuilder.multimedia
X-User-Info: 198.108.21.3 198.108.21.3    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3e823943$1@newsgroups.borland.com>
Date: 26 Mar 2003 15:35:31 -0800
X-Trace: newsgroups.borland.com 1048721731 207.105.83.65 (26 Mar 2003 15:35:31 -0800)
Lines: 38
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail