Thread View: borland.public.cppbuilder.multimedia
3 messages
3 total messages
Started by Greg Caughill
Sat, 01 Dec 2001 03:50
playing midi files
Author: Greg Caughill
Date: Sat, 01 Dec 2001 03:50
Date: Sat, 01 Dec 2001 03:50
6 lines
937 bytes
937 bytes
Hi, How can I play midi files in builder, I don't know much about sound related functions. Thanks
Re: playing midi files
Author: Ted Lyngmo
Date: Sat, 01 Dec 2001 15:43
Date: Sat, 01 Dec 2001 15:43
11 lines
1173 bytes
1173 bytes
Greg Caughill wrote: > > Hi, > > How can I play midi files in builder, I don't know much about sound related > functions. Use the TMediaPlayer component. You'll find it under the System tab. Kind regards, Ted Lyngmo
Re: playing midi files
Author: PaoloItaly
Date: Mon, 03 Dec 2001 11:15
Date: Mon, 03 Dec 2001 11:15
80 lines
3378 bytes
3378 bytes
void stopMIDIFile(UINT wDeviceID)
{
::mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
}
DWORD playMIDIFile(HWND hWndNotify, LPSTR lpszMIDIFileName, UINT *wDeviceID)
{
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms;
MCI_STATUS_PARMS mciStatusParms;
MCI_SEQ_SET_PARMS mciSeqSetParms;
// Open the device by specifying the device and filename.
// MCI will attempt to choose the MIDI mapper as the output port.
mciOpenParms.lpstrDeviceType = "sequencer";
mciOpenParms.lpstrElementName = lpszMIDIFileName;
if (dwReturn = ::mciSendCommand(NULL, MCI_OPEN,
MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
(DWORD)(LPVOID) &mciOpenParms))
{
// Failed to open device. Don't close it; just return error.
return (dwReturn);
}
// The device opened successfully; get the device ID.
*wDeviceID = mciOpenParms.wDeviceID;
// Check if the output port is the MIDI mapper.
mciStatusParms.dwItem = MCI_SEQ_STATUS_PORT;
if (dwReturn = ::mciSendCommand(*wDeviceID, MCI_STATUS,
MCI_STATUS_ITEM, (DWORD)(LPVOID) &mciStatusParms))
{
::mciSendCommand(*wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
// The output port is not the MIDI mapper.
// Ask if the user wants to continue.
/* if (LOWORD(mciStatusParms.dwReturn) != MIDI_MAPPER)
{
if (::MessageBox(hWndNotify,
"The MIDI mapper is not available. Continue?",
"", MB_YESNO) == IDNO)
{
// User does not want to continue. Not an error;
// just close the device and return.
::mciSendCommand(*wDeviceID, MCI_CLOSE, 0, NULL);
return (0L);
}
}*/
// Begin playback. The window procedure function for the parent
// window will be notified with an MM_MCINOTIFY message when
// playback is complete. At this time, the window procedure closes
// the device.
mciPlayParms.dwCallback = (DWORD) hWndNotify;
if (dwReturn = ::mciSendCommand(*wDeviceID, MCI_PLAY, MCI_NOTIFY,
(DWORD)(LPVOID) &mciPlayParms))
{
::mciSendCommand(*wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
return (0L);
}
Ciao
"Greg Caughill" <gcaughil@sentex.net> ha scritto nel messaggio
news:3c0852b0_1@dnews...
> Hi,
>
> How can I play midi files in builder, I don't know much about sound
related
> functions.
>
> Thanks
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads