mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Fix invalid handle issue in AlsaOut
This commit is contained in:
parent
adb3048a21
commit
c95cb68ae4
@ -499,20 +499,22 @@ void AlsaOut::SetFormat(IBuffer *buffer) {
|
||||
|
||||
this->InitDevice();
|
||||
|
||||
int err = snd_pcm_set_params(
|
||||
this->pcmHandle,
|
||||
PCM_FORMAT,
|
||||
PCM_ACCESS_TYPE,
|
||||
this->channels,
|
||||
this->rate,
|
||||
1, /* allow resampling */
|
||||
500000); /* 0.5s latency */
|
||||
if (this->pcmHandle) {
|
||||
int err = snd_pcm_set_params(
|
||||
this->pcmHandle,
|
||||
PCM_FORMAT,
|
||||
PCM_ACCESS_TYPE,
|
||||
this->channels,
|
||||
this->rate,
|
||||
1, /* allow resampling */
|
||||
500000); /* 0.5s latency */
|
||||
|
||||
if (err > 0) {
|
||||
std::cerr << "AlsaOut: set format error: " << snd_strerror(err) << std::endl;
|
||||
}
|
||||
else {
|
||||
this->SetVolume(this->volume);
|
||||
if (err > 0) {
|
||||
std::cerr << "AlsaOut: set format error: " << snd_strerror(err) << std::endl;
|
||||
}
|
||||
else {
|
||||
this->SetVolume(this->volume);
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "AlsaOut: device format initialized from buffer\n";
|
||||
|
Loading…
Reference in New Issue
Block a user