Link to home
Start Free TrialLog in
Avatar of mmarvi
mmarvi

asked on

How to play MIDI files

I want to know how I can play a MIDI file in a Delphi 2.0 program using the Win32 MCI library. I know how to do it in Visual C++, but not in Delphi. Please include some code samples that clearly illustrate how to load and play a MIDI file, as well as send a notification to the form to restart the MIDI when it is done.
Avatar of inthe
inthe


use the TMediaPlayer component
select file and set autoopen to true
and to loop it do the following on the notify event:

procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
 with MediaPlayer1 do
  if NotifyValue = nvSuccessful then begin
   Notify := True;
  Play;
 end;
end;
Avatar of mmarvi

ASKER

dear inthe:

I don't like your answer because I asked for information on how to use the Win32 MCI library to load and play a MIDI file. Please post an answer to that question and I'll be glad to give you points.
Hello mmarvi
sorry
i can give you code for mci library playsound procedure
but it is for loading and playing wav files not midi
Im still looking for midi but everything i find is for wav :-(
im not sure how to do playsound procedure for midi files it may be the same but maybe not
hello again  
this page may be of more help to you

http://www.compguy.com/cwtip05.htm
system.ini will hold the midi sequencer
on my system it's sequencer=mciseq.drv
so something like this is what your after i think

open sequencer!yoursong.mid alias anthem
play anthem
pause anthem
resume anthem
stop anthem
seek anthem to start
play anthem
stop anthem
close anthem
ASKER CERTIFIED SOLUTION
Avatar of tothpaul
tothpaul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial