From 5feb0454ca22f1414e9acba5b150f638b4fb252a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 11 Aug 2011 17:20:33 +0900 Subject: [PATCH] Add and use SYS_SND for both sound and cd debug prints. --- include/QF/sys.h | 1 + libs/audio/cd_linux.c | 26 +++++++++++++------------- libs/audio/cd_sdl.c | 10 +++++----- libs/audio/cd_sgi.c | 16 ++++++++-------- libs/audio/cd_win.c | 30 +++++++++++++++--------------- libs/audio/cd_xmms.c | 2 +- libs/audio/targets/snd_win.c | 2 +- 7 files changed, 44 insertions(+), 43 deletions(-) diff --git a/include/QF/sys.h b/include/QF/sys.h index 5b6d6389d..e4663c9cb 100644 --- a/include/QF/sys.h +++ b/include/QF/sys.h @@ -86,6 +86,7 @@ void Sys_MaskPrintf (int mask, const char *fmt, ...) __attribute__((format(print #define SYS_NET (1|64) #define SYS_RUA_OBJ (1|128) #define SYS_RUA_MSG (1|256) +#define SYS_SND (1|512) int Sys_CheckInput (int idle, int net_socket); const char *Sys_ConsoleInput (void); diff --git a/libs/audio/cd_linux.c b/libs/audio/cd_linux.c index aeae950fd..c6904d2c8 100644 --- a/libs/audio/cd_linux.c +++ b/libs/audio/cd_linux.c @@ -89,7 +89,7 @@ I_CDAudio_CloseDoor (void) return; // no cd init'd if (ioctl (cdfile, CDROMCLOSETRAY) == -1) - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromclosetray failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromclosetray failed\n"); } static void @@ -99,7 +99,7 @@ I_CDAudio_Eject (void) return; // no cd init'd if (ioctl (cdfile, CDROMEJECT) == -1) - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromeject failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromeject failed\n"); } static int @@ -110,12 +110,12 @@ I_CDAudio_GetAudioDiskInfo (void) cdValid = false; if (ioctl (cdfile, CDROMREADTOCHDR, &tochdr) == -1) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtochdr failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromreadtochdr failed\n"); return -1; } if (tochdr.cdth_trk0 < 1) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: no music tracks\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: no music tracks\n"); return -1; } @@ -135,7 +135,7 @@ I_CDAudio_Pause (void) return; if (ioctl (cdfile, CDROMPAUSE) == -1) - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdrompause failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdrompause failed\n"); wasPlaying = playing; playing = false; @@ -151,7 +151,7 @@ I_CDAudio_Stop (void) return; if (ioctl (cdfile, CDROMSTOP) == -1) - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromstop failed (%d)\n", + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromstop failed (%d)\n", errno); wasPlaying = false; @@ -189,7 +189,7 @@ I_CDAudio_Play (int track, qboolean looping) entry0.cdte_track = track; entry0.cdte_format = CDROM_MSF; if (ioctl (cdfile, CDROMREADTOCENTRY, &entry0) == -1) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtocentry failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromreadtocentry failed\n"); return; } entry1.cdte_track = track + 1; @@ -198,7 +198,7 @@ I_CDAudio_Play (int track, qboolean looping) entry1.cdte_track = CDROM_LEADOUT; } if (ioctl (cdfile, CDROMREADTOCENTRY, &entry1) == -1) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtocentry failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromreadtocentry failed\n"); return; } if (entry0.cdte_ctrl == CDROM_DATA_TRACK) { @@ -220,14 +220,14 @@ I_CDAudio_Play (int track, qboolean looping) msf.cdmsf_sec1 = entry1.cdte_addr.msf.second; msf.cdmsf_frame1 = entry1.cdte_addr.msf.frame; - Sys_MaskPrintf (SYS_DEV, "%2d:%02d:%02d %2d:%02d:%02d\n", + Sys_MaskPrintf (SYS_SND, "%2d:%02d:%02d %2d:%02d:%02d\n", msf.cdmsf_min0, msf.cdmsf_sec0, msf.cdmsf_frame0, msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1); if (ioctl (cdfile, CDROMPLAYMSF, &msf) == -1) { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromplaytrkind failed (%s)\n", strerror (errno)); return; @@ -254,7 +254,7 @@ I_CDAudio_Resume (void) return; if (ioctl (cdfile, CDROMRESUME) == -1) - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromresume failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromresume failed\n"); playing = true; } @@ -399,7 +399,7 @@ I_CDAudio_Update (void) lastchk = time (NULL) + 2; // two seconds between chks subchnl.cdsc_format = CDROM_MSF; if (ioctl (cdfile, CDROMSUBCHNL, &subchnl) == -1) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromsubchnl failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromsubchnl failed\n"); playing = false; return; } @@ -424,7 +424,7 @@ Mus_CDChange (cvar_t *mus_cdaudio) cdfile = open (mus_cdaudio->string, O_RDONLY | O_NONBLOCK); if (cdfile == -1) { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_SND, "Mus_CDInit: open device \"%s\" failed (error %i)\n", mus_cdaudio->string, errno); return; diff --git a/libs/audio/cd_sdl.c b/libs/audio/cd_sdl.c index e24e0cc3a..cd420d944 100644 --- a/libs/audio/cd_sdl.c +++ b/libs/audio/cd_sdl.c @@ -75,7 +75,7 @@ I_CDAudio_Eject (void) return; if (SDL_CDEject (cd_id)) - Sys_MaskPrintf (SYS_DEV, "Unable to eject CD-ROM tray.\n"); + Sys_MaskPrintf (SYS_SND, "Unable to eject CD-ROM tray.\n"); } static void @@ -87,7 +87,7 @@ I_CDAudio_Pause (void) return; if (SDL_CDPause (cd_id)) - Sys_MaskPrintf (SYS_DEV, "CDAudio_Pause: Failed to pause track.\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio_Pause: Failed to pause track.\n"); } static void @@ -102,7 +102,7 @@ I_CDAudio_Stop (void) return; if (SDL_CDStop (cd_id)) - Sys_MaskPrintf (SYS_DEV, "CDAudio_Stop: Failed to stop track.\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio_Stop: Failed to stop track.\n"); } static void @@ -135,7 +135,7 @@ I_CDAudio_Play (int track, qboolean looping) if (SDL_CDPlay (cd_id, cd_id->track[track].offset, cd_id->track[track].length)) { - Sys_MaskPrintf (SYS_DEV, "CDAudio_Play: Unable to play track: %d\n", + Sys_MaskPrintf (SYS_SND, "CDAudio_Play: Unable to play track: %d\n", track + 1); return; } @@ -151,7 +151,7 @@ I_CDAudio_Resume (void) return; if (SDL_CDResume (cd_id)) - Sys_MaskPrintf (SYS_DEV, "CDAudio_Resume: Failed tp resume track.\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio_Resume: Failed tp resume track.\n"); } static void diff --git a/libs/audio/cd_sgi.c b/libs/audio/cd_sgi.c index 9209dd563..ae88bc207 100644 --- a/libs/audio/cd_sgi.c +++ b/libs/audio/cd_sgi.c @@ -73,7 +73,7 @@ I_SGI_Eject (void) return; // no cd init'd if (CDeject (cdp) == 0) - Sys_MaskPrintf (SYS_DEV, "I_SGI_Eject: CDeject failed\n"); + Sys_MaskPrintf (SYS_SND, "I_SGI_Eject: CDeject failed\n"); } static int @@ -85,7 +85,7 @@ I_SGI_GetState (void) return -1; // no cd init'd if (CDgetstatus (cdp, &cds) == 0) { - Sys_MaskPrintf (SYS_DEV, "CDAudio_GetStatus: CDgetstatus failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio_GetStatus: CDgetstatus failed\n"); return -1; } @@ -101,7 +101,7 @@ I_SGI_MaxTrack (void) return -1; // no cd init'd if (CDgetstatus (cdp, &cds) == 0) { - Sys_MaskPrintf (SYS_DEV, "I_SGI_MaxTrack: CDgetstatus failed\n"); + Sys_MaskPrintf (SYS_SND, "I_SGI_MaxTrack: CDgetstatus failed\n"); return -1; } @@ -115,7 +115,7 @@ I_SGI_Pause (void) return; if (CDtogglepause (cdp) == 0) - Sys_MaskPrintf (SYS_DEV, "CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno); + Sys_MaskPrintf (SYS_SND, "CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno); } void @@ -133,7 +133,7 @@ I_SGI_Play (int track, qboolean looping) } if (maxtrack < 0) { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_SND, "CDAudio_Play: Error getting maximum track number\n"); return; } @@ -173,7 +173,7 @@ I_SGI_Play (int track, qboolean looping) } if (CDplaytrack (cdp, track, cdvolume == 0.0 ? 0 : 1) == 0) { - Sys_MaskPrintf (SYS_DEV, "CDAudio_Play: CDplay failed (%d)\n", errno); + Sys_MaskPrintf (SYS_SND, "CDAudio_Play: CDplay failed (%d)\n", errno); return; } @@ -188,7 +188,7 @@ I_SGI_Resume (void) return; if (CDtogglepause (cdp) == 0) - Sys_MaskPrintf (SYS_DEV, "CDAudio_Resume: CDtogglepause failed (%d)\n", + Sys_MaskPrintf (SYS_SND, "CDAudio_Resume: CDtogglepause failed (%d)\n", errno); } @@ -211,7 +211,7 @@ I_SGI_Stop (void) return; if (CDstop (cdp) == 0) - Sys_MaskPrintf (SYS_DEV, "I_SGI_Stop: CDStop failed (%d)\n", errno); + Sys_MaskPrintf (SYS_SND, "I_SGI_Stop: CDStop failed (%d)\n", errno); } void diff --git a/libs/audio/cd_win.c b/libs/audio/cd_win.c index c1bfd0a36..b222d8b91 100644 --- a/libs/audio/cd_win.c +++ b/libs/audio/cd_win.c @@ -77,7 +77,7 @@ I_CDAudio_CloseDoor (void) dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD_PTR) NULL); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "MCI_SET_DOOR_CLOSED failed (%li)\n", + Sys_MaskPrintf (SYS_SND, "MCI_SET_DOOR_CLOSED failed (%li)\n", dwReturn); } } @@ -90,7 +90,7 @@ I_CDAudio_Eject (void) dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD_PTR) NULL); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_SND, "MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn); } } @@ -107,12 +107,12 @@ I_CDAudio_GetAudioDiskInfo (void) mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_SND, "CDAudio: drive ready test - get status failed\n"); return -1; } if (!mciStatusParms.dwReturn) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: drive not ready\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: drive not ready\n"); return -1; } @@ -121,11 +121,11 @@ I_CDAudio_GetAudioDiskInfo (void) mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: get tracks - status failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: get tracks - status failed\n"); return -1; } if (mciStatusParms.dwReturn < 1) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: no music tracks\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio: no music tracks\n"); return -1; } @@ -156,13 +156,13 @@ static I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa break; case MCI_NOTIFY_FAILURE: - Sys_MaskPrintf (SYS_DEV, "MCI_NOTIFY_FAILURE\n"); + Sys_MaskPrintf (SYS_SND, "MCI_NOTIFY_FAILURE\n"); I_CDAudio_Stop (); cdValid = false; break; default: - Sys_MaskPrintf (SYS_DEV, "Unexpected MM_MCINOTIFY type (%i)\n", + Sys_MaskPrintf (SYS_SND, "Unexpected MM_MCINOTIFY type (%i)\n", wParam); return 1; } @@ -187,7 +187,7 @@ I_CDAudio_Pause (void) mciSendCommand (wDeviceID, MCI_PAUSE, 0, (DWORD_PTR) (LPVOID) & mciGenericParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "MCI_PAUSE failed (%li)", dwReturn); + Sys_MaskPrintf (SYS_SND, "MCI_PAUSE failed (%li)", dwReturn); } wasPlaying = playing; @@ -228,7 +228,7 @@ I_CDAudio_Play (int track, qboolean looping) MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "MCI_STATUS failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_SND, "MCI_STATUS failed (%li)\n", dwReturn); return; } if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) { @@ -243,7 +243,7 @@ I_CDAudio_Play (int track, qboolean looping) MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "MCI_STATUS failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_SND, "MCI_STATUS failed (%li)\n", dwReturn); return; } @@ -260,7 +260,7 @@ I_CDAudio_Play (int track, qboolean looping) mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD_PTR) (LPVOID) & mciPlayParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_SND, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn); return; } @@ -292,7 +292,7 @@ I_CDAudio_Resume (void) mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD_PTR) (LPVOID) & mciPlayParms); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_SND, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn); return; } playing = true; @@ -305,7 +305,7 @@ I_CDAudio_Shutdown (void) return; I_CDAudio_Stop (); if (mciSendCommand (wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR) NULL)) - Sys_MaskPrintf (SYS_DEV, "CDAudio_Shutdown: MCI_CLOSE failed\n"); + Sys_MaskPrintf (SYS_SND, "CDAudio_Shutdown: MCI_CLOSE failed\n"); } static void @@ -320,7 +320,7 @@ I_CDAudio_Stop (void) dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD_PTR) NULL); if (dwReturn) { - Sys_MaskPrintf (SYS_DEV, "MCI_STOP failed (%li)", dwReturn); + Sys_MaskPrintf (SYS_SND, "MCI_STOP failed (%li)", dwReturn); } wasPlaying = false; diff --git a/libs/audio/cd_xmms.c b/libs/audio/cd_xmms.c index c9ed2126f..774ba5962 100644 --- a/libs/audio/cd_xmms.c +++ b/libs/audio/cd_xmms.c @@ -152,7 +152,7 @@ I_XMMS_Running (void) break; case -1: // ICH! // inform user - Sys_MaskPrintf (SYS_DEV, "XMMSAudio: error, can't fork!?\n"); + Sys_MaskPrintf (SYS_SND, "XMMSAudio: error, can't fork!?\n"); break; default: // Parent // don't need now :/ diff --git a/libs/audio/targets/snd_win.c b/libs/audio/targets/snd_win.c index 80d5beb04..df46dcab5 100644 --- a/libs/audio/targets/snd_win.c +++ b/libs/audio/targets/snd_win.c @@ -316,7 +316,7 @@ SNDDMA_Submit (void) // find which sound blocks have completed while (1) { if (snd_completed == snd_sent) { - Sys_MaskPrintf (SYS_DEV, "Sound overrun\n"); + Sys_MaskPrintf (SYS_SND, "Sound overrun\n"); break; }