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.
This commit is contained in:
parent
c8d08338df
commit
6877ac820b
@ -228,8 +228,9 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
|
||||
void discover_factory_presets ();
|
||||
|
||||
samplepos_t transport_sample;
|
||||
float transport_speed;
|
||||
float last_transport_speed;
|
||||
float transport_speed;
|
||||
float last_transport_speed;
|
||||
pframes_t preset_holdoff;
|
||||
|
||||
static void _parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 host_time, Float32 new_value);
|
||||
void parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 host_time, Float32 new_value);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user