mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +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();
|
this->InitDevice();
|
||||||
|
|
||||||
int err = snd_pcm_set_params(
|
if (this->pcmHandle) {
|
||||||
this->pcmHandle,
|
int err = snd_pcm_set_params(
|
||||||
PCM_FORMAT,
|
this->pcmHandle,
|
||||||
PCM_ACCESS_TYPE,
|
PCM_FORMAT,
|
||||||
this->channels,
|
PCM_ACCESS_TYPE,
|
||||||
this->rate,
|
this->channels,
|
||||||
1, /* allow resampling */
|
this->rate,
|
||||||
500000); /* 0.5s latency */
|
1, /* allow resampling */
|
||||||
|
500000); /* 0.5s latency */
|
||||||
|
|
||||||
if (err > 0) {
|
if (err > 0) {
|
||||||
std::cerr << "AlsaOut: set format error: " << snd_strerror(err) << std::endl;
|
std::cerr << "AlsaOut: set format error: " << snd_strerror(err) << std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->SetVolume(this->volume);
|
this->SetVolume(this->volume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "AlsaOut: device format initialized from buffer\n";
|
std::cerr << "AlsaOut: device format initialized from buffer\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user