From 1db3d431f5be4e4b3b7f026d2aed07f8b7e64595 Mon Sep 17 00:00:00 2001 From: "Mark K. Kim" Date: Tue, 26 Jun 2018 22:59:24 -0400 Subject: [PATCH] Add debugging output for playing sounds. --- src/playsound.c | 10 ++++++++-- src/tuxpaint.c | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/playsound.c b/src/playsound.c index e76127bf1..b5bbe0db4 100644 --- a/src/playsound.c +++ b/src/playsound.c @@ -54,6 +54,10 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y if (!mute && use_sound && s != SND_NONE) { +#ifdef DEBUG + printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ", sounds[s]); + fflush(stdout); +#endif if (override || !Mix_Playing(chan)) { Mix_PlayChannel(chan, sounds[s], 0); @@ -91,8 +95,10 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y left = ((255 - dist) * ((screen->w - 1) - x)) / (screen->w - 1); } - - +#ifdef DEBUG + printf("Panning of sound #%d in channel %d, left=%d, right=%d\n", s, chan, left, (255-dist)-left); + fflush(stdout); +#endif Mix_SetPanning(chan, left, (255 - dist) - left); } } diff --git a/src/tuxpaint.c b/src/tuxpaint.c index d235012a4..db16cbcc4 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -11841,6 +11841,17 @@ static int do_prompt_image_flash_snd(const char *const text, int val_x, val_y, motioner; int valhat_x, valhat_y, hatmotioner; +#ifdef DEBUG + if(snd >= 0) { + printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]); + fflush(stdout); + } + else { + printf("Prompt without sound\n"); + fflush(stdout); + } +#endif + val_x = val_y = motioner = 0; valhat_x = valhat_y = hatmotioner = 0; emulate_button_pressed = 0;