Hello,
I have the following to play an embedded resource and I'm on the Windows platform:
procedure PlayGetReady;
var
Stream: TResourceStream;
begin
Stream := TResourceStream.Create(HInstance, 'GETREADY', RT_RCDATA);
try
Stream.Position := 0;
SndPlaySound(Stream.Memory, SND_MEMORY);
finally
Stream.Free;
end;
end;
And I have a getready.wav file added to my project resources. This all works, however when I go to use the code:
setlabel('GetReady','GET READY!',110,6); // Display "GET READY...."
PlayGetReady; // play sound file
SetLabel displays "GET READY" on the screen and I need the sound file to play at the same time that is being displayed... however even in this order, the sound file plays before "GET READY" displays for some reason.
I'm trying to embed all needed resources and have the sounds loaded in memory so that they play quickly when needed. I tested with this:
PlaySound('C:\path\to\wav\file\in\some\folder\getready.wav',0,SND_ASYNC);
And using delays I can get it to play just at the proper time but it seems like there would be an easier way and I really don't want to have to include the wav files separately and worry about paths etc.
Again I'm on Windows and no need to do x-platform.
Thanks
Rich