Remove unnecessary function parameters
This commit is contained in:
@@ -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;
|
||||
|
||||
+7
-7
@@ -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");
|
||||
|
||||
+1
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
+1
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-8
@@ -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;
|
||||
|
||||
+1
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -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
|
||||
|
||||
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user