diff --git a/client/player/alsaPlayer.cpp b/client/player/alsaPlayer.cpp index f71c91c7..647cbb48 100644 --- a/client/player/alsaPlayer.cpp +++ b/client/player/alsaPlayer.cpp @@ -74,7 +74,17 @@ void AlsaPlayer::initAlsa() throw SnapException("Unsupported sample format: " + cpt::to_string(format.bits)); if ((pcm = snd_pcm_hw_params_set_format(handle_, params, snd_pcm_format)) < 0) - throw SnapException("Can't set format: " + string(snd_strerror(pcm))); + { + stringstream ss; + ss << "Can't set format: " << string(snd_strerror(pcm)) << ", supported: "; + for (int format = 0; format <= (int)SND_PCM_FORMAT_LAST; format++) + { + snd_pcm_format_t snd_pcm_format = static_cast(format); + if (snd_pcm_hw_params_test_format(handle_, params, snd_pcm_format) == 0) + ss << snd_pcm_format_name(snd_pcm_format) << " "; + } + throw SnapException(ss.str()); + } if ((pcm = snd_pcm_hw_params_set_channels(handle_, params, channels)) < 0) throw SnapException("Can't set channels number: " + string(snd_strerror(pcm)));