This is a simple wrapper class for controlling the MCI api functions. These functions control the multimedia devices on the system. This class simplifies the most useful of these functions to create a simple interface for playing and controlling audio files.
It will play any format of audio file that your system can. EG MP3, WAV, WMA.
Methods:
::Open()
Open a device and loads an audio file into it.
*file is the full path to the file to load.
::Close()
Closes the audio device, previously opened with ::Open.
::Play()
Starts playing the loaded audio file.
bWait specifies whether to wait for the audio file to finish playing before returning.
hWndNotify if not NULL specifies a window to send a MM_MCINOTIFY mesasge. The wParam contains the notification reason it can be one of the following MCI_NOTIFY_ABORTED; MCI_NOTIFY_FAILURE; MCI_NOTIFY_SUCCESSFUL; MCI_NOTIFY_SUPERSEDED. The lParam contains the device ID.
::Stop()
Stops the playing.
::Pause()
Pauses the playing.
::Resume()
Resumes the paused audio.
::Seek()
Seeks to a position in the current audio file. dwPos specifies the position in milliseconds to seek to.
::GetStatus()
Returns the current status mode of the MCI device.
::GetLength()
Returns the total length of the audio file in milliseconds. Or 0xffffffff on error.
::GetPos()
Returns the current postion of the audio file in milliseconds. Or 0xffffffff on error.
::GetFile()
Returns a pointer to the saved filename of the audio file. Or NULL on error.
::GetDeviceID()
Returns the current DeviceID of the mci device or 0 if no device is open.
Sample Usage:
Code:
#include "vMCI.h"
void main( void ) {
CvMCI mci;
mci.Open("mytrack.mp3");
mci.Play(1,0);
mci.Stop();
mci.Close();
}
void main( void ) {
CvMCI mci;
mci.Open("mytrack.mp3");
mci.Play(1,0);
mci.Stop();
mci.Close();
}
The above sample will load an mp3 file called mytrack.mp3 and play it.












