summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
Diffstat (limited to 'libaudio')
-rw-r--r--libaudio/AudioHardware.cpp64
-rw-r--r--libaudio/AudioHardware.h3
2 files changed, 41 insertions, 26 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 4bbe7d6..601a591 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -1703,38 +1703,17 @@ String8 AudioHardware::AudioStreamInALSA::getParameters(const String8& keys)
return param.toString();
}
-status_t AudioHardware::AudioStreamInALSA::getNextBuffer(AudioHardware::BufferProvider::Buffer* buffer)
+status_t AudioHardware::AudioStreamInALSA::addAudioEffect(effect_handle_t effect)
{
- if (mPcm == NULL) {
- buffer->raw = NULL;
- buffer->frameCount = 0;
- mReadStatus = NO_INIT;
- return NO_INIT;
- }
-
- if (mInPcmInBuf == 0) {
- TRACE_DRIVER_IN(DRV_PCM_READ)
- mReadStatus = pcm_read(mPcm,(void*) mPcmIn, AUDIO_HW_IN_PERIOD_SZ * frameSize());
- TRACE_DRIVER_OUT
- if (mReadStatus != 0) {
- buffer->raw = NULL;
- buffer->frameCount = 0;
- return mReadStatus;
- }
- mInPcmInBuf = AUDIO_HW_IN_PERIOD_SZ;
- }
-
- buffer->frameCount = (buffer->frameCount > mInPcmInBuf) ? mInPcmInBuf : buffer->frameCount;
- buffer->i16 = mPcmIn + (AUDIO_HW_IN_PERIOD_SZ - mInPcmInBuf) * mChannelCount;
-
- return mReadStatus;
+ return NO_ERROR;
}
-void AudioHardware::AudioStreamInALSA::releaseBuffer(Buffer* buffer)
+status_t AudioHardware::AudioStreamInALSA::removeAudioEffect(effect_handle_t effect)
{
- mInPcmInBuf -= buffer->frameCount;
+ return NO_ERROR;
}
+
size_t AudioHardware::AudioStreamInALSA::getBufferSize(uint32_t sampleRate, int channelCount)
{
size_t i;
@@ -1770,6 +1749,39 @@ void AudioHardware::AudioStreamInALSA::unlock() {
mLock.unlock();
}
+//--- BufferProvider
+status_t AudioHardware::AudioStreamInALSA::getNextBuffer(AudioHardware::BufferProvider::Buffer* buffer)
+{
+ if (mPcm == NULL) {
+ buffer->raw = NULL;
+ buffer->frameCount = 0;
+ mReadStatus = NO_INIT;
+ return NO_INIT;
+ }
+
+ if (mInPcmInBuf == 0) {
+ TRACE_DRIVER_IN(DRV_PCM_READ)
+ mReadStatus = pcm_read(mPcm,(void*) mPcmIn, AUDIO_HW_IN_PERIOD_SZ * frameSize());
+ TRACE_DRIVER_OUT
+ if (mReadStatus != 0) {
+ buffer->raw = NULL;
+ buffer->frameCount = 0;
+ return mReadStatus;
+ }
+ mInPcmInBuf = AUDIO_HW_IN_PERIOD_SZ;
+ }
+
+ buffer->frameCount = (buffer->frameCount > mInPcmInBuf) ? mInPcmInBuf : buffer->frameCount;
+ buffer->i16 = mPcmIn + (AUDIO_HW_IN_PERIOD_SZ - mInPcmInBuf) * mChannelCount;
+
+ return mReadStatus;
+}
+
+void AudioHardware::AudioStreamInALSA::releaseBuffer(Buffer* buffer)
+{
+ mInPcmInBuf -= buffer->frameCount;
+}
+
//------------------------------------------------------------------------------
// speex based resampler
//------------------------------------------------------------------------------
diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
index c791f37..abc2e08 100644
--- a/libaudio/AudioHardware.h
+++ b/libaudio/AudioHardware.h
@@ -329,6 +329,9 @@ private:
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
virtual unsigned int getInputFramesLost() const { return 0; }
+ virtual status_t addAudioEffect(effect_handle_t effect);
+ virtual status_t removeAudioEffect(effect_handle_t effect);
+
uint32_t device() { return mDevices; }
void doStandby_l();
void close_l();