diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f744fc9c7..c5e651e93 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20130422 -------- main/net_udp.c: In restricted game mode check for player callsign and sockaddr at the same time; Clear Netgame struct each time player enters a new IP in manual join menu +arch/sdl/rbaudio.c: Added a lot of status messages for RBA code shown with -verbose, hopefully making it easier for users to track down problems and made all RBA messages start with RBAudio prefix 20130418 -------- diff --git a/arch/sdl/rbaudio.c b/arch/sdl/rbaudio.c index 42e89fe77..03dcaa158 100644 --- a/arch/sdl/rbaudio.c +++ b/arch/sdl/rbaudio.c @@ -45,14 +45,14 @@ void RBAInit() if (SDL_Init(SDL_INIT_CDROM) < 0) { - Warning("SDL library initialisation failed: %s.",SDL_GetError()); + Warning("RBAudio: SDL library initialisation failed: %s.",SDL_GetError()); return; } num_cds = SDL_CDNumDrives(); if (num_cds < 1) { - con_printf(CON_NORMAL, "No cdrom drives found!\n"); + con_printf(CON_NORMAL, "RBAudio: No cdrom drives found!\n"); #if defined(__APPLE__) || defined(macintosh) SDL_QuitSubSystem(SDL_INIT_CDROM); // necessary for rescanning CDROMs #endif @@ -77,12 +77,12 @@ void RBAInit() break; // we've found an audio CD } else if (s_cd == NULL) - Warning("Could not open cdrom %i for redbook audio:%s\n", i, SDL_GetError()); + Warning("RBAudio: Could not open cdrom %i for redbook audio:%s\n", i, SDL_GetError()); } if (i == num_cds) { - con_printf(CON_NORMAL, "No audio CDs found\n"); + con_printf(CON_NORMAL, "RBAudio: No audio CDs found\n"); if (s_cd) // if there's no audio CD, say that there's no redbook and hence play MIDI instead { SDL_CDClose(s_cd); @@ -95,6 +95,8 @@ void RBAInit() } initialised = 1; + + RBAList(); } int RBAEnabled() @@ -108,7 +110,10 @@ int RBAPlayTrack(int a) if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) { if (SDL_CDPlayTracks(s_cd, a-1, 0, 0, 0) == 0) + { + con_printf(CON_VERBOSE, "RBAudio: Playing track %i\n", a); return a; + } } return -1; } @@ -120,6 +125,7 @@ void RBAStop() if (!s_cd) return; SDL_CDStop(s_cd); redbook_finished_hook = NULL; // no calling the finished hook - stopped means stopped here + con_printf(CON_VERBOSE, "RBAudio: Playback stopped\n"); } void RBAEjectDisk() @@ -144,7 +150,7 @@ void RBASetVolume(int volume) level = volume*REDBOOK_VOLUME_SCALE/8; if ((level<0) || (level>REDBOOK_VOLUME_SCALE)) { - con_printf(CON_CRITICAL, "illegal volume value (allowed values 0-%i)\n",REDBOOK_VOLUME_SCALE); + con_printf(CON_CRITICAL, "RBAudio: illegal volume value (allowed values 0-%i)\n",REDBOOK_VOLUME_SCALE); return; } @@ -154,7 +160,7 @@ void RBASetVolume(int volume) = volctrl.channel3 = level; if ( ioctl(cdfile, CDROMVOLCTRL, &volctrl) == -1 ) { - con_printf(CON_CRITICAL, "CDROMVOLCTRL ioctl failed\n"); + con_printf(CON_CRITICAL, "RBAudio: CDROMVOLCTRL ioctl failed\n"); return; } #endif @@ -164,12 +170,14 @@ void RBAPause() { if (!s_cd) return; SDL_CDPause(s_cd); + con_printf(CON_VERBOSE, "RBAudio: Playback paused\n"); } int RBAResume() { if (!s_cd) return -1; SDL_CDResume(s_cd); + con_printf(CON_VERBOSE, "RBAudio: Playback resumed\n"); return 1; } @@ -178,9 +186,15 @@ int RBAPauseResume() if (!s_cd) return 0; if (SDL_CDStatus(s_cd) == CD_PLAYING) + { SDL_CDPause(s_cd); + con_printf(CON_VERBOSE, "RBAudio: Toggle Playback pause\n"); + } else if (SDL_CDStatus(s_cd) == CD_PAUSED) + { SDL_CDResume(s_cd); + con_printf(CON_VERBOSE, "RBAudio: Toggle Playback resume\n"); + } else return 0; @@ -191,6 +205,7 @@ int RBAGetNumberOfTracks() { if (!s_cd) return -1; SDL_CDStatus(s_cd); + con_printf(CON_VERBOSE, "RBAudio: Found %i tracks on CD\n", s_cd->numtracks); return s_cd->numtracks; } @@ -206,7 +221,10 @@ void RBACheckFinishedHook() if ((timer_query() - last_check_time) >= F2_0) { if ((SDL_CDStatus(s_cd) == CD_STOPPED) && redbook_finished_hook) + { + con_printf(CON_VERBOSE, "RBAudio: Playback done, calling finished-hook\n"); redbook_finished_hook(); + } last_check_time = timer_query(); } } @@ -220,6 +238,7 @@ int RBAPlayTracks(int first, int last, void (*hook_finished)(void)) if (CD_INDRIVE(SDL_CDStatus(s_cd))) { redbook_finished_hook = hook_finished; + con_printf(CON_VERBOSE, "RBAudio: Playing tracks %i to %i\n", first, last); return SDL_CDPlayTracks(s_cd, first - 1, 0, last - first + 1, 0) == 0; } return 0; @@ -298,5 +317,5 @@ void RBAList(void) return; for (i = 0; i < s_cd->numtracks; i++) - con_printf(CON_DEBUG, "CD track %d, type %s, length %d, offset %d", s_cd->track[i].id, (s_cd->track[i].type == SDL_AUDIO_TRACK) ? "audio" : "data", s_cd->track[i].length, s_cd->track[i].offset); + con_printf(CON_VERBOSE, "RBAudio: CD track %d, type %s, length %d, offset %d", s_cd->track[i].id, (s_cd->track[i].type == SDL_AUDIO_TRACK) ? "audio" : "data", s_cd->track[i].length, s_cd->track[i].offset); }