Jump to content
  • Advertisement

Archived

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

baddrizz

load a midi from resource using MCI??

This topic is 5988 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!