diff options
author | Chris Robinson <[email protected]> | 2010-11-24 20:44:21 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-24 20:44:21 -0800 |
commit | 885a5e9f906cf6c49e7c2688167cbffce74ab61c (patch) | |
tree | e3787c0560f92455acd348c43e59bc5db45c5b32 | |
parent | 22e3e9a18b3f002d406a4f86d4f32d3290a6894f (diff) |
Use 0-based access for the buffer data
-rw-r--r-- | Alc/mixer.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 5c04b55a..1d422da0 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -105,6 +105,8 @@ static void MixMono_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ ALfloat value; \ \ increment = Source->Params.Step; \ + data += *DataPosInt; \ + DataEnd -= *DataPosInt; \ \ DryBuffer = Device->DryBuffer; \ ClickRemoval = Device->ClickRemoval; \ @@ -113,7 +115,7 @@ static void MixMono_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ for(i = 0;i < OUTPUTCHANNELS;i++) \ DrySend[i] = Source->Params.DryGains[i]; \ \ - pos = *DataPosInt; \ + pos = 0; \ frac = *DataPosFrac; \ \ if(j == 0) \ @@ -195,7 +197,7 @@ static void MixMono_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ WetFilter = &Source->Params.Send[out].iirFilter; \ WetSend = Source->Params.Send[out].WetGain; \ \ - pos = *DataPosInt; \ + pos = 0; \ frac = *DataPosFrac; \ j -= BufferSize; \ \ @@ -239,7 +241,7 @@ static void MixMono_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ WetPendingClicks[0] += value*WetSend; \ } \ } \ - *DataPosInt = pos; \ + *DataPosInt += pos; \ *DataPosFrac = frac; \ } @@ -279,6 +281,8 @@ static void MixStereo_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ ALfloat value; \ \ increment = Source->Params.Step; \ + data += *DataPosInt * Channels; \ + DataEnd -= *DataPosInt; \ \ DryBuffer = Device->DryBuffer; \ ClickRemoval = Device->ClickRemoval; \ @@ -287,7 +291,7 @@ static void MixStereo_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ for(i = 0;i < OUTPUTCHANNELS;i++) \ DrySend[i] = Source->Params.DryGains[i]; \ \ - pos = *DataPosInt; \ + pos = 0; \ frac = *DataPosFrac; \ \ if(j == 0) \ @@ -364,7 +368,7 @@ static void MixStereo_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ WetFilter = &Source->Params.Send[out].iirFilter; \ WetSend = Source->Params.Send[out].WetGain; \ \ - pos = *DataPosInt; \ + pos = 0; \ frac = *DataPosFrac; \ j -= BufferSize; \ \ @@ -418,7 +422,7 @@ static void MixStereo_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ } \ } \ } \ - *DataPosInt = pos; \ + *DataPosInt += pos; \ *DataPosFrac = frac; \ } @@ -435,7 +439,6 @@ DECL_MIX_STEREO(ALubyte, lerp8) DECL_MIX_STEREO(ALubyte, cos_lerp8) - #define DECL_MIX_MC(T,chans,sampler) \ static void MixMC_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device,\ const T *data, ALuint *DataPosInt, ALuint *DataPosFrac, ALuint DataEnd, \ @@ -454,6 +457,8 @@ static void MixMC_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device, ALfloat value; \ \ increment = Source->Params.Step; \ + data += *DataPosInt * Channels; \ + DataEnd -= *DataPosInt; \ \ DryBuffer = Device->DryBuffer; \ ClickRemoval = Device->ClickRemoval; \ @@ -462,7 +467,7 @@ static void MixMC_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device, for(i = 0;i < OUTPUTCHANNELS;i++) \ DrySend[i] = Source->Params.DryGains[i]; \ \ - pos = *DataPosInt; \ + pos = 0; \ frac = *DataPosFrac; \ \ if(j == 0) \ @@ -533,7 +538,7 @@ static void MixMC_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device, WetFilter = &Source->Params.Send[out].iirFilter; \ WetSend = Source->Params.Send[out].WetGain; \ \ - pos = *DataPosInt; \ + pos = 0; \ frac = *DataPosFrac; \ j -= BufferSize; \ \ @@ -587,7 +592,7 @@ static void MixMC_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device, } \ } \ } \ - *DataPosInt = pos; \ + *DataPosInt += pos; \ *DataPosFrac = frac; \ } |