diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp index ace62cb7a107a18b9c012a69dcb20d2c3d7495f4..75b1f41811a0d64d05671ceefe0cff6bf748f0b6 100644 --- a/src/audio/alsalayer.cpp +++ b/src/audio/alsalayer.cpp @@ -32,7 +32,6 @@ bool ringtone_thread_is_running; , _PlaybackHandle(NULL) , _CaptureHandle(NULL) , _periodSize() - , _AsyncHandler(NULL) , _audioPlugin() , _inChannel() , _outChannel() @@ -208,7 +207,7 @@ AlsaLayer::playSamples(void* buffer, int toCopy, bool isTalking) AlsaLayer::putUrgent(void* buffer, int toCopy) { if ( _PlaybackHandle ){ - fillHWBuffer(); + //fillHWBuffer(); int a = _urgentBuffer.AvailForPut(); if( a >= toCopy ){ return _urgentBuffer.Put( buffer , toCopy , _defaultVolume ); @@ -268,9 +267,12 @@ void AlsaLayer::restorePulseAppsVolume( void ){} void AlsaLayer::playTones( void ) { + int frames; + int maxBytes; - int frames = _periodSize ; - int maxBytes = frames * sizeof(SFLDataFormat) ; + frames = _periodSize ; + frames = 940 ; + maxBytes = frames * sizeof(SFLDataFormat) ; SFLDataFormat* out = (SFLDataFormat*)malloc(maxBytes * sizeof(SFLDataFormat)); if( _talk ) {} else { @@ -371,6 +373,7 @@ bool AlsaLayer::alsa_set_params( snd_pcm_t *pcm_handle, int type, int rate ){ _debugAlsa("(%i) The choosen period size %d bytes is not supported by your hardware.\nUsing %d instead.\n ", type, (int)periodsize, (int)exact_lvalue); } periodsize = exact_lvalue; + _periodSize = exact_lvalue; /* Set the number of fragments */ exact_ivalue = periods; dir=0; @@ -437,7 +440,7 @@ AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag) if(flag == SFL_PCM_BOTH || flag == SFL_PCM_PLAYBACK) { - if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK )) < 0){ + if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, 0 )) < 0){ _debugAlsa("Error while opening playback device %s\n", pcm_p.c_str()); setErrorMessage( ALSA_PLAYBACK_DEVICE ); return false; @@ -484,7 +487,7 @@ AlsaLayer::write(void* buffer, int length) int err = snd_pcm_writei( _PlaybackHandle , buffer , frames ); switch(err) { case -EAGAIN: - _debugAlsa(" (%s)\n", snd_strerror( err )); + _debugAlsa("EAGAIN (%s)\n", snd_strerror( err )); snd_pcm_resume( _PlaybackHandle ); break; case -EPIPE: @@ -493,7 +496,7 @@ AlsaLayer::write(void* buffer, int length) snd_pcm_writei( _PlaybackHandle , buffer , frames ); break; case -ESTRPIPE: - _debugAlsa(" (%s)\n", snd_strerror(err)); + _debugAlsa(" ESTRPIPE(%s)\n", snd_strerror(err)); snd_pcm_resume( _PlaybackHandle ); break; case -EBADFD: diff --git a/src/audio/alsalayer.h b/src/audio/alsalayer.h index fac05081b90f9545d41018c4e36f65935c2570c2..a63b1f14ccb2fa1a82964f9bb8f7776afc15bf73 100644 --- a/src/audio/alsalayer.h +++ b/src/audio/alsalayer.h @@ -308,11 +308,6 @@ class AlsaLayer : public AudioLayer { */ snd_pcm_uframes_t _periodSize; - /** - * Handle on asynchronous event - */ - snd_async_handler_t *_AsyncHandler; - /** * Volume is controlled by the application. Data buffer are modified here to adjust to the right volume selected by the user on the main interface * @param buffer The buffer to adjust