diff options
-rw-r--r-- | src/audioOutputs/audioOutput_alsa.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c index 932f2dbc0..aa1a86513 100644 --- a/src/audioOutputs/audioOutput_alsa.c +++ b/src/audioOutputs/audioOutput_alsa.c @@ -123,7 +123,7 @@ static int alsa_testDefault(void) snd_config_update_free_global(); if (ret) { - WARNING("Error opening default alsa device: %s\n", + WARNING("Error opening default ALSA device: %s\n", snd_strerror(-ret)); return -1; } else @@ -281,20 +281,15 @@ configure_hw: audioOutput->open = 1; - DEBUG("alsa device \"%s\" will be playing %i bit, %i channel audio at " + DEBUG("ALSA device \"%s\" will be playing %i bit, %i channel audio at " "%i Hz\n", ad->device, (int)audioFormat->bits, channels, sampleRate); return 0; error: - if (err_cmd) { - ERROR("Error opening alsa device \"%s\" (%s): %s\n", - ad->device, err_cmd, snd_strerror(-err)); - } else { - ERROR("Error opening alsa device \"%s\": %s\n", ad->device, - snd_strerror(-err)); - } + ERROR("Error opening ALSA device \"%s\" (%s): %s\n", + ad->device, (err_cmd ? err_cmd : ""), snd_strerror(-err)); fail: if (ad->pcmHandle) snd_pcm_close(ad->pcmHandle); @@ -308,11 +303,10 @@ static int alsa_errorRecovery(AlsaData * ad, int err) snd_pcm_state_t state = snd_pcm_state(ad->pcmHandle); const char *err_cmd = NULL; - if (err == -EPIPE) { - DEBUG("Underrun on alsa device \"%s\"\n", ad->device); - } else if (err == -ESTRPIPE) { - DEBUG("alsa device \"%s\" was suspended\n", ad->device); - } + if (err == -EPIPE) + DEBUG("Underrun on ALSA device \"%s\"\n", ad->device); + else if (err == -ESTRPIPE) + DEBUG("ALSA device \"%s\" was suspended\n", ad->device); switch (state) { case SND_PCM_STATE_PAUSED: @@ -343,7 +337,6 @@ static int alsa_errorRecovery(AlsaData * ad, int err) DEBUG("ALSA in unknown state: %s\n", snd_pcm_state_name(state)); break; } -error: if (err && err_cmd) ERROR("ALSA error on device \"%s\" (%s): %s\n", ad->device, err_cmd, snd_strerror(-err)); @@ -388,7 +381,7 @@ static int alsa_playAudio(AudioOutput * audioOutput, if (ret < 0) { if (alsa_errorRecovery(ad, ret) < 0) { - ERROR("closing alsa device \"%s\" due to write " + ERROR("closing ALSA device \"%s\" due to write " "error: %s\n", ad->device, snd_strerror(-errno)); alsa_closeDevice(audioOutput); |