load a midi from resource using MCI??

Started by
0 comments, last by baddrizz 22 years, 1 month ago
can anybody tell me how to load a midi from a resouce using MCI i''v tried some different ways but they haven''t worked and i''m out of idea''s thx for any help
Advertisement
  MCIDEVICEID gDeviceID = -1;int         Playing = 0;void PlayMidi(char *FileName){  MCI_OPEN_PARMS    OpenStructure;  MCI_PLAY_PARMS    PlayStructure;  if (gDeviceID != -1) {    mciSendCommand (gDeviceID, MCI_STOP, 0, 0);    mciSendCommand (gDeviceID, MCI_CLOSE, 0, 0);    gDeviceID = -1;  }  OpenStructure.lpstrDeviceType = "sequencer";  OpenStructure.lpstrElementName = FileName;  mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&OpenStructure);  gDeviceID = OpenStructure.wDeviceID;  Playing = -1;  PlayStructure.dwCallback = (DWORD)hwnd;  mciSendCommand (gDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&PlayStructure);}void StopMidi(){  if (gDeviceID != -1) {    mciSendCommand (gDeviceID, MCI_STOP, 0, 0);    mciSendCommand (gDeviceID, MCI_CLOSE, 0, 0);    gDeviceID = -1;    Playing = 0;  }}void UnloadMidi(){  if (gDeviceID != -1) {    mciSendCommand (gDeviceID, MCI_STOP, 0, 0);    mciSendCommand (gDeviceID, MCI_CLOSE, 0, 0);  }}void PauseMidi(){	mciSendCommand(gDeviceID, MCI_PAUSE, 0, 0);}void ResumeMidi(){	mciSendCommand(gDeviceID, MCI_RESUME, 0, 0);}  


There, I think that''s about all you need. And check for system messages that start with MM_MCI... for things related to that (i.e. midi has stopped playing, etc.)

This topic is closed to new replies.

Advertisement