24 #include "../client/client.h"
53 if (dwReturn = mciSendCommand(
wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD_PTR)
NULL))
54 Com_DPrintf(
"MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn);
62 if (dwReturn = mciSendCommand(
wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD_PTR)
NULL))
63 Com_DPrintf(
"MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn);
70 MCI_STATUS_PARMS mciStatusParms;
75 mciStatusParms.dwItem = MCI_STATUS_READY;
76 dwReturn = mciSendCommand(
wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
79 Com_DPrintf(
"CDAudio: drive ready test - get status failed\n");
82 if (!mciStatusParms.dwReturn)
88 mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
89 dwReturn = mciSendCommand(
wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
92 Com_DPrintf(
"CDAudio: get tracks - status failed\n");
95 if (mciStatusParms.dwReturn < 1)
112 MCI_PLAY_PARMS mciPlayParms;
113 MCI_STATUS_PARMS mciStatusParms;
125 track =
remap[track];
134 mciStatusParms.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
135 mciStatusParms.dwTrack = track;
136 dwReturn = mciSendCommand(
wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
142 if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO)
144 Com_Printf(
"CDAudio: track %i is not audio\n", track);
149 mciStatusParms.dwItem = MCI_STATUS_LENGTH;
150 mciStatusParms.dwTrack = track;
151 dwReturn = mciSendCommand(
wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
165 mciPlayParms.dwFrom = MCI_MAKE_TMSF(track, 0, 0, 0);
166 mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | track;
167 mciPlayParms.dwCallback = (DWORD_PTR)
cl_hwnd;
168 dwReturn = mciSendCommand(
wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD_PTR)(LPVOID) &mciPlayParms);
171 Com_DPrintf(
"CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
204 if (dwReturn = mciSendCommand(
wDeviceID, MCI_STOP, 0, (DWORD_PTR)
NULL))
215 MCI_GENERIC_PARMS mciGenericParms;
223 mciGenericParms.dwCallback = (DWORD_PTR)
cl_hwnd;
224 if (dwReturn = mciSendCommand(
wDeviceID, MCI_PAUSE, 0, (DWORD_PTR)(LPVOID) &mciGenericParms))
235 MCI_PLAY_PARMS mciPlayParms;
246 mciPlayParms.dwFrom = MCI_MAKE_TMSF(
playTrack, 0, 0, 0);
247 mciPlayParms.dwTo = MCI_MAKE_TMSF(
playTrack + 1, 0, 0, 0);
248 mciPlayParms.dwCallback = (DWORD_PTR)
cl_hwnd;
249 dwReturn = mciSendCommand(
wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD_PTR)(LPVOID) &mciPlayParms);
252 Com_DPrintf(
"CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
289 for (n = 0; n < 100; n++)
300 for (n = 1; n < 100; n++)
305 for (n = 1; n <= ret; n++)
384 case MCI_NOTIFY_SUCCESSFUL:
400 case MCI_NOTIFY_ABORTED:
401 case MCI_NOTIFY_SUPERSEDED:
404 case MCI_NOTIFY_FAILURE:
411 Com_DPrintf(
"Unexpected MM_MCINOTIFY type (%i)\n", wParam);
440 MCI_OPEN_PARMS mciOpenParms;
441 MCI_SET_PARMS mciSetParms;
450 mciOpenParms.lpstrDeviceType =
"cdaudio";
451 if (dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD_PTR) (LPVOID) &mciOpenParms))
453 Com_Printf(
"CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn);
459 mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
460 if (dwReturn = mciSendCommand(
wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)(LPVOID) &mciSetParms))
462 Com_Printf(
"MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn);
467 for (n = 0; n < 100; n++)
492 if (mciSendCommand(
wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)
NULL))
493 Com_DPrintf(
"CDAudio_Shutdown: MCI_CLOSE failed\n");