Loading services/audioflinger/Effects.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -617,10 +617,11 @@ EffectModule::~EffectModule() } // return true if any effect started or stopped bool EffectModule::updateState_l() { audio_utils::lock_guard _l(mutex()); bool started = false; bool startedOrStopped = false; switch (mState) { case RESTART: reset_l(); Loading @@ -635,7 +636,7 @@ bool EffectModule::updateState_l() { } if (start_ll() == NO_ERROR) { mState = ACTIVE; started = true; startedOrStopped = true; } else { mState = IDLE; } Loading @@ -655,6 +656,7 @@ bool EffectModule::updateState_l() { // turn off sequence. if (--mDisableWaitCnt == 0) { reset_l(); startedOrStopped = true; mState = IDLE; } break; Loading @@ -669,7 +671,7 @@ bool EffectModule::updateState_l() { break; } return started; return startedOrStopped; } void EffectModule::process() Loading Loading @@ -2308,6 +2310,9 @@ void EffectChain::process_l() { } bool doResetVolume = false; for (size_t i = 0; i < size; i++) { // reset volume when any effect just started or stopped. // resetVolume_l will check if the volume controller effect in the chain needs update and // apply the correct volume doResetVolume = mEffects[i]->updateState_l() || doResetVolume; } if (doResetVolume) { Loading Loading @@ -2661,6 +2666,9 @@ bool EffectChain::setVolume_l(uint32_t* left, uint32_t* right, bool force) { true /* effect chain volume controller */); mNewLeftVolume = newLeft; mNewRightVolume = newRight; ALOGD("%s sessionId %d volume controller effect %s set (%d, %d), ret (%d, %d)", __func__, mSessionId, mEffects[ctrlIdx]->desc().name, mLeftVolume, mRightVolume, newLeft, newRight); } // then indicate volume to all other effects in chain. // Pass altered volume to effects before volume controller Loading services/audioflinger/IAfEffect.h +4 −2 Original line number Diff line number Diff line Loading @@ -190,11 +190,13 @@ public: virtual status_t sendMetadata_ll(const std::vector<playback_track_metadata_v7_t>& metadata) REQUIRES(audio_utils::ThreadBase_Mutex, audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0; // return true if there was a state change from STARTING to ACTIVE, or STOPPED to IDLE, effect // chain will do a volume reset in these two cases virtual bool updateState_l() REQUIRES(audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0; private: virtual void process() = 0; virtual bool updateState_l() REQUIRES(audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0; virtual void reset_l() REQUIRES(audio_utils::EffectChain_Mutex) = 0; virtual status_t configure_l() REQUIRES(audio_utils::EffectChain_Mutex) = 0; virtual status_t init_l() Loading Loading
services/audioflinger/Effects.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -617,10 +617,11 @@ EffectModule::~EffectModule() } // return true if any effect started or stopped bool EffectModule::updateState_l() { audio_utils::lock_guard _l(mutex()); bool started = false; bool startedOrStopped = false; switch (mState) { case RESTART: reset_l(); Loading @@ -635,7 +636,7 @@ bool EffectModule::updateState_l() { } if (start_ll() == NO_ERROR) { mState = ACTIVE; started = true; startedOrStopped = true; } else { mState = IDLE; } Loading @@ -655,6 +656,7 @@ bool EffectModule::updateState_l() { // turn off sequence. if (--mDisableWaitCnt == 0) { reset_l(); startedOrStopped = true; mState = IDLE; } break; Loading @@ -669,7 +671,7 @@ bool EffectModule::updateState_l() { break; } return started; return startedOrStopped; } void EffectModule::process() Loading Loading @@ -2308,6 +2310,9 @@ void EffectChain::process_l() { } bool doResetVolume = false; for (size_t i = 0; i < size; i++) { // reset volume when any effect just started or stopped. // resetVolume_l will check if the volume controller effect in the chain needs update and // apply the correct volume doResetVolume = mEffects[i]->updateState_l() || doResetVolume; } if (doResetVolume) { Loading Loading @@ -2661,6 +2666,9 @@ bool EffectChain::setVolume_l(uint32_t* left, uint32_t* right, bool force) { true /* effect chain volume controller */); mNewLeftVolume = newLeft; mNewRightVolume = newRight; ALOGD("%s sessionId %d volume controller effect %s set (%d, %d), ret (%d, %d)", __func__, mSessionId, mEffects[ctrlIdx]->desc().name, mLeftVolume, mRightVolume, newLeft, newRight); } // then indicate volume to all other effects in chain. // Pass altered volume to effects before volume controller Loading
services/audioflinger/IAfEffect.h +4 −2 Original line number Diff line number Diff line Loading @@ -190,11 +190,13 @@ public: virtual status_t sendMetadata_ll(const std::vector<playback_track_metadata_v7_t>& metadata) REQUIRES(audio_utils::ThreadBase_Mutex, audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0; // return true if there was a state change from STARTING to ACTIVE, or STOPPED to IDLE, effect // chain will do a volume reset in these two cases virtual bool updateState_l() REQUIRES(audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0; private: virtual void process() = 0; virtual bool updateState_l() REQUIRES(audio_utils::EffectChain_Mutex) EXCLUDES_EffectBase_Mutex = 0; virtual void reset_l() REQUIRES(audio_utils::EffectChain_Mutex) = 0; virtual status_t configure_l() REQUIRES(audio_utils::EffectChain_Mutex) = 0; virtual status_t init_l() Loading