From 38f51ec421afe5e946e76385fcc36e89cbedd00b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 23 Mar 2015 23:14:45 +0100 Subject: [PATCH] [DEV] update ALSA error log. --- airtaudio/api/Alsa.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/airtaudio/api/Alsa.cpp b/airtaudio/api/Alsa.cpp index a751376..358c06a 100644 --- a/airtaudio/api/Alsa.cpp +++ b/airtaudio/api/Alsa.cpp @@ -469,6 +469,15 @@ bool airtaudio::api::Alsa::probeDeviceOpenName(const std::string& _deviceName, audio::format _format, uint32_t *_bufferSize, const airtaudio::StreamOptions& _options) { + ATA_DEBUG("Probe ALSA device : "); + ATA_DEBUG(" _deviceName=" << _deviceName); + ATA_DEBUG(" _mode=" << _mode); + ATA_DEBUG(" _channels=" << _channels); + ATA_DEBUG(" _firstChannel=" << _firstChannel); + ATA_DEBUG(" _sampleRate=" << _sampleRate); + ATA_DEBUG(" _format=" << _format); + + // I'm not using the "plug" interface ... too much inconsistent behavior. unsigned nDevices = 0; int32_t result, subdevice, card; @@ -585,12 +594,16 @@ bool airtaudio::api::Alsa::probeDeviceOpenName(const std::string& _deviceName, uint32_t value; result = snd_pcm_hw_params_get_channels_max(hw_params, &value); uint32_t deviceChannels = value; - if ( result < 0 - || deviceChannels < _channels + _firstChannel) { + if (result < 0) { snd_pcm_close(phandle); ATA_ERROR("requested channel parameters not supported by device (" << _deviceName << "), " << snd_strerror(result) << "."); return false; } + if (deviceChannels < _channels + _firstChannel) { + snd_pcm_close(phandle); + ATA_ERROR("requested channel " << _channels << " have : " << deviceChannels ); + return false; + } result = snd_pcm_hw_params_get_channels_min(hw_params, &value); if (result < 0) { snd_pcm_close(phandle);