diff options
author | Eric Laurent <elaurent@google.com> | 2010-07-16 07:43:46 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-07-21 06:28:01 -0700 |
commit | 2beeb50b1bba9e92f6cacfeca37fe9fa9d36ead1 (patch) | |
tree | ce966d62f6fbb94178763ec53760f6961ffffd58 /media/libmedia/AudioTrack.cpp | |
parent | 3108231d90e8aa324923fd8864ca2477948c5d25 (diff) | |
download | frameworks_av-2beeb50b1bba9e92f6cacfeca37fe9fa9d36ead1.zip frameworks_av-2beeb50b1bba9e92f6cacfeca37fe9fa9d36ead1.tar.gz frameworks_av-2beeb50b1bba9e92f6cacfeca37fe9fa9d36ead1.tar.bz2 |
Added support for auxiliary audio effects to AudioTrack and MediaPlayer.
Added methods to AudioTrack and MediaPlayer java classes to enable use of
auxiliary audio effects. The effect can be attached and detached by specifying its
ID and the send level controlled.
Change-Id: Ie74ff54a453096a742688476f612ce355543b6f3
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 0f2093a..890786e 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -209,6 +209,7 @@ status_t AudioTrack::set( mFrameCount = frameCount; mNotificationFramesReq = notificationFrames; mSessionId = sessionId; + mAuxEffectId = 0; // create the IAudioTrack status_t status = createTrack(streamType, sampleRate, format, channelCount, @@ -458,8 +459,9 @@ void AudioTrack::getVolume(float* left, float* right) } } -status_t AudioTrack::setSendLevel(float level) +status_t AudioTrack::setAuxEffectSendLevel(float level) { + LOGV("setAuxEffectSendLevel(%f)", level); if (level > 1.0f) { return BAD_VALUE; } @@ -471,7 +473,7 @@ status_t AudioTrack::setSendLevel(float level) return NO_ERROR; } -void AudioTrack::getSendLevel(float* level) +void AudioTrack::getAuxEffectSendLevel(float* level) { if (level != NULL) { *level = mSendLevel; @@ -637,7 +639,12 @@ int AudioTrack::getSessionId() status_t AudioTrack::attachAuxEffect(int effectId) { - return mAudioTrack->attachAuxEffect(effectId); + LOGV("attachAuxEffect(%d)", effectId); + status_t status = mAudioTrack->attachAuxEffect(effectId); + if (status == NO_ERROR) { + mAuxEffectId = effectId; + } + return status; } // ------------------------------------------------------------------------- @@ -752,6 +759,7 @@ status_t AudioTrack::createTrack( mCblk->volumeLR = (uint32_t(uint16_t(mVolume[RIGHT] * 0x1000)) << 16) | uint16_t(mVolume[LEFT] * 0x1000); mCblk->sendLevel = uint16_t(mSendLevel * 0x1000); + mAudioTrack->attachAuxEffect(mAuxEffectId); mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS; mCblk->waitTimeMs = 0; mRemainingFrames = mNotificationFramesAct; |