diff options
author | 2020-09-17 13:45:13 -0700 | |
---|---|---|
committer | 2020-09-17 13:45:13 -0700 | |
commit | aba8c220e89e5563c21aac3548a810adcdbfb71b (patch) | |
tree | e8d8408fbfe3fa93ca24642ab689fb2f3ea2cd88 /src/emu/disound.cpp | |
parent | ec742d3eda78e2fefd01b69a9f10ae1939422d16 (diff) |
sound: Some optimizations for common cases
* Reuse resamplers if routing the same output to multiple targets at the same rate
* Avoid copying when there's only one stream going through a mixer
Diffstat (limited to 'src/emu/disound.cpp')
-rw-r--r-- | src/emu/disound.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index 29d8b4e13b5..d2c063ff205 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -497,6 +497,13 @@ void device_mixer_interface::interface_post_load() void device_mixer_interface::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + // special case: single input, single output, same rate + if (inputs.size() == 1 && outputs.size() == 1 && inputs[0].sample_rate() == outputs[0].sample_rate()) + { + outputs[0] = inputs[0]; + return; + } + // reset the clear flags std::fill(std::begin(m_output_clear), std::end(m_output_clear), false); |