summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_unit.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-12-02 02:04:21 +0100
committerRobin Gareus <robin@gareus.org>2018-12-02 02:04:21 +0100
commit6877ac820b149fab1cae75633a5efd6dab5adb47 (patch)
tree05b956262fb4261262eca7304877052af78077e5 /libs/ardour/audio_unit.cc
parentc8d08338df37a30a30ab2064f31e893f08d452dd (diff)
Don't invalidate AU preset on load
This works around async parameter-changed signal emission when loading an AU preset. A simple timeout is used to delay making the preset as modified.
Diffstat (limited to 'libs/ardour/audio_unit.cc')
-rw-r--r--libs/ardour/audio_unit.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 812d004e6a..559961b0b2 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -452,6 +452,7 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
, transport_sample (0)
, transport_speed (0)
, last_transport_speed (0.0)
+ , preset_holdoff (0)
{
if (!preset_search_path_initialized) {
Glib::ustring p = Glib::get_home_dir();
@@ -493,6 +494,7 @@ AUPlugin::AUPlugin (const AUPlugin& other)
, transport_sample (0)
, transport_speed (0)
, last_transport_speed (0.0)
+ , preset_holdoff (0)
{
init ();
@@ -1651,6 +1653,10 @@ AUPlugin::connect_and_run (BufferSet& bufs,
AudioTimeStamp ts;
OSErr err;
+ if (preset_holdoff > 0) {
+ preset_holdoff -= std::min (nframes, preset_holdoff);
+ }
+
if (requires_fixed_size_buffers() && (nframes != _last_nframes)) {
unit->GlobalReset();
_last_nframes = nframes;
@@ -2215,6 +2221,9 @@ AUPlugin::load_preset (PresetRecord r)
AUParameterListenerNotify (NULL, NULL, &changedUnit);
}
}
+ if (ret) {
+ preset_holdoff = std::max (_session.get_block_size() * 2.0, _session.sample_rate() * .2);
+ }
return ret && Plugin::load_preset (r);
}
@@ -3500,7 +3509,11 @@ AUPlugin::parameter_change_listener (void* /*arg*/, void* src, const AudioUnitEv
/* whenever we change a parameter, we request that we are NOT notified of the change, so anytime we arrive here, it
means that something else (i.e. the plugin GUI) made the change.
*/
- Plugin::parameter_changed_externally (i->second, new_value);
+ if (preset_holdoff > 0) {
+ ParameterChangedExternally (i->second, new_value);
+ } else {
+ Plugin::parameter_changed_externally (i->second, new_value);
+ }
break;
default:
break;