summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-12-13 11:52:35 -0800
committerGlenn Kasten <gkasten@google.com>2011-12-16 14:55:05 -0800
commitbf71f1e7948406492376c6cbd5e6a30c8cb670e4 (patch)
tree077a8a894c95655353bd5ffec7c4c93f1d36b9be /services
parentb92bc47a05925c29efef0d66711b6d3f17f406e7 (diff)
downloadframeworks_av-bf71f1e7948406492376c6cbd5e6a30c8cb670e4.zip
frameworks_av-bf71f1e7948406492376c6cbd5e6a30c8cb670e4.tar.gz
frameworks_av-bf71f1e7948406492376c6cbd5e6a30c8cb670e4.tar.bz2
Use constants for 2 and 32
Change-Id: If820dfd58b6df258570750610a07af99598d9e53
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioMixer.cpp6
-rw-r--r--services/audioflinger/AudioMixer.h10
2 files changed, 8 insertions, 8 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 59751ac..e367b54 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 ; i<MAX_NUM_CHANNELS ; i++) {
if (((volumeInc[i]>0) && (((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 288c70e..4ef325f 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;