aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-05-24 21:51:30 -0700
committerChris Robinson <[email protected]>2010-05-24 21:51:30 -0700
commit37190b2cafdec52a23034194a3e63d8d33bdc544 (patch)
tree99dada718dcb76d94223b62392f0181b5a3314ba /Alc
parentc6b948323ebc8632e0b763f090cdcd19255d0ac2 (diff)
Add a function to get the frame size from a format
Diffstat (limited to 'Alc')
-rw-r--r--Alc/alsa.c3
-rw-r--r--Alc/dsound.c5
-rw-r--r--Alc/oss.c6
-rw-r--r--Alc/portaudio.c3
-rw-r--r--Alc/pulseaudio.c6
-rw-r--r--Alc/solaris.c3
-rw-r--r--Alc/wave.c3
-rw-r--r--Alc/winmm.c6
8 files changed, 12 insertions, 23 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index eadafee8..4cf0a9c9 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -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);
diff --git a/Alc/oss.c b/Alc/oss.c
index 5fee7734..fe339305 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -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)
{
diff --git a/Alc/wave.c b/Alc/wave.c
index 4ed120bb..62c3ffc2 100644
--- a/Alc/wave.c
+++ b/Alc/wave.c
@@ -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);
}