Removed the "sfx_debuglog" command. Sound debug messages are now shown if kDebugLevelSound is specified
svn-id: r41039
This commit is contained in:
parent
2f90c8f398
commit
15d5b8436e
5 changed files with 35 additions and 147 deletions
|
@ -853,7 +853,6 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
||||||
retval->_sound._flags = s->_sound._flags;
|
retval->_sound._flags = s->_sound._flags;
|
||||||
retval->_sound._song = NULL;
|
retval->_sound._song = NULL;
|
||||||
retval->_sound._suspended = s->_sound._suspended;
|
retval->_sound._suspended = s->_sound._suspended;
|
||||||
retval->_sound._debug = s->_sound._debug;
|
|
||||||
reconstruct_sounds(retval);
|
reconstruct_sounds(retval);
|
||||||
|
|
||||||
// Message state:
|
// Message state:
|
||||||
|
|
|
@ -1708,87 +1708,9 @@ struct generic_config_flag_t {
|
||||||
unsigned int flag;
|
unsigned int flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void handle_config_update(const generic_config_flag_t *flags_list, int flags_nr, const char *subsystem,
|
|
||||||
int *active_options_p, const char *changestring /* or NULL to display*/) {
|
|
||||||
if (!changestring) {
|
|
||||||
int j;
|
|
||||||
|
|
||||||
sciprintf("Logging in %s:\n", subsystem);
|
|
||||||
if (!(*active_options_p))
|
|
||||||
sciprintf(" (nothing)\n");
|
|
||||||
|
|
||||||
for (j = 0; j < flags_nr; j++)
|
|
||||||
if (*active_options_p & flags_list[j].flag) {
|
|
||||||
sciprintf(" - %s (%c)\n", flags_list[j].name, flags_list[j].option);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int mode;
|
|
||||||
int j = 0;
|
|
||||||
int flags = 0;
|
|
||||||
|
|
||||||
if (changestring[0] == '-')
|
|
||||||
mode = 0;
|
|
||||||
else if (changestring[0] == '+')
|
|
||||||
mode = 1;
|
|
||||||
else {
|
|
||||||
sciprintf("Mode spec must start with '+' or '-' in '%s'\n", changestring);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (changestring[++j]) {
|
|
||||||
int k;
|
|
||||||
int flag = 0;
|
|
||||||
|
|
||||||
if (changestring[j] == '*')
|
|
||||||
flags = ~0; // Everything
|
|
||||||
else
|
|
||||||
for (k = 0; !flag && k < flags_nr; k++)
|
|
||||||
if (flags_list[k].option == changestring[j])
|
|
||||||
flag = flags_list[k].flag;
|
|
||||||
|
|
||||||
if (!flag) {
|
|
||||||
sciprintf("Invalid/unknown mode flag '%c'\n", changestring[j]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
flags |= flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode) // +
|
|
||||||
*active_options_p |= flags;
|
|
||||||
else // -
|
|
||||||
*active_options_p &= ~flags;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int c_handle_config_update(const generic_config_flag_t *flags, int flags_nr, const char *subsystem,
|
|
||||||
int *active_options_p, const Common::Array<cmd_param_t> &cmdParams) {
|
|
||||||
|
|
||||||
if (!_debugstate_valid) {
|
|
||||||
sciprintf("Not in debug state\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdParams.size() == 0)
|
|
||||||
handle_config_update(flags, flags_nr, subsystem, active_options_p, 0);
|
|
||||||
|
|
||||||
for (uint i = 0; i < cmdParams.size(); i++)
|
|
||||||
handle_config_update(flags, flags_nr, subsystem, active_options_p, cmdParams[i].str);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SFX_DEBUG_MODES 2
|
#define SFX_DEBUG_MODES 2
|
||||||
#define FROBNICATE_HANDLE(reg) ((reg).segment << 16 | (reg).offset)
|
#define FROBNICATE_HANDLE(reg) ((reg).segment << 16 | (reg).offset)
|
||||||
|
|
||||||
static int c_sfx_debuglog(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
|
||||||
const generic_config_flag_t sfx_debug_modes[SFX_DEBUG_MODES] = {
|
|
||||||
{"Song activation/deactivation", 's', SFX_DEBUG_SONGS},
|
|
||||||
{"Song cue polling and delivery", 'c', SFX_DEBUG_CUES}
|
|
||||||
};
|
|
||||||
|
|
||||||
return c_handle_config_update(sfx_debug_modes, SFX_DEBUG_MODES, "sound subsystem", (int *)&(s->_sound._debug), cmdParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int c_sfx_remove(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
static int c_sfx_remove(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
|
||||||
reg_t id = cmdParams[0].reg;
|
reg_t id = cmdParams[0].reg;
|
||||||
int handle = FROBNICATE_HANDLE(id);
|
int handle = FROBNICATE_HANDLE(id);
|
||||||
|
@ -1810,20 +1732,20 @@ static int c_is_sample(EngineState *s, const Common::Array<cmd_param_t> &cmdPara
|
||||||
Audio::AudioStream *data;
|
Audio::AudioStream *data;
|
||||||
|
|
||||||
if (!song) {
|
if (!song) {
|
||||||
sciprintf("Not a sound resource.\n");
|
warning("Not a sound resource");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
songit = songit_new(song->data, song->size, SCI_SONG_ITERATOR_TYPE_SCI0, 0xcaffe /* What do I care about the ID? */);
|
songit = songit_new(song->data, song->size, SCI_SONG_ITERATOR_TYPE_SCI0, 0xcaffe /* What do I care about the ID? */);
|
||||||
|
|
||||||
if (!songit) {
|
if (!songit) {
|
||||||
sciprintf("Error-- Could not convert to song iterator\n");
|
warning("Error-- Could not convert to song iterator");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((data = songit->getAudioStream())) {
|
if ((data = songit->getAudioStream())) {
|
||||||
/*
|
/*
|
||||||
sciprintf("\nIs sample (encoding %dHz/%s/%04x).\n", data->conf.rate, (data->conf.stereo) ?
|
warning("\nIs sample (encoding %dHz/%s/%04x).", data->conf.rate, (data->conf.stereo) ?
|
||||||
((data->conf.stereo == SFX_PCM_STEREO_LR) ? "stereo-LR" : "stereo-RL") : "mono", data->conf.format);
|
((data->conf.stereo == SFX_PCM_STEREO_LR) ? "stereo-LR" : "stereo-RL") : "mono", data->conf.format);
|
||||||
*/
|
*/
|
||||||
delete data;
|
delete data;
|
||||||
|
@ -2360,20 +2282,6 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *
|
||||||
" The word sequence must be provided as a\n single string.");
|
" The word sequence must be provided as a\n single string.");
|
||||||
con_hook_command(c_set_parse_nodes, "set_parse_nodes", "s*", "Sets the contents of all parse nodes.\n"
|
con_hook_command(c_set_parse_nodes, "set_parse_nodes", "s*", "Sets the contents of all parse nodes.\n"
|
||||||
" Input token must be separated by\n blanks.");
|
" Input token must be separated by\n blanks.");
|
||||||
con_hook_command(c_sfx_debuglog, "sfx_debuglog", "s*",
|
|
||||||
"Sets or prints the sound subsystem debug\n"
|
|
||||||
"settings\n\n"
|
|
||||||
"USAGE\n\n"
|
|
||||||
" sfx_debuglog {[+|-][p|u|x|b]+}*\n\n"
|
|
||||||
" sfx_debuglog\n\n"
|
|
||||||
" Prints current settings\n\n"
|
|
||||||
" sfx_debuglog +X\n\n"
|
|
||||||
" Activates all debug features listed in X\n\n"
|
|
||||||
" sfx_debuglog -X\n\n"
|
|
||||||
" Deactivates the debug features listed in X\n\n"
|
|
||||||
" Debug features:\n"
|
|
||||||
" s: Active song changes\n"
|
|
||||||
" c: Song cues\n");
|
|
||||||
|
|
||||||
#ifdef GFXW_DEBUG_WIDGETS
|
#ifdef GFXW_DEBUG_WIDGETS
|
||||||
con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n shows which widgets are active.\n"
|
con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n shows which widgets are active.\n"
|
||||||
|
|
|
@ -154,9 +154,6 @@ GfxWidget::GfxWidget(gfxw_widget_type_t type_) {
|
||||||
static int verify_widget(GfxWidget *widget) {
|
static int verify_widget(GfxWidget *widget) {
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
GFXERROR("Attempt to use NULL widget\n");
|
GFXERROR("Attempt to use NULL widget\n");
|
||||||
#ifdef GFXW_DEBUG_WIDGETS
|
|
||||||
BREAKPOINT();
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
} else if (widget->_magic != GFXW_MAGIC_VALID) {
|
} else if (widget->_magic != GFXW_MAGIC_VALID) {
|
||||||
if (widget->_magic == GFXW_MAGIC_INVALID) {
|
if (widget->_magic == GFXW_MAGIC_INVALID) {
|
||||||
|
@ -164,9 +161,6 @@ static int verify_widget(GfxWidget *widget) {
|
||||||
} else {
|
} else {
|
||||||
GFXERROR("Attempt to use non-widget\n");
|
GFXERROR("Attempt to use non-widget\n");
|
||||||
}
|
}
|
||||||
#ifdef GFXW_DEBUG_WIDGETS
|
|
||||||
BREAKPOINT();
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
/* Sound subsystem core: Event handler, sound player dispatching */
|
/* Sound subsystem core: Event handler, sound player dispatching */
|
||||||
|
|
||||||
#include "sci/tools.h"
|
#include "sci/tools.h"
|
||||||
|
#include "sci/sci.h"
|
||||||
#include "sci/sfx/core.h"
|
#include "sci/sfx/core.h"
|
||||||
#include "sci/sfx/iterator.h"
|
#include "sci/sfx/iterator.h"
|
||||||
#include "sci/sfx/misc.h"
|
#include "sci/sfx/misc.h"
|
||||||
|
@ -486,20 +487,25 @@ void SfxState::updateSingleSong() {
|
||||||
setSongStatus(newsong, SOUND_STATUS_WAITING);
|
setSongStatus(newsong, SOUND_STATUS_WAITING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_debug & SFX_DEBUG_SONGS) {
|
Common::String debugMessage = "[SFX] Changing active song:";
|
||||||
sciprintf("[SFX] Changing active song:");
|
if (!_song) {
|
||||||
if (!_song)
|
debugMessage += " New song:";
|
||||||
sciprintf(" New song:");
|
} else {
|
||||||
else
|
char tmp[50];
|
||||||
sciprintf(" pausing %08lx, now playing", _song->handle);
|
sprintf(tmp, " pausing %08lx, now playing ", _song->handle);
|
||||||
|
debugMessage += tmp;
|
||||||
if (newsong)
|
|
||||||
sciprintf(" %08lx\n", newsong->handle);
|
|
||||||
else
|
|
||||||
sciprintf(" none\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
_song = newsong;
|
||||||
thawTime(); /* Recover song delay time */
|
thawTime(); /* Recover song delay time */
|
||||||
|
|
||||||
|
@ -565,9 +571,8 @@ void SfxState::updateMultiSong() {
|
||||||
oldseeker = oldseeker->next_stopping)
|
oldseeker = oldseeker->next_stopping)
|
||||||
if (oldseeker->next_playing == ¬_playing_anymore) {
|
if (oldseeker->next_playing == ¬_playing_anymore) {
|
||||||
setSongStatus(oldseeker, SOUND_STATUS_SUSPENDED);
|
setSongStatus(oldseeker, SOUND_STATUS_SUSPENDED);
|
||||||
if (_debug & SFX_DEBUG_SONGS) {
|
debugC(2, kDebugLevelSound, "[SFX] Stopping song %lx\n", oldseeker->handle);
|
||||||
sciprintf("[SFX] Stopping song %lx\n", oldseeker->handle);
|
|
||||||
}
|
|
||||||
if (player && oldseeker->it)
|
if (player && oldseeker->it)
|
||||||
player->iterator_message(SongIterator::Message(oldseeker->it->ID, SIMSG_STOP));
|
player->iterator_message(SongIterator::Message(oldseeker->it->ID, SIMSG_STOP));
|
||||||
oldseeker->next_playing = NULL; /* Clear this pointer; we don't need the tag anymore */
|
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) {
|
for (newseeker = newsong; newseeker; newseeker = newseeker->next_playing) {
|
||||||
if (newseeker->status != SOUND_STATUS_PLAYING && player) {
|
if (newseeker->status != SOUND_STATUS_PLAYING && player) {
|
||||||
if (_debug & SFX_DEBUG_SONGS)
|
debugC(2, kDebugLevelSound, "[SFX] Adding song %lx\n", newseeker->it->ID);
|
||||||
sciprintf("[SFX] Adding song %lx\n", newseeker->it->ID);
|
|
||||||
|
|
||||||
SongIterator *clonesong = newseeker->it->clone(newseeker->_delay);
|
SongIterator *clonesong = newseeker->it->clone(newseeker->_delay);
|
||||||
player->add_iterator(clonesong, g_system->getMillis());
|
player->add_iterator(clonesong, g_system->getMillis());
|
||||||
|
@ -617,7 +621,6 @@ void SfxState::sfx_init(ResourceManager *resmgr, int flags) {
|
||||||
song_lib_init(&_songlib);
|
song_lib_init(&_songlib);
|
||||||
_song = NULL;
|
_song = NULL;
|
||||||
_flags = flags;
|
_flags = flags;
|
||||||
_debug = 0; /* Disable all debugging by default */
|
|
||||||
_soundSync = NULL;
|
_soundSync = NULL;
|
||||||
_audioResource = NULL;
|
_audioResource = NULL;
|
||||||
|
|
||||||
|
@ -644,7 +647,7 @@ void SfxState::sfx_init(ResourceManager *resmgr, int flags) {
|
||||||
player = new SfxPlayer();
|
player = new SfxPlayer();
|
||||||
|
|
||||||
if (!player) {
|
if (!player) {
|
||||||
sciprintf("[SFX] No song player found\n");
|
warning("[SFX] No song player found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,9 +724,7 @@ int SfxState::sfx_poll_specific(song_handle_t handle, int *cue) {
|
||||||
if (!song)
|
if (!song)
|
||||||
return 0; /* Song not playing */
|
return 0; /* Song not playing */
|
||||||
|
|
||||||
if (_debug & SFX_DEBUG_CUES) {
|
debugC(2, kDebugLevelSound, "[SFX:CUE] Polled song %08lx ", handle);
|
||||||
fprintf(stderr, "[SFX:CUE] Polled song %08lx ", handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (song->_wakeupTime.frameDiff(ctime) > 0)
|
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_LOOP:
|
||||||
case SI_RELATIVE_CUE:
|
case SI_RELATIVE_CUE:
|
||||||
case SI_ABSOLUTE_CUE:
|
case SI_ABSOLUTE_CUE:
|
||||||
if (_debug & SFX_DEBUG_CUES) {
|
if (result == SI_FINISHED)
|
||||||
sciprintf(" => ");
|
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);
|
||||||
|
|
||||||
if (result == SI_FINISHED)
|
|
||||||
sciprintf("finished\n");
|
|
||||||
else {
|
|
||||||
if (result == SI_LOOP)
|
|
||||||
sciprintf("Loop: ");
|
|
||||||
else
|
|
||||||
sciprintf("Cue: ");
|
|
||||||
|
|
||||||
sciprintf("%d (0x%x)", *cue, *cue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -765,9 +761,7 @@ int SfxState::sfx_poll_specific(song_handle_t handle, int *cue) {
|
||||||
break;
|
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 &&
|
if (command == 0xb0 &&
|
||||||
arg1 == SCI_MIDI_CHANNEL_MUTE) {
|
arg1 == SCI_MIDI_CHANNEL_MUTE) {
|
||||||
sciprintf("TODO: channel mute (channel %d %s)!\n", channel,
|
warning("TODO: channel mute (channel %d %s)!", channel, channel_state[arg2]);
|
||||||
channel_state[arg2]);
|
|
||||||
/* We need to have a GET_PLAYMASK interface to use
|
/* We need to have a GET_PLAYMASK interface to use
|
||||||
here. SET_PLAYMASK we've got.
|
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;
|
buffer[2] = (arg1 & 0xff00) >> 7;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sciprintf("Unexpected explicit MIDI command %02x\n", command);
|
warning("Unexpected explicit MIDI command %02x", command);
|
||||||
return Common::kUnknownError;
|
return Common::kUnknownError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,6 @@ struct fade_params_t;
|
||||||
** simultaneously ? */
|
** simultaneously ? */
|
||||||
#define SFX_STATE_FLAG_NOSOUND (1 << 1) /* Completely disable sound playing */
|
#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 {
|
class SfxState {
|
||||||
public: // FIXME, make private
|
public: // FIXME, make private
|
||||||
SongIterator *_it; /**< The song iterator at the heart of things */
|
SongIterator *_it; /**< The song iterator at the heart of things */
|
||||||
|
@ -55,7 +50,6 @@ public: // FIXME, make private
|
||||||
songlib_t _songlib; /**< Song library */
|
songlib_t _songlib; /**< Song library */
|
||||||
song_t *_song; /**< Active song, or start of active song chain */
|
song_t *_song; /**< Active song, or start of active song chain */
|
||||||
bool _suspended; /**< Whether we are suspended */
|
bool _suspended; /**< Whether we are suspended */
|
||||||
uint _debug; /**< Debug flags */
|
|
||||||
ResourceSync *_soundSync; /**< Used by kDoSync for speech syncing in CD talkie games */
|
ResourceSync *_soundSync; /**< Used by kDoSync for speech syncing in CD talkie games */
|
||||||
AudioResource *_audioResource; /**< Used for audio resources in CD talkie games */
|
AudioResource *_audioResource; /**< Used for audio resources in CD talkie games */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue