DelphiX - How to tell if a WAV is already playing.
I can''t find this anywhere, I''m sure it''s simple.
How do I tell if a WAV in my wavimagelist is already playing?
I want to stop my program from replaying a sound effect if it''s already playing.
Thanks.
Matt
Hmm, I remember addressing this question about a year ago. But with the search feature down I cant easily copy & paste the code I wrote that implmented the feature.
Basicly that feature is missing from sound library that comes with (Un)DelphiX.
I''ll post it latter when I find it.
Basicly that feature is missing from sound library that comes with (Un)DelphiX.
I''ll post it latter when I find it.
Couldnt find the article on the forums, so I managed to dig up a copy that was storied my my harddrive.
Enjoy!
[edited by - ggs on October 3, 2002 10:03:00 AM]
Enjoy!
Back up your existing copy of DXsounds.pas to something like ~DXsounds.pas. In DXSounds.pas, Make the following changes:Line 381 (in the TWaveCollectionItem class) Add:******* Protected Function GetPlaying : boolean; public Property Playing : boolean read GetPlaying;*******At line 2230 Add:*******Function TWaveCollectionItem.GetPlaying : boolean;var Buffer : TDirectSoundBuffer; index : integer;beginResult := false;if not FInitialized then Exit;assert(GetBuffer <> nil);assert(FBufferList <> nil);if FLooped then begin Buffer := GetBuffer; assert(Buffer <> nil); result := Buffer.Playing; endelse begin for index := 0 to FBufferList.Count - 1 do begin result := TDirectSoundBuffer(FBufferList[index]).Playing; if result then Break; end; end;end; {GetPlaying}*******
[edited by - ggs on October 3, 2002 10:03:00 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement