diff options
author | Eric Laurent <elaurent@google.com> | 2010-07-07 16:23:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-07-07 16:23:30 -0700 |
commit | 6c5c25fae5aa68a52c6fa75649dd559a9ca98932 (patch) | |
tree | 825ab3a8deb612c3eb8daae783670d1273c64521 /media/libmedia/AudioEffect.cpp | |
parent | 8cafde196d36ab207f35fed89b9c1b9d468abb58 (diff) | |
parent | da7581b7b61b84f15e8d671c86fd117c322b009e (diff) | |
download | frameworks_av-6c5c25fae5aa68a52c6fa75649dd559a9ca98932.zip frameworks_av-6c5c25fae5aa68a52c6fa75649dd559a9ca98932.tar.gz frameworks_av-6c5c25fae5aa68a52c6fa75649dd559a9ca98932.tar.bz2 |
Merge "Added Visualizer effect." into gingerbread
Diffstat (limited to 'media/libmedia/AudioEffect.cpp')
-rw-r--r-- | media/libmedia/AudioEffect.cpp | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index 4afa2dc..783249d 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -171,7 +171,7 @@ AudioEffect::~AudioEffect() LOGV("Destructor %p", this); if (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS) { - disable(); + setEnabled(false); if (mIEffect != NULL) { mIEffect->disconnect(); mIEffect->asBinder()->unlinkToDeath(mIEffectClient); @@ -196,36 +196,28 @@ effect_descriptor_t AudioEffect::descriptor() const return mDescriptor; } -bool AudioEffect::isEnabled() const +bool AudioEffect::getEnabled() const { return (mEnabled != 0); } -status_t AudioEffect::enable() +status_t AudioEffect::setEnabled(bool enabled) { if (mStatus != NO_ERROR) { return INVALID_OPERATION; } - LOGV("enable %p", this); - if (android_atomic_or(1, &mEnabled) == 0) { - return mIEffect->enable(); - } - - return INVALID_OPERATION; -} - -status_t AudioEffect::disable() -{ - if (mStatus != NO_ERROR) { - return INVALID_OPERATION; - } - LOGV("disable %p", this); - - if (android_atomic_and(~1, &mEnabled) == 1) { - return mIEffect->disable(); + if (enabled) { + LOGV("enable %p", this); + if (android_atomic_or(1, &mEnabled) == 0) { + return mIEffect->enable(); + } + } else { + LOGV("disable %p", this); + if (android_atomic_and(~1, &mEnabled) == 1) { + return mIEffect->disable(); + } } - return INVALID_OPERATION; } @@ -349,7 +341,7 @@ void AudioEffect::controlStatusChanged(bool controlGranted) void AudioEffect::enableStatusChanged(bool enabled) { - LOGV("enableStatusChanged %p enabled %d", this, enabled); + LOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf); if (mStatus == ALREADY_EXISTS) { mEnabled = enabled; if (mCbf) { |