aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c3
-rw-r--r--Alc/alsa.c14
-rw-r--r--Alc/dsound.c5
-rw-r--r--Alc/oss.c10
-rw-r--r--Alc/portaudio.c5
-rw-r--r--Alc/pulseaudio.c13
-rw-r--r--Alc/wave.c5
-rw-r--r--Alc/winmm.c8
-rw-r--r--OpenAL32/Include/alMain.h4
9 files changed, 27 insertions, 40 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 042724eb..fbabe468 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -541,12 +541,13 @@ ALCAPI ALCdevice* ALCAPIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, AL
pDevice->Frequency = frequency;
pDevice->Format = format;
+ pDevice->BufferSize = SampleSize;
SuspendContext(NULL);
for(i = 0;BackendList[i].Init;i++)
{
pDevice->Funcs = &BackendList[i].Funcs;
- if(ALCdevice_OpenCapture(pDevice, deviceName, frequency, format, SampleSize))
+ if(ALCdevice_OpenCapture(pDevice, deviceName))
{
pDevice->next = g_pDeviceList;
g_pDeviceList = pDevice;
diff --git a/Alc/alsa.c b/Alc/alsa.c
index 9b47b7e0..2e33dd3f 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -549,7 +549,7 @@ static void alsa_stop_context(ALCdevice *device, ALCcontext *context)
}
-static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
+static ALCboolean alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
{
snd_pcm_hw_params_t *p;
snd_pcm_uframes_t bufferSizeInFrames;
@@ -608,7 +608,7 @@ open_alsa:
return ALC_FALSE;
}
- switch(aluBytesFromFormat(format))
+ switch(aluBytesFromFormat(pDevice->Format))
{
case 1:
data->format = SND_PCM_FORMAT_U8;
@@ -618,7 +618,7 @@ open_alsa:
break;
default:
data->format = SND_PCM_FORMAT_UNKNOWN;
- AL_PRINT("Unknown format?! %x\n", format);
+ AL_PRINT("Unknown format?! %x\n", pDevice->Format);
}
str = GetConfigValue("alsa", "mmap", "true");
@@ -628,7 +628,7 @@ open_alsa:
atoi(str) != 0);
err = NULL;
- bufferSizeInFrames = SampleSize;
+ bufferSizeInFrames = pDevice->BufferSize;
psnd_pcm_hw_params_malloc(&p);
if(!allowmmap)
@@ -648,7 +648,7 @@ open_alsa:
if(err == NULL && (i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, aluChannelsFromFormat(pDevice->Format))) < 0)
err = "set channels";
/* set rate (implicitly constrains period/buffer parameters) */
- if(err == NULL && (i=psnd_pcm_hw_params_set_rate(data->pcmHandle, p, frequency, 0)) < 0)
+ if(err == NULL && (i=psnd_pcm_hw_params_set_rate(data->pcmHandle, p, pDevice->Frequency, 0)) < 0)
err = "set rate near";
/* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
if(err == NULL && (i=psnd_pcm_hw_params_set_buffer_size_min(data->pcmHandle, p, &bufferSizeInFrames)) < 0)
@@ -674,7 +674,7 @@ open_alsa:
if(err == NULL && (i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, aluChannelsFromFormat(pDevice->Format))) < 0)
err = "set channels";
/* set rate (implicitly constrains period/buffer parameters) */
- if(err == NULL && (i=psnd_pcm_hw_params_set_rate(data->pcmHandle, p, frequency, 0)) < 0)
+ if(err == NULL && (i=psnd_pcm_hw_params_set_rate(data->pcmHandle, p, pDevice->Frequency, 0)) < 0)
err = "set rate near";
/* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */
if(err == NULL && (i=psnd_pcm_hw_params_set_buffer_size_near(data->pcmHandle, p, &bufferSizeInFrames)) < 0)
@@ -716,7 +716,7 @@ open_alsa:
ALuint frameSize = aluChannelsFromFormat(pDevice->Format);
frameSize *= aluBytesFromFormat(pDevice->Format);
- data->ring = CreateRingBuffer(frameSize, SampleSize);
+ data->ring = CreateRingBuffer(frameSize, pDevice->BufferSize);
if(!data->ring)
{
AL_PRINT("ring buffer create failed\n");
diff --git a/Alc/dsound.c b/Alc/dsound.c
index 34f42101..b840e04b 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -382,13 +382,10 @@ static void DSoundStopContext(ALCdevice *device, ALCcontext *context)
}
-static ALCboolean DSoundOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
+static ALCboolean DSoundOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
{
(void)pDevice;
(void)deviceName;
- (void)frequency;
- (void)format;
- (void)SampleSize;
return ALC_FALSE;
}
diff --git a/Alc/oss.c b/Alc/oss.c
index 3a8c0ed1..75710492 100644
--- a/Alc/oss.c
+++ b/Alc/oss.c
@@ -284,7 +284,7 @@ static void oss_stop_context(ALCdevice *device, ALCcontext *context)
}
-static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
+static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
{
int numFragmentsLogSize;
int log2FragmentSize;
@@ -321,7 +321,7 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName,
return ALC_FALSE;
}
- switch(aluBytesFromFormat(format))
+ switch(aluBytesFromFormat(device->Format))
{
case 1:
ossFormat = AFMT_U8;
@@ -337,8 +337,8 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName,
periods = 4;
numChannels = aluChannelsFromFormat(device->Format);
frameSize = numChannels * aluBytesFromFormat(device->Format);
- ossSpeed = frequency;
- log2FragmentSize = log2i(SampleSize * frameSize / periods);
+ ossSpeed = device->Frequency;
+ log2FragmentSize = log2i(device->BufferSize * frameSize / periods);
/* according to the OSS spec, 16 bytes are the minimum */
if (log2FragmentSize < 4)
@@ -376,7 +376,7 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName,
return ALC_FALSE;
}
- data->ring = CreateRingBuffer(frameSize, SampleSize);
+ data->ring = CreateRingBuffer(frameSize, device->BufferSize);
if(!data->ring)
{
AL_PRINT("ring buffer create failed\n");
diff --git a/Alc/portaudio.c b/Alc/portaudio.c
index 0b84d0b1..cfd35b56 100644
--- a/Alc/portaudio.c
+++ b/Alc/portaudio.c
@@ -174,14 +174,11 @@ static void pa_stop_context(ALCdevice *device, ALCcontext *context)
}
-static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
+static ALCboolean pa_open_capture(ALCdevice *device, const ALCchar *deviceName)
{
return ALC_FALSE;
(void)device;
(void)deviceName;
- (void)frequency;
- (void)format;
- (void)SampleSize;
}
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index 89f47fba..a9fcb3df 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -201,12 +201,12 @@ static void stream_read_callback(pa_stream *stream, size_t length, void *pdata)
} //}}}
//}}}
-static ALCboolean pulse_open(ALCdevice *device, ALCchar *device_name, ALCuint samples) //{{{
+static ALCboolean pulse_open(ALCdevice *device, ALCchar *device_name) //{{{
{
pulse_data *data = ppa_xmalloc0(sizeof(pulse_data));
data->device = device;
- data->samples = samples;
+ data->samples = device->BufferSize;
data->frame_size = aluBytesFromFormat(device->Format) *
aluChannelsFromFormat(device->Format);
@@ -337,7 +337,7 @@ static ALCboolean pulse_open_playback(ALCdevice *device, const ALCchar *device_n
return ALC_FALSE;
}
- return pulse_open(device, pulse_device, 0);
+ return pulse_open(device, pulse_device);
} //}}}
static void pulse_close_playback(ALCdevice *device) //{{{
@@ -450,7 +450,7 @@ static void pulse_stop_context(ALCdevice *device, ALCcontext *context) //{{{
} //}}}
-static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_name, ALCuint frequency, ALCenum format, ALCsizei samples) //{{{
+static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_name) //{{{
{
pulse_data *data;
@@ -463,10 +463,7 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
return ALC_FALSE;
}
- assert(device->Format == format);
- assert(device->Frequency == frequency);
-
- if(pulse_open(device, pulse_capture_device, samples) == ALC_FALSE)
+ if(pulse_open(device, pulse_capture_device) == ALC_FALSE)
return ALC_FALSE;
data = device->ExtraData;
diff --git a/Alc/wave.c b/Alc/wave.c
index 6074f241..d63d3b5c 100644
--- a/Alc/wave.c
+++ b/Alc/wave.c
@@ -313,13 +313,10 @@ static void wave_stop_context(ALCdevice *device, ALCcontext *Context)
}
-static ALCboolean wave_open_capture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
+static ALCboolean wave_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
{
(void)pDevice;
(void)deviceName;
- (void)frequency;
- (void)format;
- (void)SampleSize;
return ALC_FALSE;
}
diff --git a/Alc/winmm.c b/Alc/winmm.c
index ea97b695..5365cbc7 100644
--- a/Alc/winmm.c
+++ b/Alc/winmm.c
@@ -175,7 +175,7 @@ static void WinMMClosePlayback(ALCdevice *device)
}
-static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize)
+static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
{
WAVEFORMATEX wfexCaptureFormat;
WinMMData *pData = NULL;
@@ -183,8 +183,6 @@ static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName
ALint lBufferSize;
ALint i;
- (void)format;
-
// Find the Device ID matching the deviceName if valid
if (deviceName)
{
@@ -214,7 +212,7 @@ static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName
wfexCaptureFormat.wBitsPerSample = aluBytesFromFormat(pDevice->Format) * 8;
wfexCaptureFormat.nBlockAlign = wfexCaptureFormat.wBitsPerSample *
wfexCaptureFormat.nChannels / 8;
- wfexCaptureFormat.nSamplesPerSec = frequency;
+ wfexCaptureFormat.nSamplesPerSec = pDevice->Frequency;
wfexCaptureFormat.nAvgBytesPerSec = wfexCaptureFormat.nSamplesPerSec *
wfexCaptureFormat.nBlockAlign;
wfexCaptureFormat.cbSize = 0;
@@ -231,7 +229,7 @@ static ALCboolean WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName
goto failure;
// Allocate circular memory buffer for the captured audio
- pData->ulCapturedDataSize = SampleSize * wfexCaptureFormat.nBlockAlign;
+ pData->ulCapturedDataSize = pDevice->BufferSize * wfexCaptureFormat.nBlockAlign;
// Make sure circular buffer is at least 100ms in size (and an exact multiple of
// the block alignment
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 3199d54c..e3823364 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -151,7 +151,7 @@ typedef struct {
ALCboolean (*StartContext)(ALCdevice*, ALCcontext*);
void (*StopContext)(ALCdevice*, ALCcontext*);
- ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*, ALCuint, ALCenum, ALCsizei);
+ ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*);
void (*CloseCapture)(ALCdevice*);
void (*StartCapture)(ALCdevice*);
void (*StopCapture)(ALCdevice*);
@@ -202,7 +202,7 @@ struct ALCdevice_struct
#define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
#define ALCdevice_StartContext(a,b) ((a)->Funcs->StartContext((a), (b)))
#define ALCdevice_StopContext(a,b) ((a)->Funcs->StopContext((a), (b)))
-#define ALCdevice_OpenCapture(a,b,c,d,e) ((a)->Funcs->OpenCapture((a), (b), (c), (d), (e)))
+#define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
#define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
#define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
#define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))