mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
cellMic: do not copy samples to intermediate buffer unless necessary
This commit is contained in:
parent
80e1b1adf4
commit
1b5ec785f5
1 changed files with 15 additions and 11 deletions
|
@ -583,19 +583,11 @@ void microphone_device::get_data(const u32 num_samples)
|
||||||
{
|
{
|
||||||
ensure(num_samples > 0);
|
ensure(num_samples > 0);
|
||||||
|
|
||||||
u8* tmp_ptr = temp_buf.data();
|
|
||||||
|
|
||||||
switch (device_type)
|
switch (device_type)
|
||||||
{
|
{
|
||||||
case microphone_handler::real_singstar:
|
case microphone_handler::real_singstar:
|
||||||
{
|
{
|
||||||
const usz bufsize = num_samples * sample_size;
|
// Straight copy from device. No need for intermediate buffer.
|
||||||
const mic_device& device = ::at32(devices, 0);
|
|
||||||
ensure(bufsize <= device.buf.size());
|
|
||||||
ensure(bufsize <= temp_buf.size());
|
|
||||||
|
|
||||||
// Straight copy from device
|
|
||||||
std::memcpy(tmp_ptr, device.buf.data(), bufsize);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case microphone_handler::standard:
|
case microphone_handler::standard:
|
||||||
|
@ -607,6 +599,8 @@ void microphone_device::get_data(const u32 num_samples)
|
||||||
ensure(bufsize <= buf.size());
|
ensure(bufsize <= buf.size());
|
||||||
ensure(bufsize <= temp_buf.size());
|
ensure(bufsize <= temp_buf.size());
|
||||||
|
|
||||||
|
u8* tmp_ptr = temp_buf.data();
|
||||||
|
|
||||||
// BE Translation
|
// BE Translation
|
||||||
for (u32 index = 0; index < bufsize; index += channel_size)
|
for (u32 index = 0; index < bufsize; index += channel_size)
|
||||||
{
|
{
|
||||||
|
@ -623,6 +617,8 @@ void microphone_device::get_data(const u32 num_samples)
|
||||||
const std::vector<u8>& buf_0 = ::at32(devices, 0).buf;
|
const std::vector<u8>& buf_0 = ::at32(devices, 0).buf;
|
||||||
ensure(bufsize <= buf_0.size());
|
ensure(bufsize <= buf_0.size());
|
||||||
|
|
||||||
|
u8* tmp_ptr = temp_buf.data();
|
||||||
|
|
||||||
// Mixing the 2 mics into the 2 destination channels
|
// Mixing the 2 mics into the 2 destination channels
|
||||||
if (devices.size() == 2)
|
if (devices.size() == 2)
|
||||||
{
|
{
|
||||||
|
@ -667,7 +663,11 @@ void microphone_device::get_raw(const u32 num_samples)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rbuf_raw.write_bytes(temp_buf.data(), num_samples * sample_size);
|
const std::vector<u8>& buf = device_type == microphone_handler::real_singstar ? ::at32(devices, 0).buf : temp_buf;
|
||||||
|
const u32 bufsize = num_samples * sample_size;
|
||||||
|
ensure(bufsize <= buf.size());
|
||||||
|
|
||||||
|
rbuf_raw.write_bytes(buf.data(), bufsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void microphone_device::get_dsp(const u32 num_samples)
|
void microphone_device::get_dsp(const u32 num_samples)
|
||||||
|
@ -677,7 +677,11 @@ void microphone_device::get_dsp(const u32 num_samples)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rbuf_dsp.write_bytes(temp_buf.data(), num_samples * sample_size);
|
const std::vector<u8>& buf = device_type == microphone_handler::real_singstar ? ::at32(devices, 0).buf : temp_buf;
|
||||||
|
const u32 bufsize = num_samples * sample_size;
|
||||||
|
ensure(bufsize <= buf.size());
|
||||||
|
|
||||||
|
rbuf_dsp.write_bytes(buf.data(), bufsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialization/Shutdown Functions
|
/// Initialization/Shutdown Functions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue