AlsaOut tweaks. Must finish handling errors in that...

This commit is contained in:
urioxis 2011-02-07 16:56:48 +00:00
parent afda2bda0e
commit a92bfb32d2
2 changed files with 7 additions and 3 deletions

View File

@ -44,9 +44,9 @@ AlsaOut::AlsaOut()
std::cerr << "AlsaOut::AlsaOut() called" << std::endl;
#endif
int err;
if ((err = snd_pcm_open (&waveHandle, 0, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
std::cerr << "AlsaOut: cannot open audio device 0" << snd_strerror(err) << std::endl;
exit (1);
if ((err = snd_pcm_open (&waveHandle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
std::cerr << "AlsaOut: cannot open audio device 'default' :" << snd_strerror(err) << std::endl;
return;
}
#ifdef _DEBUG
else {

View File

@ -79,6 +79,10 @@ bool AlsaOutBuffer::AddToOutput(){
}*/
int err;
snd_pcm_t* wHandle = waveOut->getWaveHandle();
if (wHandle == NULL) {
printf("Error. No device handle \n");
return false;
}
frames = snd_pcm_writei(wHandle, (void*)data, bufferLength);
if (frames < 0)
frames = snd_pcm_recover(wHandle, frames, 0);