From fccd7d5103b897959b5f816aebd9613aee111433 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 12 Feb 2010 18:40:42 +0000 Subject: [PATCH] torben's latest fix for the MTC PiC (adjust catch factor) git-svn-id: svn://localhost/ardour2/branches/3.0@6679 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audioregion.cc | 26 -------------------------- libs/ardour/midi_region.cc | 2 -- libs/ardour/pi_controller.cc | 5 +++-- libs/ardour/region.cc | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index c96f7119b8..d1e78cadd3 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -552,8 +552,6 @@ AudioRegion::state (bool full) char buf2[64]; LocaleGuard lg (X_("POSIX")); - node.add_property ("flags", enum_2_string (_flags)); - snprintf (buf, sizeof(buf), "%.12g", _scale_amplitude); node.add_property ("scale-gain", buf); @@ -646,38 +644,14 @@ AudioRegion::set_live_state (const XMLNode& node, int version, Change& what_chan Region::set_live_state (node, version, what_changed, false); cerr << "After region SLS, wc = " << what_changed << endl; - uint32_t old_flags = _flags; if ((prop = node.property ("flags")) != 0) { - _flags = Flag (string_2_enum (prop->value(), _flags)); - - //_flags = Flag (strtol (prop->value().c_str(), (char **) 0, 16)); - _flags = Flag (_flags & ~Region::LeftOfSplit); _flags = Flag (_flags & ~Region::RightOfSplit); } - /* leave this flag setting in place, no matter what */ - - if ((old_flags & DoNotSendPropertyChanges)) { - _flags = Flag (_flags | DoNotSendPropertyChanges); - } - /* find out if any flags changed that we signal about */ - if ((old_flags ^ _flags) & Muted) { - what_changed = Change (what_changed|MuteChanged); - cerr << _name << " mute changed\n"; - } - if ((old_flags ^ _flags) & Opaque) { - what_changed = Change (what_changed|OpacityChanged); - cerr << _name << " opacity changed\n"; - } - if ((old_flags ^ _flags) & Locked) { - what_changed = Change (what_changed|LockChanged); - cerr << _name << " lock changed\n"; - } - if ((prop = node.property ("scale-gain")) != 0) { float a = atof (prop->value().c_str()); if (a != _scale_amplitude) { diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index bccc32c9cb..0497abdcbb 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -222,8 +222,6 @@ MidiRegion::state (bool full) char buf2[64]; LocaleGuard lg (X_("POSIX")); - node.add_property ("flags", enum_2_string (_flags)); - // XXX these should move into Region for (uint32_t n=0; n < _sources.size(); ++n) { diff --git a/libs/ardour/pi_controller.cc b/libs/ardour/pi_controller.cc index bdf9c27cee..0d9e5b8c37 100644 --- a/libs/ardour/pi_controller.cc +++ b/libs/ardour/pi_controller.cc @@ -59,7 +59,8 @@ double PIController::get_ratio (int fill_level, int period_size) { double offset = fill_level; - double this_catch_factor = catch_factor * 4096.0/(double)period_size; + double this_catch_factor = catch_factor; + double this_catch_factor2 = catch_factor2 * 4096.0/(double)period_size; // Save offset. @@ -96,7 +97,7 @@ PIController::get_ratio (int fill_level, int period_size) // u(t) = K * (e(t) + 1/T \int e(t') dt') // Kp = 1/catch_factor and T = catch_factor2 Ki = Kp/T current_resample_factor - = static_resample_factor - smooth_offset / this_catch_factor - offset_integral / this_catch_factor / catch_factor2; + = static_resample_factor - smooth_offset / this_catch_factor - offset_integral / this_catch_factor / this_catch_factor2; // Now quantize this value around resample_mean, so that the noise which is in the integral component doesnt hurt. current_resample_factor = floor((current_resample_factor - resample_mean) * controlquant + 0.5) / controlquant + resample_mean; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 06437811e7..21721a484a 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1241,8 +1241,29 @@ Region::set_state (const XMLNode& node, int version) _first_edit = EditChangesNothing; + uint32_t old_flags = _flags; + Change what_changed = set_state_using_states (node); + /* leave this flag setting in place, no matter what */ + + if ((old_flags & DoNotSendPropertyChanges)) { + _flags = Flag (_flags | DoNotSendPropertyChanges); + } + + if ((old_flags ^ _flags) & Muted) { + what_changed = Change (what_changed|MuteChanged); + cerr << _name << " mute changed\n"; + } + if ((old_flags ^ _flags) & Opaque) { + what_changed = Change (what_changed|OpacityChanged); + cerr << _name << " opacity changed\n"; + } + if ((old_flags ^ _flags) & Locked) { + what_changed = Change (what_changed|LockChanged); + cerr << _name << " lock changed\n"; + } + set_live_state (node, version, what_changed, true); return 0;