Reuse YaProcessData object on the plugin side

Well, kind of. This doesn't do anything yet since the default assignment
operator will just destroy and recreate objects as normal.
This commit is contained in:
Robbert van der Helm
2021-05-06 16:34:23 +02:00
parent e3f65374f4
commit 6231ab7816
2 changed files with 12 additions and 3 deletions
@@ -186,12 +186,15 @@ Vst3PluginProxyImpl::process(Steinberg::Vst::ProcessData& data) {
last_audio_thread_priority_synchronization = now;
}
// TODO: Check whether reusing a `YaProcessData` object make a difference in
// terms of performance
// TODO: Document
// TODO: Actually repopulate `process_data` with new data, right now this
// assignment just destroys the old object and creates a new object.
process_data = data;
ProcessResponse response =
bridge.send_audio_processor_message(YaAudioProcessor::Process{
.instance_id = instance_id(),
.data = data,
.data = process_data,
.new_realtime_priority = new_realtime_priority});
response.output_data.write_back_outputs(data);
@@ -490,6 +490,12 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
*/
std::atomic_size_t current_context_menu_id;
/**
* We'll reuse this process data object and simply fill the objects
* contained with new data to avoid allocations during audio processing.
*/
YaProcessData process_data;
// Caches
/**