Advertisement

Midi loader/player

Started by December 15, 2000 12:01 PM
3 comments, last by Blue*Omega 24 years, 1 month ago
Can I get some sample source for a midi loader/player? just some real simple stuff plz! ----------------------------- Blue*Omega (Insert Witty Quote Here)
// Tojiart
What OS do you want it for? Dos, Linux, Windows, etc?

Also, do you want to use an API such as DirectMusic?
Advertisement
OpenAL. www.openal.org or something like that.

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
One simple method is through the WinAPI.

To make midis repeat in this header file, pass your main hWnd to PlayMidi, and when you receive an MM_MCINOTIFY message, and wParam == 1, then call PlayMidi again. I couldn''t be bothered to figure out how to automate it.
  // midi.hbool midiActive;UINT midiID;void __fastcall CloseMidi(void) {  DWORD l;  if(midiActive)mciSendCommand(midiID, MCI_CLOSE, MCI_WAIT, (DWORD) &l);  midiActive = false;}bool __fastcall LoadMidi(LPCSTR FileName) {  MCI_OPEN_PARMS Params;  CloseMidi;  Params.lpstrDeviceType = "sequencer";  Params.lpstrElementName = FileName;  if(mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD) &Params))	return false;  else {	midiID = Params.wDeviceID;	midiActive = true;	return true;  }}void __fastcall PlayMidi(HWND hWnd) {  MCI_PLAY_PARMS Params;  Params.dwCallback = (DWORD) hWnd;  if(midiActive) mciSendCommand(midiID, MCI_PLAY, MCI_NOTIFY, (DWORD) &Params);}void __fastcall StopMidi(void) {  DWORD l;  if(midiActive) mciSendCommand(midiID, MCI_STOP, 0, (DWORD) &l);}  
I''ll try hunter''s suggestion but for further refrence I want Windows VC++, API independant. Thanks!

-----------------------------

Blue*Omega

(Insert Witty Quote Here)
// Tojiart

This topic is closed to new replies.

Advertisement