summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-04-15 17:15:07 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-04-18 18:27:39 -0700
commit3476de62fb10e76412452ef4c6bd71936c9f7db1 (patch)
tree9c814922fd33670a7cdd23c9597cbd19ad5e1ef9 /include
parentfbe308d428e42fe249ec317f76e3d11feb3264d5 (diff)
downloadframeworks_av-3476de62fb10e76412452ef4c6bd71936c9f7db1.zip
frameworks_av-3476de62fb10e76412452ef4c6bd71936c9f7db1.tar.gz
frameworks_av-3476de62fb10e76412452ef4c6bd71936c9f7db1.tar.bz2
Add support for scaling mode parameter
Support VISUALIZER_PARAM__SCALING_MODE parameter. Modify process() function to use new volume scaling parameter, used to set whether captured values are maximized by current headroom in the buffer (default existing behaviora) or left as is and thus affected by volume. Modify AudioEffect to allow subclasses to override the following events: control status changed, enable status changed, command executed. In Visualizer class (a subclass of AudioEffect), reset the scaling mode and capture size on the actual effect as cached when control is regained. This will allow the effect to be properly configured whenever Visualizers with different scaling modes or capture sizes are released (e.g. from java release() method). Change-Id: I05cb9f925a296dceca91bafa9fe294ef2b2c2bd5
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioEffect.h21
-rw-r--r--include/media/Visualizer.h11
2 files changed, 20 insertions, 12 deletions
diff --git a/include/media/AudioEffect.h b/include/media/AudioEffect.h
index 02dfc1b..05d834d 100644
--- a/include/media/AudioEffect.h
+++ b/include/media/AudioEffect.h
@@ -402,6 +402,15 @@ protected:
int32_t mId; // system wide unique effect engine instance ID
Mutex mLock; // Mutex for mEnabled access
+ // IEffectClient
+ virtual void controlStatusChanged(bool controlGranted);
+ virtual void enableStatusChanged(bool enabled);
+ virtual void commandExecuted(uint32_t cmdCode,
+ uint32_t cmdSize,
+ void *pCmdData,
+ uint32_t replySize,
+ void *pReplyData);
+
private:
// Implements the IEffectClient interface
@@ -433,20 +442,8 @@ private:
AudioEffect *mEffect;
};
-
- friend class EffectClient;
-
- // IEffectClient
- void controlStatusChanged(bool controlGranted);
- void enableStatusChanged(bool enabled);
- void commandExecuted(uint32_t cmdCode,
- uint32_t cmdSize,
- void *pCmdData,
- uint32_t replySize,
- void *pReplyData);
void binderDied();
-
sp<IEffect> mIEffect; // IEffect binder interface
sp<EffectClient> mIEffectClient; // IEffectClient implementation
sp<IMemory> mCblkMemory; // shared memory for deferred parameter setting
diff --git a/include/media/Visualizer.h b/include/media/Visualizer.h
index 60fa15b..fdec5ee 100644
--- a/include/media/Visualizer.h
+++ b/include/media/Visualizer.h
@@ -108,6 +108,12 @@ public:
// returns the sampling rate of the audio being captured
uint32_t getSamplingRate() { return mSampleRate; }
+ // set the way volume affects the captured data
+ // mode must one of VISUALIZER_SCALING_MODE_NORMALIZED,
+ // VISUALIZER_SCALING_MODE_AS_PLAYED
+ status_t setScalingMode(uint32_t mode);
+ uint32_t getScalingMode() { return mScalingMode; }
+
// return a capture in PCM 8 bit unsigned format. The size of the capture is equal to
// getCaptureSize()
status_t getWaveForm(uint8_t *waveform);
@@ -117,6 +123,10 @@ public:
// are returned
status_t getFft(uint8_t *fft);
+protected:
+ // from IEffectClient
+ virtual void controlStatusChanged(bool controlGranted);
+
private:
static const uint32_t CAPTURE_RATE_MAX = 20000;
@@ -147,6 +157,7 @@ private:
uint32_t mCaptureRate;
uint32_t mCaptureSize;
uint32_t mSampleRate;
+ uint32_t mScalingMode;
capture_cbk_t mCaptureCallBack;
void *mCaptureCbkUser;
sp<CaptureThread> mCaptureThread;