mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
cellMic: skip alcCaptureSamples loop if num_samples is 0
Also use early out instead of ensure in get_data
This commit is contained in:
parent
9505f8116b
commit
a5f9256ac6
1 changed files with 11 additions and 1 deletions
|
@ -561,14 +561,21 @@ u32 microphone_device::capture_audio()
|
|||
{
|
||||
ALCint samples_in = 0;
|
||||
alcGetIntegerv(micdevice.device, ALC_CAPTURE_SAMPLES, 1, &samples_in);
|
||||
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error getting number of captured samples of device %s (error=0x%x)", micdevice.name, err);
|
||||
return CELL_MICIN_ERROR_FATAL;
|
||||
}
|
||||
|
||||
num_samples = std::min<u32>(num_samples, samples_in);
|
||||
}
|
||||
|
||||
if (num_samples == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (mic_device& micdevice : devices)
|
||||
{
|
||||
alcCaptureSamples(micdevice.device, micdevice.buf.data(), num_samples);
|
||||
|
@ -586,7 +593,10 @@ u32 microphone_device::capture_audio()
|
|||
|
||||
void microphone_device::get_data(const u32 num_samples)
|
||||
{
|
||||
ensure(num_samples > 0);
|
||||
if (num_samples == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (device_type)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue