diff options
| author | Eric Laurent <elaurent@google.com> | 2010-07-29 23:43:43 -0700 |
|---|---|---|
| committer | Eric Laurent <elaurent@google.com> | 2010-08-09 05:48:20 -0700 |
| commit | 2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee (patch) | |
| tree | fc777c3694d8739aba7a44caedc867c7b87b88a9 /media/libmedia | |
| parent | 8fb2e6e4720385961083a150a3e848ccaef544ae (diff) | |
| download | frameworks_base-2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee.zip frameworks_base-2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee.tar.gz frameworks_base-2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee.tar.bz2 | |
Fixed several audio effects problems.
- Fixed constant inversions in AudioEffect.java
- Do not return error when enabling an already enabled effect
- Update cached effect state in native AudioEffect class when effect is enabled/disabled by command() method
- Remove click when restarting effect during disable sequence
- Fixed problem in master mute management when volume control is delegated to effect.
Change-Id: I6df4ce9fcc54fdc7345df858f639d20d802d6712
Diffstat (limited to 'media/libmedia')
| -rw-r--r-- | media/libmedia/AudioEffect.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index 3cdf48a..0f3e245 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -218,7 +218,7 @@ status_t AudioEffect::setEnabled(bool enabled) return mIEffect->disable(); } } - return INVALID_OPERATION; + return NO_ERROR; } status_t AudioEffect::command(uint32_t cmdCode, @@ -231,7 +231,22 @@ status_t AudioEffect::command(uint32_t cmdCode, return INVALID_OPERATION; } - return mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); + status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); + if (status != NO_ERROR) { + return status; + } + status = *(status_t *)replyData; + if (status != NO_ERROR) { + return status; + } + + if (cmdCode == EFFECT_CMD_ENABLE) { + android_atomic_or(1, &mEnabled); + } + if (cmdCode == EFFECT_CMD_DISABLE) { + android_atomic_and(~1, &mEnabled); + } + return status; } @@ -347,7 +362,11 @@ void AudioEffect::enableStatusChanged(bool enabled) { LOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf); if (mStatus == ALREADY_EXISTS) { - mEnabled = enabled; + if (enabled) { + android_atomic_or(1, &mEnabled); + } else { + android_atomic_and(~1, &mEnabled); + } if (mCbf) { mCbf(EVENT_ENABLE_STATUS_CHANGED, mUserData, &enabled); } |
