diff options
author | Filippos Karapetis | 2009-05-30 17:53:12 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-05-30 17:53:12 +0000 |
commit | 15d5b8436e768674aeb2564d6f379e906fb0898c (patch) | |
tree | f382cdc13b652420c717aeb710c8da7534dedc47 /engines/sci/sfx | |
parent | 2f90c8f398bf41ee571d31ce08dbf46d524cc592 (diff) | |
download | scummvm-rg350-15d5b8436e768674aeb2564d6f379e906fb0898c.tar.gz scummvm-rg350-15d5b8436e768674aeb2564d6f379e906fb0898c.tar.bz2 scummvm-rg350-15d5b8436e768674aeb2564d6f379e906fb0898c.zip |
Removed the "sfx_debuglog" command. Sound debug messages are now shown if kDebugLevelSound is specified
svn-id: r41039
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r-- | engines/sci/sfx/core.cpp | 73 | ||||
-rw-r--r-- | engines/sci/sfx/core.h | 6 |
2 files changed, 33 insertions, 46 deletions
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 549a337a64..96ad6fa34a 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -26,6 +26,7 @@ /* Sound subsystem core: Event handler, sound player dispatching */ #include "sci/tools.h" +#include "sci/sci.h" #include "sci/sfx/core.h" #include "sci/sfx/iterator.h" #include "sci/sfx/misc.h" @@ -486,20 +487,25 @@ void SfxState::updateSingleSong() { setSongStatus(newsong, SOUND_STATUS_WAITING); } - if (_debug & SFX_DEBUG_SONGS) { - sciprintf("[SFX] Changing active song:"); - if (!_song) - sciprintf(" New song:"); - else - sciprintf(" pausing %08lx, now playing", _song->handle); - - if (newsong) - sciprintf(" %08lx\n", newsong->handle); - else - sciprintf(" none\n"); + Common::String debugMessage = "[SFX] Changing active song:"; + if (!_song) { + debugMessage += " New song:"; + } else { + char tmp[50]; + sprintf(tmp, " pausing %08lx, now playing ", _song->handle); + debugMessage += tmp; } + if (newsong) { + char tmp[20]; + sprintf(tmp, "%08lx\n", newsong->handle); + debugMessage += tmp; + } else { + debugMessage += " none\n"; + } + debugC(2, kDebugLevelSound, debugMessage.c_str()); + _song = newsong; thawTime(); /* Recover song delay time */ @@ -565,9 +571,8 @@ void SfxState::updateMultiSong() { oldseeker = oldseeker->next_stopping) if (oldseeker->next_playing == ¬_playing_anymore) { setSongStatus(oldseeker, SOUND_STATUS_SUSPENDED); - if (_debug & SFX_DEBUG_SONGS) { - sciprintf("[SFX] Stopping song %lx\n", oldseeker->handle); - } + debugC(2, kDebugLevelSound, "[SFX] Stopping song %lx\n", oldseeker->handle); + if (player && oldseeker->it) player->iterator_message(SongIterator::Message(oldseeker->it->ID, SIMSG_STOP)); oldseeker->next_playing = NULL; /* Clear this pointer; we don't need the tag anymore */ @@ -575,8 +580,7 @@ void SfxState::updateMultiSong() { for (newseeker = newsong; newseeker; newseeker = newseeker->next_playing) { if (newseeker->status != SOUND_STATUS_PLAYING && player) { - if (_debug & SFX_DEBUG_SONGS) - sciprintf("[SFX] Adding song %lx\n", newseeker->it->ID); + debugC(2, kDebugLevelSound, "[SFX] Adding song %lx\n", newseeker->it->ID); SongIterator *clonesong = newseeker->it->clone(newseeker->_delay); player->add_iterator(clonesong, g_system->getMillis()); @@ -617,7 +621,6 @@ void SfxState::sfx_init(ResourceManager *resmgr, int flags) { song_lib_init(&_songlib); _song = NULL; _flags = flags; - _debug = 0; /* Disable all debugging by default */ _soundSync = NULL; _audioResource = NULL; @@ -644,7 +647,7 @@ void SfxState::sfx_init(ResourceManager *resmgr, int flags) { player = new SfxPlayer(); if (!player) { - sciprintf("[SFX] No song player found\n"); + warning("[SFX] No song player found"); return; } @@ -721,9 +724,7 @@ int SfxState::sfx_poll_specific(song_handle_t handle, int *cue) { if (!song) return 0; /* Song not playing */ - if (_debug & SFX_DEBUG_CUES) { - fprintf(stderr, "[SFX:CUE] Polled song %08lx ", handle); - } + debugC(2, kDebugLevelSound, "[SFX:CUE] Polled song %08lx ", handle); while (1) { if (song->_wakeupTime.frameDiff(ctime) > 0) @@ -741,19 +742,14 @@ int SfxState::sfx_poll_specific(song_handle_t handle, int *cue) { case SI_LOOP: case SI_RELATIVE_CUE: case SI_ABSOLUTE_CUE: - if (_debug & SFX_DEBUG_CUES) { - sciprintf(" => "); - - if (result == SI_FINISHED) - sciprintf("finished\n"); - else { - if (result == SI_LOOP) - sciprintf("Loop: "); - else - sciprintf("Cue: "); - - sciprintf("%d (0x%x)", *cue, *cue); - } + if (result == SI_FINISHED) + debugC(2, kDebugLevelSound, " => finished"); + else { + if (result == SI_LOOP) + debugC(2, kDebugLevelSound, " => Loop: %d (0x%x)", *cue, *cue); + else + debugC(2, kDebugLevelSound, " => Cue: %d (0x%x)", *cue, *cue); + } return result; @@ -765,9 +761,7 @@ int SfxState::sfx_poll_specific(song_handle_t handle, int *cue) { break; } } - if (_debug & SFX_DEBUG_CUES) { - fprintf(stderr, "\n"); - } + } @@ -939,8 +933,7 @@ Common::Error SfxState::sfx_send_midi(song_handle_t handle, int channel, if (command == 0xb0 && arg1 == SCI_MIDI_CHANNEL_MUTE) { - sciprintf("TODO: channel mute (channel %d %s)!\n", channel, - channel_state[arg2]); + warning("TODO: channel mute (channel %d %s)!", channel, channel_state[arg2]); /* We need to have a GET_PLAYMASK interface to use here. SET_PLAYMASK we've got. */ @@ -964,7 +957,7 @@ Common::Error SfxState::sfx_send_midi(song_handle_t handle, int channel, buffer[2] = (arg1 & 0xff00) >> 7; break; default: - sciprintf("Unexpected explicit MIDI command %02x\n", command); + warning("Unexpected explicit MIDI command %02x", command); return Common::kUnknownError; } diff --git a/engines/sci/sfx/core.h b/engines/sci/sfx/core.h index 2c327e1f6d..dc557f2f8c 100644 --- a/engines/sci/sfx/core.h +++ b/engines/sci/sfx/core.h @@ -43,11 +43,6 @@ struct fade_params_t; ** simultaneously ? */ #define SFX_STATE_FLAG_NOSOUND (1 << 1) /* Completely disable sound playing */ - -#define SFX_DEBUG_SONGS (1 << 0) /* Debug song changes */ -#define SFX_DEBUG_CUES (1 << 1) /* Debug cues, loops, and -** song completions */ - class SfxState { public: // FIXME, make private SongIterator *_it; /**< The song iterator at the heart of things */ @@ -55,7 +50,6 @@ public: // FIXME, make private songlib_t _songlib; /**< Song library */ song_t *_song; /**< Active song, or start of active song chain */ bool _suspended; /**< Whether we are suspended */ - uint _debug; /**< Debug flags */ ResourceSync *_soundSync; /**< Used by kDoSync for speech syncing in CD talkie games */ AudioResource *_audioResource; /**< Used for audio resources in CD talkie games */ |