mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 23:56:43 +02:00
Tidy up code
This commit is contained in:
parent
f5d4fcaf43
commit
7597f15d24
22 changed files with 74 additions and 85 deletions
|
@ -134,17 +134,13 @@ void AlsaStream::initAlsa()
|
|||
if ((err = snd_pcm_hw_params_set_format(handle_, hw_params, snd_pcm_format)) < 0)
|
||||
throw SnapException("Can't set sample format: " + string(snd_strerror(err)));
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_rate_near(handle_, hw_params, &rate, 0)) < 0)
|
||||
{
|
||||
if ((err = snd_pcm_hw_params_set_rate_near(handle_, hw_params, &rate, nullptr)) < 0)
|
||||
throw SnapException("Can't set rate: " + string(snd_strerror(err)));
|
||||
}
|
||||
else
|
||||
|
||||
if (rate != sampleFormat_.rate())
|
||||
{
|
||||
if (rate != sampleFormat_.rate())
|
||||
{
|
||||
LOG(WARNING, LOG_TAG) << "Rate is not accurate (requested: " << sampleFormat_.rate() << ", got: " << rate << "), using: " << rate << "\n";
|
||||
sampleFormat_.setFormat(rate, sampleFormat_.bits(), sampleFormat_.channels());
|
||||
}
|
||||
LOG(WARNING, LOG_TAG) << "Rate is not accurate (requested: " << sampleFormat_.rate() << ", got: " << rate << "), using: " << rate << "\n";
|
||||
sampleFormat_.setFormat(rate, sampleFormat_.bits(), sampleFormat_.channels());
|
||||
}
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_channels(handle_, hw_params, sampleFormat_.channels())) < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue