• Advertisement

Archived

This topic is now archived and is closed to further replies.

load a midi from resource using MCI??

This topic is 5904 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites

  • Advertisement