From bf71f1e7948406492376c6cbd5e6a30c8cb670e4 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Tue, 13 Dec 2011 11:52:35 -0800 Subject: [PATCH] Use constants for 2 and 32 Change-Id: If820dfd58b6df258570750610a07af99598d9e53 --- services/audioflinger/AudioMixer.cpp | 6 +++--- services/audioflinger/AudioMixer.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 59751ac1c0..e367b54a2b 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -57,7 +57,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) mState.resampleTemp = NULL; mState.hook = process__nop; track_t* t = mState.tracks; - for (int i=0 ; i<32 ; i++) { + for (unsigned i=0 ; i < MAX_NUM_TRACKS ; i++) { t->needs = 0; t->volume[0] = UNITY_GAIN; t->volume[1] = UNITY_GAIN; @@ -90,7 +90,7 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) AudioMixer::~AudioMixer() { track_t* t = mState.tracks; - for (int i=0 ; i<32 ; i++) { + for (unsigned i=0 ; i < MAX_NUM_TRACKS ; i++) { delete t->resampler; t++; } @@ -319,7 +319,7 @@ void AudioMixer::track_t::resetResampler() inline void AudioMixer::track_t::adjustVolumeRamp(bool aux) { - for (int i=0 ; i<2 ; i++) { + for (int i=0 ; i0) && (((prevVolume[i]+volumeInc[i])>>16) >= volume[i])) || ((volumeInc[i]<0) && (((prevVolume[i]+volumeInc[i])>>16) <= volume[i]))) { volumeInc[i] = 0; diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h index 288c70e998..4ef325fbef 100644 --- a/services/audioflinger/AudioMixer.h +++ b/services/audioflinger/AudioMixer.h @@ -47,7 +47,7 @@ public: enum { // names - // track units (32 units) + // track units (MAX_NUM_TRACKS units) TRACK0 = 0x1000, // 0x2000 is unused @@ -132,13 +132,13 @@ private: uint32_t needs; union { - int16_t volume[2]; // [0]3.12 fixed point + int16_t volume[MAX_NUM_CHANNELS]; // [0]3.12 fixed point int32_t volumeRL; }; - int32_t prevVolume[2]; + int32_t prevVolume[MAX_NUM_CHANNELS]; - int32_t volumeInc[2]; + int32_t volumeInc[MAX_NUM_CHANNELS]; int32_t auxLevel; int32_t auxInc; int32_t prevAuxLevel; @@ -177,7 +177,7 @@ private: int32_t *outputTemp; int32_t *resampleTemp; int32_t reserved[2]; - track_t tracks[32]; __attribute__((aligned(32))); + track_t tracks[MAX_NUM_TRACKS]; __attribute__((aligned(32))); }; int mActiveTrack; -- 2.11.0