diff --git a/daemon/src/audio/alsa/alsalayer.cpp b/daemon/src/audio/alsa/alsalayer.cpp index 7505094acf2064d70835d5b1f4855a219e47b50f..57e68e28e5a7774819560a5265e8fd1da6816ee9 100644 --- a/daemon/src/audio/alsa/alsalayer.cpp +++ b/daemon/src/audio/alsa/alsalayer.cpp @@ -34,6 +34,7 @@ #include "eventthread.h" #include "audio/samplerateconverter.h" #include "managerimpl.h" +#include "dbus/configurationmanager.h" class AlsaThread : public ost::Thread { @@ -505,7 +506,7 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r, int err; if ((err = snd_pcm_open (&playbackHandle_, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, 0)) < 0) { _warn ("Audio: Error while opening playback device %s", pcm_p.c_str()); - setErrorMessage (ALSA_PLAYBACK_DEVICE); + Manager::instance().getDbusManager()->getConfigurationManager()->errorAlert(ALSA_PLAYBACK_DEVICE); is_playback_open_ = false; return false; } @@ -538,7 +539,7 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r, if (snd_pcm_open (&captureHandle_, pcm_c.c_str(), SND_PCM_STREAM_CAPTURE, 0) < 0) { _warn ("Audio: Error: Opening capture device %s", pcm_c.c_str()); - setErrorMessage (ALSA_CAPTURE_DEVICE); + Manager::instance().getDbusManager()->getConfigurationManager()->errorAlert(ALSA_CAPTURE_DEVICE); is_capture_open_ = false; return false; } diff --git a/daemon/src/audio/audiolayer.cpp b/daemon/src/audio/audiolayer.cpp index af4c01df1d75fdd6b5199f7c320c14638c80579f..89a822b6e0b13f89d555d68370da054b4e416be2 100644 --- a/daemon/src/audio/audiolayer.cpp +++ b/daemon/src/audio/audiolayer.cpp @@ -45,7 +45,6 @@ AudioLayer::AudioLayer (int type) , frameSize_ (0) , inChannel_ (1) , outChannel_ (1) - , errorMessage_ (0) , mutex_ () , audioPref(Manager::instance().audioPreference) , layerType_ (type) diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h index 3f9b99d4052100f80a2593a1f3070c5de7e25f9a..caf2f20709827a6018165c6c5a7e84c1fa313add 100644 --- a/daemon/src/audio/audiolayer.h +++ b/daemon/src/audio/audiolayer.h @@ -115,24 +115,6 @@ class AudioLayer void flushUrgent (void); - /** - * Write accessor to the error state - * @param error The error code - * Could be: ALSA_PLAYBACK_DEVICE - * ALSA_CAPTURE_DEVICE - */ - void setErrorMessage (int error) { - errorMessage_ = error; - } - - /** - * Read accessor to the error state - * @return int The error code - */ - int getErrorMessage() const { - return errorMessage_; - } - /** * Get the index of the audio card for capture * @return int The index of the card used for capture @@ -286,9 +268,6 @@ class AudioLayer */ unsigned int outChannel_; - /** Contains the current error code */ - int errorMessage_; - /** * Lock for the entire audio layer */ diff --git a/daemon/src/global.h b/daemon/src/global.h index 66393d767c101f77cad8237d2caef4c333beb518..fa9c9289e9958aaa52d6212520694431edb4afec 100644 --- a/daemon/src/global.h +++ b/daemon/src/global.h @@ -120,7 +120,6 @@ static const SOUND_FORMAT INT32 = 0x8; #define ALSA 0 #define PULSEAUDIO 1 -#define CHECK_INTERFACE( layer , api ) (layer == api) #define UNUSED __attribute__((__unused__)) diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 0c928452f6e953dcdb4c04080ea281c4c6618852..678633ff0dd2d74407e8453eaa0f2045739b8492 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -2050,18 +2050,13 @@ std::string ManagerImpl::getCurrentCodecName (const std::string& id) void ManagerImpl::setAudioPlugin (const std::string& audioPlugin) { audioLayerMutexLock(); - int layerType = _audiodriver -> getLayerType(); audioPreference.setPlugin (audioPlugin); - if (CHECK_INTERFACE (layerType , ALSA)) { - _debug ("Set input audio plugin"); + if (_audiodriver -> getLayerType() == ALSA) { _audiodriver -> openDevice (_audiodriver->getIndexIn(), _audiodriver->getIndexOut(), _audiodriver->getIndexRing(), _audiodriver -> getSampleRate(), _audiodriver -> getFrameSize(), SFL_PCM_BOTH, audioPlugin); - - if (_audiodriver -> getErrorMessage()) - notifyErrClient (_audiodriver -> getErrorMessage()); } audioLayerMutexUnlock(); } @@ -2116,9 +2111,6 @@ void ManagerImpl::setAudioDevice (const int index, int streamType) _warn ("Unknown stream type"); } - if (_audiodriver -> getErrorMessage()) - notifyErrClient (_audiodriver -> getErrorMessage()); - audioLayerMutexUnlock(); } @@ -2391,7 +2383,6 @@ int32_t ManagerImpl::getAudioManager (void) const void ManagerImpl::notifyErrClient (int32_t errCode) { - _debug ("Manager: NOTIFY ERR NUMBER %d" , errCode); _dbus.getConfigurationManager()->errorAlert(errCode); } @@ -2477,10 +2468,6 @@ void ManagerImpl::initAudioDriver (void) _audiodriver = new AlsaLayer; } - int error = _audiodriver->getErrorMessage(); - if (error) - _error("Audio driver init: %d", error); - audioLayerMutexUnlock(); } @@ -2534,11 +2521,6 @@ void ManagerImpl::selectAudioDriver (void) _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, sampleRate, frameSize, SFL_PCM_BOTH, alsaPlugin); - /* Notify the error if there is one */ - - if (_audiodriver-> getErrorMessage()) - notifyErrClient (_audiodriver -> getErrorMessage()); - audioLayerMutexUnlock(); } @@ -2579,9 +2561,6 @@ void ManagerImpl::switchAudioManager (void) _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, framesize, SFL_PCM_BOTH, alsaPlugin); - if (_audiodriver->getErrorMessage()) - notifyErrClient (_audiodriver -> getErrorMessage()); - _debug ("Manager: Current device: %d ", type); if (wasStarted) @@ -2635,9 +2614,6 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate) _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, framesize, SFL_PCM_BOTH, alsaPlugin); - if (_audiodriver -> getErrorMessage()) - notifyErrClient (_audiodriver -> getErrorMessage()); - _debug ("Manager: Current device: %d ", type); _mainBuffer.setInternalSamplingRate(samplerate); diff --git a/daemon/src/managerimpl_registration.cpp b/daemon/src/managerimpl_registration.cpp index 73f94cc55f65f2db6a8d40485ed253355a225a21..7faf1cb1c42e1708b5af09fc7ac4803bf188a349 100644 --- a/daemon/src/managerimpl_registration.cpp +++ b/daemon/src/managerimpl_registration.cpp @@ -58,13 +58,6 @@ ManagerImpl::registerAccounts() iter->second->registerVoIPLink(); } } - - audioLayerMutexLock(); - - if (_audiodriver->getErrorMessage() != -1) - notifyErrClient (_audiodriver->getErrorMessage()); - - audioLayerMutexUnlock(); }