Thanks, makes sense but this is not working as it should.
procedure TspellWin.PlayWAVfile(soundfilename:ansistring; flags:integer);
begin
SpeakBtn.onclick:=nil;
soundplayer.SoundFile:=soundfilename;
soundplayer.PlayStyle:=psSync; // use flags ###
soundplayer.Execute;
Application.messagebox(Pchar(soundfilename ),'play sound returned.',mb_OK);
SpeakBtn.onclick:=@menuCardSpeakClick;
end;
The sound sample is about one second long.
With the messagebox() call it looks good.
The msg pops up AFTER the sound has played. If I rapidly click twice I only get one sound then the msg.
That is the required functionality.
Without the messagebox() call it misbehaves.
if I rapidly click twice, I get two sound plays.
This does not seem consistent to me, so I must be missing something.