I am using Delphi 4. I have multiple WAV files in a resource file and I want to play different combinations of them consecutively, e.g. click a button and play WAV 6, then WAV 2, then WAV 9.
I am using the following code but when I click the Testsound button it will only play the last WAV file.
Can someone help?
procedure TForm1.myPlaySound(mysound: pchar);
var
hFind, hRes: THandle;
SpokenDate: PChar;
begin
hFind := FindResource(HInstance, mysound, 'WAVE') ;
if hFind <> 0 then begin
hRes:=LoadResource(HInstance, hFind) ;
if hRes <> 0 then begin
SpokenDate:=LockResource(hRes) ;
if Assigned(SpokenDate) then SndPlaySound(SpokenDate, snd_ASync or snd_Memory) ;
UnlockResource(hRes) ;
end;
FreeResource(hFind) ;
end;
end;
procedure TForm1.TestsoundClick(Sender: TObject);
begin
myPlaySound('w01o');
myPlaySound('w07Lip');
myPlaySound('w07o');
end;