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
commit7070b36549d511d6627538c73dfbab23fbae5b43 (patch)
tree4a489b863b322e28f7047d7873b17a77056f3b41 /media/libmedia/mediaplayer.cpp
parentd7514ec6eb17d262d6f9605a2c2f245b7ad7c0b9 (diff)
downloadframeworks_base-7070b36549d511d6627538c73dfbab23fbae5b43.zip
frameworks_base-7070b36549d511d6627538c73dfbab23fbae5b43.tar.gz
frameworks_base-7070b36549d511d6627538c73dfbab23fbae5b43.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);