From 8a3243d9dddb53a0ec247d5b9a3c76a1318e37f0 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 6 Sep 2024 10:33:28 +0200 Subject: [PATCH] aplay/alsa: control debug print delay by log_level use run-time log_level rather then macro DEBUG --- src/audio/playback/alsa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/audio/playback/alsa.c b/src/audio/playback/alsa.c index c4394b65a..82d9da35d 100644 --- a/src/audio/playback/alsa.c +++ b/src/audio/playback/alsa.c @@ -62,7 +62,6 @@ #include "audio/audio_playback.h" #include "audio/types.h" #include "audio/utils.h" -#include "config.h" // for DEBUG #include "debug.h" #include "host.h" // for get_commandline_param, ADD_TO_PARAM #include "lib_common.h" @@ -989,11 +988,12 @@ static void audio_play_alsa_write_frame(void *state, const struct audio_frame *f struct state_alsa_playback *s = (struct state_alsa_playback *) state; int rc; -#ifdef DEBUG - snd_pcm_sframes_t delay; - snd_pcm_delay(s->handle, &delay); - //fprintf(stderr, "Alsa delay: %d samples (%u Hz)\n", (int)delay, (unsigned int) s->frame.sample_rate); -#endif + if (log_level >= LOG_LEVEL_DEBUG2) { + snd_pcm_sframes_t delay = 0; + snd_pcm_delay(s->handle, &delay); + fprintf(stderr, "Alsa delay: %d samples (%u Hz)\n", (int) delay, + (unsigned int) frame.sample_rate); + } int frames = frame->data_len / (frame->bps * frame->ch_count); rc = write_samples(s->handle, frame->data, frame->bps, frame->ch_count, frames, s->non_interleaved, s->playback_mode, s->scratchpad);