|
|
|
@ -23,6 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
#include "quakedef.h"
|
|
|
|
|
#include "winquake.h"
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER < 1200)
|
|
|
|
|
#define DWORD_PTR DWORD
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
extern HWND mainwindow;
|
|
|
|
|
extern cvar_t bgmvolume;
|
|
|
|
|
|
|
|
|
@ -44,7 +48,8 @@ static void CDAudio_Eject(void)
|
|
|
|
|
{
|
|
|
|
|
DWORD dwReturn;
|
|
|
|
|
|
|
|
|
|
if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)))
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD_PTR)NULL);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
Con_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -53,7 +58,8 @@ static void CDAudio_CloseDoor(void)
|
|
|
|
|
{
|
|
|
|
|
DWORD dwReturn;
|
|
|
|
|
|
|
|
|
|
if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)))
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD_PTR)NULL);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
Con_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -67,7 +73,7 @@ static int CDAudio_GetAudioDiskInfo(void)
|
|
|
|
|
cdValid = false;
|
|
|
|
|
|
|
|
|
|
mciStatusParms.dwItem = MCI_STATUS_READY;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_DPrintf("CDAudio: drive ready test - get status failed\n");
|
|
|
|
@ -80,7 +86,7 @@ static int CDAudio_GetAudioDiskInfo(void)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_DPrintf("CDAudio: get tracks - status failed\n");
|
|
|
|
@ -140,7 +146,7 @@ void CDAudio_Play(int track, qboolean looping)
|
|
|
|
|
// don't try to play a non-audio track
|
|
|
|
|
mciStatusParms.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
|
|
|
|
|
mciStatusParms.dwTrack = track;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
|
|
|
|
@ -155,7 +161,7 @@ void CDAudio_Play(int track, qboolean looping)
|
|
|
|
|
// get the length of the track to be played
|
|
|
|
|
mciStatusParms.dwItem = MCI_STATUS_LENGTH;
|
|
|
|
|
mciStatusParms.dwTrack = track;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD) (LPVOID) &mciStatusParms);
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_DPrintf("MCI_STATUS failed (%i)\n", dwReturn);
|
|
|
|
@ -171,8 +177,8 @@ void CDAudio_Play(int track, qboolean looping)
|
|
|
|
|
|
|
|
|
|
mciPlayParms.dwFrom = MCI_MAKE_TMSF(track, 0, 0, 0);
|
|
|
|
|
mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | track;
|
|
|
|
|
mciPlayParms.dwCallback = (DWORD)mainwindow;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD)(LPVOID) &mciPlayParms);
|
|
|
|
|
mciPlayParms.dwCallback = (DWORD_PTR)mainwindow;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD_PTR)(LPVOID) &mciPlayParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
|
|
|
|
@ -200,7 +206,8 @@ void CDAudio_Stop(void)
|
|
|
|
|
if (!playing)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if ((dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD)NULL)))
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_STOP, 0, (DWORD_PTR)NULL);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
Con_DPrintf("MCI_STOP failed (%i)", dwReturn);
|
|
|
|
|
|
|
|
|
|
wasPlaying = false;
|
|
|
|
@ -219,8 +226,9 @@ void CDAudio_Pause(void)
|
|
|
|
|
if (!playing)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mciGenericParms.dwCallback = (DWORD)mainwindow;
|
|
|
|
|
if ((dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD)(LPVOID) &mciGenericParms)))
|
|
|
|
|
mciGenericParms.dwCallback = (DWORD_PTR)mainwindow;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_PAUSE, 0, (DWORD_PTR)(LPVOID) &mciGenericParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
Con_DPrintf("MCI_PAUSE failed (%i)", dwReturn);
|
|
|
|
|
|
|
|
|
|
wasPlaying = playing;
|
|
|
|
@ -247,8 +255,8 @@ void CDAudio_Resume(void)
|
|
|
|
|
|
|
|
|
|
mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0);
|
|
|
|
|
mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0);
|
|
|
|
|
mciPlayParms.dwCallback = (DWORD)mainwindow;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD)(LPVOID) &mciPlayParms);
|
|
|
|
|
mciPlayParms.dwCallback = (DWORD_PTR)mainwindow;
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD_PTR)(LPVOID) &mciPlayParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_DPrintf("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
|
|
|
|
@ -449,7 +457,8 @@ int CDAudio_Init(void)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
mciOpenParms.lpstrDeviceType = "cdaudio";
|
|
|
|
|
if ((dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD) (LPVOID) &mciOpenParms)))
|
|
|
|
|
dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, (DWORD_PTR) (LPVOID) &mciOpenParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_Printf("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn);
|
|
|
|
|
return -1;
|
|
|
|
@ -458,10 +467,11 @@ int CDAudio_Init(void)
|
|
|
|
|
|
|
|
|
|
// Set the time format to track/minute/second/frame (TMSF).
|
|
|
|
|
mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
|
|
|
|
|
if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID) &mciSetParms)))
|
|
|
|
|
dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)(LPVOID) &mciSetParms);
|
|
|
|
|
if (dwReturn)
|
|
|
|
|
{
|
|
|
|
|
Con_Printf("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn);
|
|
|
|
|
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD)NULL);
|
|
|
|
|
mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -490,6 +500,6 @@ void CDAudio_Shutdown(void)
|
|
|
|
|
if (!initialized)
|
|
|
|
|
return;
|
|
|
|
|
CDAudio_Stop();
|
|
|
|
|
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)NULL))
|
|
|
|
|
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)NULL))
|
|
|
|
|
Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
|
|
|
|
|
}
|
|
|
|
|