Loading services/audioflinger/AudioFlinger.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -1629,6 +1629,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track track->mState = TrackBase::ACTIVE; param = AudioMixer::RAMP_VOLUME; } mAudioMixer->setParameter(AudioMixer::RESAMPLE, AudioMixer::RESET, NULL); } else if (cblk->server != 0) { // If the track is stopped before the first frame was mixed, // do not apply ramp Loading Loading @@ -3855,9 +3856,12 @@ status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrac mActiveTrack.clear(); return status; } mActiveTrack->mState = TrackBase::RESUMING; mRsmpInIndex = mFrameCount; mBytesRead = 0; if (mResampler != NULL) { mResampler->reset(); } mActiveTrack->mState = TrackBase::RESUMING; // signal thread to start LOGV("Signal record thread"); mWaitWorkCV.signal(); Loading services/audioflinger/AudioMixer.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,12 @@ status_t AudioMixer::setParameter(int target, int name, void *value) return NO_ERROR; } } if (name == RESET) { track_t& track = mState.tracks[ mActiveTrack ]; track.resetResampler(); invalidateState(1<<mActiveTrack); return NO_ERROR; } break; case RAMP_VOLUME: case VOLUME: Loading Loading @@ -289,6 +295,13 @@ bool AudioMixer::track_t::doesResample() const return resampler != 0; } void AudioMixer::track_t::resetResampler() { if (resampler != 0) { resampler->reset(); } } inline void AudioMixer::track_t::adjustVolumeRamp(bool aux) { Loading services/audioflinger/AudioMixer.h +2 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public: AUX_BUFFER = 0x4003, // for TARGET RESAMPLE SAMPLE_RATE = 0x4100, RESET = 0x4101, // for TARGET VOLUME (8 channels max) VOLUME0 = 0x4200, VOLUME1 = 0x4201, Loading Loading @@ -163,6 +164,7 @@ private: bool setResampler(uint32_t sampleRate, uint32_t devSampleRate); bool doesResample() const; void resetResampler(); void adjustVolumeRamp(bool aux); }; Loading services/audioflinger/AudioResampler.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,12 @@ void AudioResampler::setVolume(int16_t left, int16_t right) { mVolume[1] = right; } void AudioResampler::reset() { mInputIndex = 0; mPhaseFraction = 0; mBuffer.frameCount = 0; } // ---------------------------------------------------------------------------- void AudioResamplerOrder1::resample(int32_t* out, size_t outFrameCount, Loading services/audioflinger/AudioResampler.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ public: virtual void resample(int32_t* out, size_t outFrameCount, AudioBufferProvider* provider) = 0; virtual void reset(); protected: // number of bits for phase fraction - 30 bits allows nearly 2x downsampling static const int kNumPhaseBits = 30; Loading Loading
services/audioflinger/AudioFlinger.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -1629,6 +1629,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track track->mState = TrackBase::ACTIVE; param = AudioMixer::RAMP_VOLUME; } mAudioMixer->setParameter(AudioMixer::RESAMPLE, AudioMixer::RESET, NULL); } else if (cblk->server != 0) { // If the track is stopped before the first frame was mixed, // do not apply ramp Loading Loading @@ -3855,9 +3856,12 @@ status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrac mActiveTrack.clear(); return status; } mActiveTrack->mState = TrackBase::RESUMING; mRsmpInIndex = mFrameCount; mBytesRead = 0; if (mResampler != NULL) { mResampler->reset(); } mActiveTrack->mState = TrackBase::RESUMING; // signal thread to start LOGV("Signal record thread"); mWaitWorkCV.signal(); Loading
services/audioflinger/AudioMixer.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,12 @@ status_t AudioMixer::setParameter(int target, int name, void *value) return NO_ERROR; } } if (name == RESET) { track_t& track = mState.tracks[ mActiveTrack ]; track.resetResampler(); invalidateState(1<<mActiveTrack); return NO_ERROR; } break; case RAMP_VOLUME: case VOLUME: Loading Loading @@ -289,6 +295,13 @@ bool AudioMixer::track_t::doesResample() const return resampler != 0; } void AudioMixer::track_t::resetResampler() { if (resampler != 0) { resampler->reset(); } } inline void AudioMixer::track_t::adjustVolumeRamp(bool aux) { Loading
services/audioflinger/AudioMixer.h +2 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public: AUX_BUFFER = 0x4003, // for TARGET RESAMPLE SAMPLE_RATE = 0x4100, RESET = 0x4101, // for TARGET VOLUME (8 channels max) VOLUME0 = 0x4200, VOLUME1 = 0x4201, Loading Loading @@ -163,6 +164,7 @@ private: bool setResampler(uint32_t sampleRate, uint32_t devSampleRate); bool doesResample() const; void resetResampler(); void adjustVolumeRamp(bool aux); }; Loading
services/audioflinger/AudioResampler.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,12 @@ void AudioResampler::setVolume(int16_t left, int16_t right) { mVolume[1] = right; } void AudioResampler::reset() { mInputIndex = 0; mPhaseFraction = 0; mBuffer.frameCount = 0; } // ---------------------------------------------------------------------------- void AudioResamplerOrder1::resample(int32_t* out, size_t outFrameCount, Loading
services/audioflinger/AudioResampler.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ public: virtual void resample(int32_t* out, size_t outFrameCount, AudioBufferProvider* provider) = 0; virtual void reset(); protected: // number of bits for phase fraction - 30 bits allows nearly 2x downsampling static const int kNumPhaseBits = 30; Loading