mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-02 19:01:47 +02:00
32 bit as fallback for 24 bit
This commit is contained in:
parent
8588488f8f
commit
132704d7ed
1 changed files with 12 additions and 2 deletions
|
@ -26,7 +26,8 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
AlsaPlayer::AlsaPlayer(const PcmDevice& pcmDevice, Stream* stream) : Player(pcmDevice, stream), handle_(NULL), buff_(NULL)
|
||||
AlsaPlayer::AlsaPlayer(const PcmDevice& pcmDevice, Stream* stream) :
|
||||
Player(pcmDevice, stream), handle_(NULL), buff_(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -73,8 +74,17 @@ void AlsaPlayer::initAlsa()
|
|||
else
|
||||
throw SnapException("Unsupported sample format: " + cpt::to_string(format.bits));
|
||||
|
||||
if ((pcm = snd_pcm_hw_params_set_format(handle_, params, snd_pcm_format)) < 0)
|
||||
pcm = snd_pcm_hw_params_set_format(handle_, params, snd_pcm_format);
|
||||
if ((pcm == -EINVAL) && (snd_pcm_format == SND_PCM_FORMAT_S24_LE))
|
||||
{
|
||||
snd_pcm_format = SND_PCM_FORMAT_S32_LE;
|
||||
volCorrection_ = 256;
|
||||
}
|
||||
|
||||
pcm = snd_pcm_hw_params_set_format(handle_, params, snd_pcm_format);
|
||||
if (pcm < 0)
|
||||
{
|
||||
cerr << "error: " << pcm << "\n";
|
||||
stringstream ss;
|
||||
ss << "Can't set format: " << string(snd_strerror(pcm)) << ", supported: ";
|
||||
for (int format = 0; format <= (int)SND_PCM_FORMAT_LAST; format++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue