Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to put a *.mid in my game but... Mediaplayer!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
MediaPlayer doen't appear to have an 'auto-repeat' propriety, how can i do if i want to put an auto-repeat .mid song in a program??? (Sorry for my poor english guy :p)
 
Or, you can set up an OnNotify event. Set Notify to True, and use some code like this:
Code:
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
    MediaPlayer1.FileName := 'MyMidiFile.mid';
    MediaPlayer1.Open;
    MediaPlayer1.Notify := True;
    MediaPlayer1.Wait := False;
    MediaPlayer1.Play;
end;
When the MediaPlayer gets to the end of the media (in this case, the end of your Midi), a Notify event occurs, and this procedure gets called. The procedure then sets Notify back to True, and starts the Midi playing again.
 
OnNotify appear to occurs when the midi get started to... how can i do if i just want my OnNotifyEvent to be execute only when it's called by , for exemple, Rewind or Stop
 
OnNotify appear to occurs when the midi get started to... how can i do if i just want my OnNotifyEvent to be execute only when it's called by , for exemple, Rewind or Stop?

However, Thankx for the clue but i was already trying to do it with OnNotify ;(
 
In your NotifyEvent check that MediaPlayer.Mode isn't mpPlaying before attempting to restart playback.
 
Great!!!!
Thank you mikeEd! :)
I check out if MediaPlayer.Mode is mpStopped and it's working! But... I wonder why Borland did not put an Auto-Repeat propriety in the MediaPlayer :p But now i can continue my game... thank you all :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top