diff options
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 1 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 12 | ||||
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 95 |
3 files changed, 53 insertions, 55 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 05271bc..6868d99 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1467,4 +1467,3 @@ bool audio_track_cblk_t::tryLock() // ------------------------------------------------------------------------- }; // namespace android - diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 1883860..fd82306 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -1973,7 +1973,7 @@ bool AudioFlinger::MixerThread::threadLoop() // during mixing and effect process as the audio buffers could be deleted // or modified if an effect is created or deleted lockEffectChains_l(effectChains); - } + } if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) { // mix buffers... @@ -2018,11 +2018,11 @@ bool AudioFlinger::MixerThread::threadLoop() } // sleepTime == 0 means we must write to audio hardware if (sleepTime == 0) { - for (size_t i = 0; i < effectChains.size(); i ++) { - effectChains[i]->process_l(); - } - // enable changes in effect chain - unlockEffectChains(effectChains); + for (size_t i = 0; i < effectChains.size(); i ++) { + effectChains[i]->process_l(); + } + // enable changes in effect chain + unlockEffectChains(effectChains); mLastWriteTime = systemTime(); mInWrite = true; mBytesWritten += mixBufferSize; diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 63d9a88..847f8dc 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -84,19 +84,19 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) } } - AudioMixer::~AudioMixer() - { - track_t* t = mState.tracks; - for (int i=0 ; i<32 ; i++) { - delete t->resampler; - t++; - } - delete [] mState.outputTemp; - delete [] mState.resampleTemp; - } +AudioMixer::~AudioMixer() +{ + track_t* t = mState.tracks; + for (int i=0 ; i<32 ; i++) { + delete t->resampler; + t++; + } + delete [] mState.outputTemp; + delete [] mState.resampleTemp; +} - int AudioMixer::getTrackName() - { +int AudioMixer::getTrackName() +{ uint32_t names = mTrackNames; uint32_t mask = 1; int n = 0; @@ -110,18 +110,18 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) return TRACK0 + n; } return -1; - } +} - void AudioMixer::invalidateState(uint32_t mask) - { +void AudioMixer::invalidateState(uint32_t mask) +{ if (mask) { mState.needsChanged |= mask; mState.hook = process__validate; } } - void AudioMixer::deleteTrackName(int name) - { +void AudioMixer::deleteTrackName(int name) +{ name -= TRACK0; if (uint32_t(name) < MAX_NUM_TRACKS) { ALOGV("deleteTrackName(%d)", name); @@ -141,7 +141,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) track.volumeInc[1] = 0; mTrackNames &= ~(1<<name); } - } +} status_t AudioMixer::enable(int name) { @@ -456,33 +456,33 @@ void AudioMixer::process__validate(state_t* state) countActiveTracks, state->enabledTracks, all16BitsStereoNoResample, resampling, volumeRamp); - state->hook(state); - - // Now that the volume ramp has been done, set optimal state and - // track hooks for subsequent mixer process - if (countActiveTracks) { - int allMuted = 1; - uint32_t en = state->enabledTracks; - while (en) { - const int i = 31 - __builtin_clz(en); - en &= ~(1<<i); - track_t& t = state->tracks[i]; - if (!t.doesResample() && t.volumeRL == 0) - { - t.needs |= NEEDS_MUTE_ENABLED; - t.hook = track__nop; - } else { - allMuted = 0; - } - } - if (allMuted) { - state->hook = process__nop; - } else if (all16BitsStereoNoResample) { - if (countActiveTracks == 1) { - state->hook = process__OneTrack16BitsStereoNoResampling; - } - } - } + state->hook(state); + + // Now that the volume ramp has been done, set optimal state and + // track hooks for subsequent mixer process + if (countActiveTracks) { + int allMuted = 1; + uint32_t en = state->enabledTracks; + while (en) { + const int i = 31 - __builtin_clz(en); + en &= ~(1<<i); + track_t& t = state->tracks[i]; + if (!t.doesResample() && t.volumeRL == 0) + { + t.needs |= NEEDS_MUTE_ENABLED; + t.hook = track__nop; + } else { + allMuted = 0; + } + } + if (allMuted) { + state->hook = process__nop; + } else if (all16BitsStereoNoResample) { + if (countActiveTracks == 1) { + state->hook = process__OneTrack16BitsStereoNoResampling; + } + } + } } static inline @@ -999,7 +999,7 @@ void AudioMixer::process__genericNoResampling(state_t* state) } - // generic code with resampling +// generic code with resampling void AudioMixer::process__genericResampling(state_t* state) { int32_t* const outTemp = state->outputTemp; @@ -1179,7 +1179,7 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state) } in1 = buff; b1.frameCount = numFrames; - } else { + } else { in1 = b1.i16; } frameCount1 = b1.frameCount; @@ -1221,4 +1221,3 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state) // ---------------------------------------------------------------------------- }; // namespace android - |