Use constants for 2 and 32
Change-Id: If820dfd58b6df258570750610a07af99598d9e53
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 @@
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()
{
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 @@
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 @@
enum { // names
- // track units (32 units)
+ // track units (MAX_NUM_TRACKS units)
TRACK0 = 0x1000,
// 0x2000 is unused
@@ -132,13 +132,13 @@
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 @@
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;