summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/BufferProviders.h
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-03-26 19:04:33 -0700
committerAndy Hung <hunga@google.com>2015-04-09 12:37:01 -0700
commitc5656cc900aeb4a705e27508dd82c70030a97709 (patch)
tree930d4266db7b4d93eb7ade5629812a722dc7920f /services/audioflinger/BufferProviders.h
parent857d5a20a956ef61b64ae07b018ecc2f1eb0a503 (diff)
downloadframeworks_av-c5656cc900aeb4a705e27508dd82c70030a97709.zip
frameworks_av-c5656cc900aeb4a705e27508dd82c70030a97709.tar.gz
frameworks_av-c5656cc900aeb4a705e27508dd82c70030a97709.tar.bz2
Add playback rate to AudioMixer
Bug: 19196501 Change-Id: I42d1f90e6297cf3f1304860d1691a5dfedd4c37d
Diffstat (limited to 'services/audioflinger/BufferProviders.h')
-rw-r--r--services/audioflinger/BufferProviders.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/services/audioflinger/BufferProviders.h b/services/audioflinger/BufferProviders.h
index 7145b80..2b6ea47 100644
--- a/services/audioflinger/BufferProviders.h
+++ b/services/audioflinger/BufferProviders.h
@@ -146,6 +146,45 @@ protected:
const audio_format_t mOutputFormat;
};
+// TimestretchBufferProvider derives from PassthruBufferProvider for time stretching
+class TimestretchBufferProvider : public PassthruBufferProvider {
+public:
+ TimestretchBufferProvider(int32_t channelCount,
+ audio_format_t format, uint32_t sampleRate, float speed, float pitch);
+ virtual ~TimestretchBufferProvider();
+
+ // Overrides AudioBufferProvider methods
+ virtual status_t getNextBuffer(Buffer* buffer, int64_t pts);
+ virtual void releaseBuffer(Buffer* buffer);
+
+ // Overrides PassthruBufferProvider
+ virtual void reset();
+
+ virtual status_t setPlaybackRate(float speed, float pitch);
+
+ // processes frames
+ // dstBuffer is where to place the data
+ // dstFrames [in/out] is the desired frames (return with actual placed in buffer)
+ // srcBuffer is the source data
+ // srcFrames [in/out] is the available source frames (return with consumed)
+ virtual void processFrames(void *dstBuffer, size_t *dstFrames,
+ const void *srcBuffer, size_t *srcFrames);
+
+protected:
+ const uint32_t mChannelCount;
+ const audio_format_t mFormat;
+ const uint32_t mSampleRate; // const for now (TODO change this)
+ const size_t mFrameSize;
+ float mSpeed;
+ float mPitch;
+
+private:
+ AudioBufferProvider::Buffer mBuffer;
+ size_t mLocalBufferFrameCount;
+ void *mLocalBufferData;
+ size_t mRemaining;
+};
+
// ----------------------------------------------------------------------------
} // namespace android