diff options
-rw-r--r-- | Alc/alsa.c | 3 | ||||
-rw-r--r-- | Alc/dsound.c | 5 | ||||
-rw-r--r-- | Alc/oss.c | 6 | ||||
-rw-r--r-- | Alc/portaudio.c | 3 | ||||
-rw-r--r-- | Alc/pulseaudio.c | 6 | ||||
-rw-r--r-- | Alc/solaris.c | 3 | ||||
-rw-r--r-- | Alc/wave.c | 3 | ||||
-rw-r--r-- | Alc/winmm.c | 6 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 4 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 3 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 3 |
11 files changed, 18 insertions, 27 deletions
@@ -947,8 +947,7 @@ static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceNam psnd_pcm_hw_params_free(p); - frameSize = aluChannelsFromFormat(pDevice->Format); - frameSize *= aluBytesFromFormat(pDevice->Format); + frameSize = aluFrameSizeFromFormat(pDevice->Format); data->ring = CreateRingBuffer(frameSize, pDevice->UpdateSize*pDevice->NumUpdates); if(!data->ring) diff --git a/Alc/dsound.c b/Alc/dsound.c index c6083d5b..3ce45874 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -175,8 +175,7 @@ static ALuint DSoundProc(ALvoid *ptr) return 1; } - FrameSize = aluChannelsFromFormat(pDevice->Format) * - aluBytesFromFormat(pDevice->Format); + FrameSize = aluFrameSizeFromFormat(pDevice->Format); FragSize = pDevice->UpdateSize * FrameSize; IDirectSoundBuffer_GetCurrentPosition(pData->DSsbuffer, &LastCursor, NULL); @@ -406,7 +405,7 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device) } else format = device->Format; - frameSize = aluBytesFromFormat(format) * aluChannelsFromFormat(format); + frameSize = aluFrameSizeFromFormat(format); OutputType.Format.wFormatTag = WAVE_FORMAT_PCM; OutputType.Format.nChannels = aluChannelsFromFormat(format); @@ -84,8 +84,7 @@ static ALuint OSSProc(ALvoid *ptr) SetRTPriority(); - frameSize = aluChannelsFromFormat(pDevice->Format) * - aluBytesFromFormat(pDevice->Format); + frameSize = aluFrameSizeFromFormat(pDevice->Format); while(!data->killNow && pDevice->Connected) { @@ -126,8 +125,7 @@ static ALuint OSSCaptureProc(ALvoid *ptr) SetRTPriority(); - frameSize = aluBytesFromFormat(pDevice->Format); - frameSize *= aluChannelsFromFormat(pDevice->Format); + frameSize = aluFrameSizeFromFormat(pDevice->Format); while(!data->killNow) { diff --git a/Alc/portaudio.c b/Alc/portaudio.c index a06aa4dc..e54abec7 100644 --- a/Alc/portaudio.c +++ b/Alc/portaudio.c @@ -316,8 +316,7 @@ static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName) return ALC_FALSE; } - frame_size = aluChannelsFromFormat(device->Format) * - aluBytesFromFormat(device->Format); + frame_size = aluFrameSizeFromFormat(device->Format); data->ring = CreateRingBuffer(frame_size, device->UpdateSize*device->NumUpdates); if(data->ring == NULL) { diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 6c611b5a..b2c73e7b 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -621,8 +621,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{ if(!ConfigValueExists(NULL, "frequency")) flags |= PA_STREAM_FIX_RATE; - data->frame_size = aluBytesFromFormat(device->Format) * - aluChannelsFromFormat(device->Format); + data->frame_size = aluFrameSizeFromFormat(device->Format); data->stream_name = "Playback Stream"; data->attr.minreq = -1; data->attr.prebuf = -1; @@ -783,8 +782,7 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na ppa_threaded_mainloop_lock(data->loop); data->samples = device->UpdateSize * device->NumUpdates; - data->frame_size = aluBytesFromFormat(device->Format) * - aluChannelsFromFormat(device->Format); + data->frame_size = aluFrameSizeFromFormat(device->Format); if(!(data->ring = CreateRingBuffer(data->frame_size, data->samples))) { diff --git a/Alc/solaris.c b/Alc/solaris.c index 08ebdb4c..50c16a06 100644 --- a/Alc/solaris.c +++ b/Alc/solaris.c @@ -59,8 +59,7 @@ static ALuint SolarisProc(ALvoid *ptr) SetRTPriority(); - frameSize = aluChannelsFromFormat(pDevice->Format) * - aluBytesFromFormat(pDevice->Format); + frameSize = aluFrameSizeFromFormat(pDevice->Format); while(!data->killNow && pDevice->Connected) { @@ -77,8 +77,7 @@ static ALuint WaveProc(ALvoid *ptr) } uSB; uSB.s = 1; - frameSize = aluBytesFromFormat(pDevice->Format) * - aluChannelsFromFormat(pDevice->Format); + frameSize = aluFrameSizeFromFormat(pDevice->Format); last = timeGetTime()<<8; while(!data->killNow && pDevice->Connected) diff --git a/Alc/winmm.c b/Alc/winmm.c index 8f27519e..d20a0fb8 100644 --- a/Alc/winmm.c +++ b/Alc/winmm.c @@ -402,8 +402,7 @@ static void WinMMCaptureSamples(ALCdevice *pDevice, ALCvoid *pBuffer, ALCuint lS ALuint ulBytes, ulBytesToCopy; ALuint ulCapturedSamples; ALuint ulReadOffset; - ALuint frameSize = aluBytesFromFormat(pDevice->Format) * - aluChannelsFromFormat(pDevice->Format); + ALuint frameSize = aluFrameSizeFromFormat(pDevice->Format); // Check that we have the requested numbers of Samples ulCapturedSamples = (pData->ulWriteCapturedDataPos - @@ -444,8 +443,7 @@ static ALCuint WinMMAvailableSamples(ALCdevice *pDevice) { WinMMData *pData = (WinMMData*)pDevice->ExtraData; ALCuint lCapturedBytes = (pData->ulWriteCapturedDataPos - pData->ulReadCapturedDataPos); - return lCapturedBytes / (aluBytesFromFormat(pDevice->Format) * - aluChannelsFromFormat(pDevice->Format)); + return lCapturedBytes / aluFrameSizeFromFormat(pDevice->Format); } diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 57afe6c4..55ddbaf6 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -158,6 +158,10 @@ static __inline ALuint aluChannelsFromFormat(ALenum format) return 0; } } +static __inline ALuint aluFrameSizeFromFormat(ALenum format) +{ + return aluBytesFromFormat(format) * aluChannelsFromFormat(format); +} static __inline ALint aluCart2LUTpos(ALfloat re, ALfloat im) { diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 72af95f0..81e17c52 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -838,8 +838,7 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum eParam, const ALint* pl alSetError(pContext, AL_INVALID_VALUE); else { - ALint maxlen = ALBuf->size / aluBytesFromFormat(ALBuf->format) / - aluChannelsFromFormat(ALBuf->format); + ALint maxlen = ALBuf->size / aluFrameSizeFromFormat(ALBuf->format); if(plValues[0] > maxlen || plValues[1] > maxlen) alSetError(pContext, AL_INVALID_VALUE); else diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 066e7f72..d470f027 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1937,8 +1937,7 @@ static ALboolean ApplyOffset(ALsource *Source) // SW Mixer Positions are in Samples Source->position = (lByteOffset - lTotalBufferSize) / - aluBytesFromFormat(Buffer->format) / - aluChannelsFromFormat(Buffer->format); + aluFrameSizeFromFormat(Buffer->format); return AL_TRUE; } |