diff options
author | Chris Robinson <[email protected]> | 2011-08-16 18:33:10 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-16 18:33:10 -0700 |
commit | 04dad28228a694e681d722826615245466a3aa16 (patch) | |
tree | 54860fb951339bb4af88df4c620383323427a5fd /Alc | |
parent | a96f8177387818d3ef69778e3f78a9ed251326c1 (diff) |
Use mini/maxi/clampi and minu/maxu/clampu to replace min/max calls
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 6 | ||||
-rw-r--r-- | Alc/hrtf.c | 2 | ||||
-rw-r--r-- | Alc/mixer.c | 20 | ||||
-rw-r--r-- | Alc/mmdevapi.c | 2 | ||||
-rw-r--r-- | Alc/pulseaudio.c | 2 |
5 files changed, 16 insertions, 16 deletions
@@ -152,7 +152,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->SampleSize; maxstep -= ResamplerPadding[ALSource->Resampler] + ResamplerPrePadding[ALSource->Resampler] + 1; - maxstep = min(maxstep, INT_MAX>>FRACTIONBITS); + maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS); Pitch = Pitch * ALBuffer->Frequency / Frequency; if(Pitch > (ALfloat)maxstep) @@ -677,7 +677,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALSource->SampleSize; maxstep -= ResamplerPadding[ALSource->Resampler] + ResamplerPrePadding[ALSource->Resampler] + 1; - maxstep = min(maxstep, INT_MAX>>FRACTIONBITS); + maxstep = mini(maxstep, INT_MAX>>FRACTIONBITS); Pitch = Pitch * ALBuffer->Frequency / Frequency; if(Pitch > (ALfloat)maxstep) @@ -975,7 +975,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) while(size > 0) { /* Setup variables */ - SamplesToDo = min(size, BUFFERSIZE); + SamplesToDo = minu(size, BUFFERSIZE); /* Clear mixing buffer */ memset(device->DryBuffer, 0, SamplesToDo*MAXCHANNELS*sizeof(ALfloat)); @@ -65,7 +65,7 @@ static void CalcEvIndices(ALfloat ev, ALuint *evidx, ALfloat *evmu) { ev = (M_PI/2.0f + ev) * (ELEV_COUNT-1) / M_PI; evidx[0] = (ALuint)ev; - evidx[1] = minF(evidx[0] + 1, ELEV_COUNT-1); + evidx[1] = minu(evidx[0] + 1, ELEV_COUNT-1); *evmu = ev - evidx[0]; } diff --git a/Alc/mixer.c b/Alc/mixer.c index d3f22b51..b589593f 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -150,7 +150,7 @@ static void Mix_Hrtf_##T##_##sampler(ALsource *Source, ALCdevice *Device, \ ALuint *RESTRICT TargetDelay = Source->Params.HrtfDelay[i]; \ ALfloat *RESTRICT History = Source->HrtfHistory[i]; \ ALfloat (*RESTRICT Values)[2] = Source->HrtfValues[i]; \ - ALint Counter = __max(Source->HrtfCounter, OutPos) - OutPos; \ + ALint Counter = maxu(Source->HrtfCounter, OutPos) - OutPos; \ ALuint Offset = Source->HrtfOffset + OutPos; \ ALfloat Coeffs[HRIR_LENGTH][2]; \ ALuint Delay[2]; \ @@ -612,7 +612,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) else { DataSize = (BufferPrePadding-DataPosInt)*FrameSize; - DataSize = min(BufferSize, DataSize); + DataSize = minu(BufferSize, DataSize); memset(&SrcData[SrcDataSize], 0, DataSize); SrcDataSize += DataSize; @@ -624,7 +624,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) /* Copy what's left to play in the source buffer, and clear the * rest of the temp buffer */ DataSize = ALBuffer->size - pos; - DataSize = min(BufferSize, DataSize); + DataSize = minu(BufferSize, DataSize); memcpy(&SrcData[SrcDataSize], &Data[pos], DataSize); SrcDataSize += DataSize; @@ -653,7 +653,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) else { DataSize = (BufferPrePadding-DataPosInt)*FrameSize; - DataSize = min(BufferSize, DataSize); + DataSize = minu(BufferSize, DataSize); memset(&SrcData[SrcDataSize], 0, DataSize); SrcDataSize += DataSize; @@ -665,7 +665,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) /* Copy what's left of this loop iteration, then copy repeats * of the loop section */ DataSize = LoopEnd*FrameSize - pos; - DataSize = min(BufferSize, DataSize); + DataSize = minu(BufferSize, DataSize); memcpy(&SrcData[SrcDataSize], &Data[pos], DataSize); SrcDataSize += DataSize; @@ -674,7 +674,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) DataSize = (LoopEnd-LoopStart) * FrameSize; while(BufferSize > 0) { - DataSize = min(BufferSize, DataSize); + DataSize = minu(BufferSize, DataSize); memcpy(&SrcData[SrcDataSize], &Data[LoopStart*FrameSize], DataSize); SrcDataSize += DataSize; @@ -697,7 +697,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) { if(!BufferListIter->prev && !Looping) { - ALuint DataSize = min(BufferSize, pos); + ALuint DataSize = minu(BufferSize, pos); memset(&SrcData[SrcDataSize], 0, DataSize); SrcDataSize += DataSize; @@ -744,7 +744,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) DataSize -= pos; pos -= pos; - DataSize = min(BufferSize, DataSize); + DataSize = minu(BufferSize, DataSize); memcpy(&SrcData[SrcDataSize], Data, DataSize); SrcDataSize += DataSize; BufferSize -= DataSize; @@ -770,7 +770,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) DataSize64 -= DataPosFrac; BufferSize = (ALuint)((DataSize64+(increment-1)) / increment); - BufferSize = min(BufferSize, (SamplesToDo-OutPos)); + BufferSize = minu(BufferSize, (SamplesToDo-OutPos)); SrcData += BufferPrePadding*FrameSize; Source->Params.DoMix(Source, Device, SrcData, &DataPosInt, &DataPosFrac, @@ -837,7 +837,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) Source->HrtfOffset += OutPos; if(State == AL_PLAYING) { - Source->HrtfCounter = __max(Source->HrtfCounter, OutPos) - OutPos; + Source->HrtfCounter = maxu(Source->HrtfCounter, OutPos) - OutPos; Source->HrtfMoving = AL_TRUE; } else diff --git a/Alc/mmdevapi.c b/Alc/mmdevapi.c index d7d85a20..ba5a36d6 100644 --- a/Alc/mmdevapi.c +++ b/Alc/mmdevapi.c @@ -431,7 +431,7 @@ static HRESULT DoReset(ALCdevice *device) device->NumUpdates = (device->NumUpdates*device->UpdateSize + min_len/2) / min_len; - device->NumUpdates = __max(device->NumUpdates, 2); + device->NumUpdates = maxu(device->NumUpdates, 2); device->UpdateSize = min_len; hr = IAudioClient_Initialize(data->client, AUDCLNT_SHAREMODE_SHARED, diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index c3561bed..5900d728 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -1121,7 +1121,7 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na data->attr.prebuf = -1; data->attr.maxlength = data->samples * data->frame_size; data->attr.tlength = -1; - data->attr.fragsize = min(data->samples, 50 * device->Frequency / 1000) * + data->attr.fragsize = minu(data->samples, 50*device->Frequency/1000) * data->frame_size; data->spec.rate = device->Frequency; |