dxfoo
July 22nd, 2006, 02:24 AM
I can play a midi and mp3 at the same time (MIDI and MP3 classes), but trying to play two midis at once right now isn't working at all. My class is below, so I hope it's not so drastic to change some code around. Please let me know on what to do. Thanks.
class MP3
{
private:
std::string filename;
public:
MP3()
{
}
~MP3()
{
std::string msg = "close " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Init(std::string filename)
{
this->filename = filename;
std::string msg = "open \"" + filename + "\" type mpegvideo alias " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Play()
{
std::string msg = "play " + filename + " from 0";
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Stop()
{
std::string msg = "stop " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Pause()
{
std::string msg = "pause " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Resume()
{
std::string msg = "resume " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
};
class MP3
{
private:
std::string filename;
public:
MP3()
{
}
~MP3()
{
std::string msg = "close " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Init(std::string filename)
{
this->filename = filename;
std::string msg = "open \"" + filename + "\" type mpegvideo alias " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Play()
{
std::string msg = "play " + filename + " from 0";
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Stop()
{
std::string msg = "stop " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Pause()
{
std::string msg = "pause " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
void Resume()
{
std::string msg = "resume " + filename;
mciSendString(msg.c_str(), NULL, 0, 0);
}
};