summaryrefslogtreecommitdiffstats
path: root/media/libmedia/mediaplayer.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-07-16 07:43:46 -0700
committerEric Laurent <elaurent@google.com>2010-07-21 06:28:01 -0700
commit2beeb50b1bba9e92f6cacfeca37fe9fa9d36ead1 (patch)
treece966d62f6fbb94178763ec53760f6961ffffd58 /media/libmedia/mediaplayer.cpp
parent3108231d90e8aa324923fd8864ca2477948c5d25 (diff)
downloadframeworks_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/mediaplayer.cpp')
-rw-r--r--media/libmedia/mediaplayer.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index b43f75f..1c99ae5 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -270,6 +270,7 @@ status_t MediaPlayer::start()
MEDIA_PLAYER_PLAYBACK_COMPLETE | MEDIA_PLAYER_PAUSED ) ) ) {
mPlayer->setLooping(mLoop);
mPlayer->setVolume(mLeftVolume, mRightVolume);
+ mPlayer->setAuxEffectSendLevel(mSendLevel);
mCurrentState = MEDIA_PLAYER_STARTED;
status_t ret = mPlayer->start();
if (ret != NO_ERROR) {
@@ -523,6 +524,31 @@ int MediaPlayer::getAudioSessionId()
return mAudioSessionId;
}
+status_t MediaPlayer::setAuxEffectSendLevel(float level)
+{
+ LOGV("MediaPlayer::setAuxEffectSendLevel(%f)", level);
+ Mutex::Autolock _l(mLock);
+ mSendLevel = level;
+ if (mPlayer != 0) {
+ return mPlayer->setAuxEffectSendLevel(level);
+ }
+ return OK;
+}
+
+status_t MediaPlayer::attachAuxEffect(int effectId)
+{
+ LOGV("MediaPlayer::attachAuxEffect(%d)", effectId);
+ Mutex::Autolock _l(mLock);
+ if (mPlayer == 0 ||
+ (mCurrentState & MEDIA_PLAYER_IDLE) ||
+ (mCurrentState == MEDIA_PLAYER_STATE_ERROR )) {
+ LOGE("attachAuxEffect called in state %d", mCurrentState);
+ return INVALID_OPERATION;
+ }
+
+ return mPlayer->attachAuxEffect(effectId);
+}
+
void MediaPlayer::notify(int msg, int ext1, int ext2)
{
LOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);