13
0

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
This commit is contained in:
Paul Davis 2010-02-12 18:40:42 +00:00
parent a1e0dc13df
commit fccd7d5103
4 changed files with 24 additions and 30 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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;