/* read or write masters lock must be held */
if (_masters.empty()) {
- return Control::get_double (false, _session.transport_frame());
+ return Control::get_double (false, _session.transport_sample());
}
if (_desc.toggled) {
* enabled, this slave is enabled. So check our own value
* first, because if we are enabled, we can return immediately.
*/
- if (Control::get_double (false, _session.transport_frame())) {
+ if (Control::get_double (false, _session.transport_sample())) {
return _desc.upper;
}
}
}
return get_value_locked ();
} else {
- return Control::get_double (true, _session.transport_frame()) * get_masters_value_locked();
+ return Control::get_double (true, _session.transport_sample()) * get_masters_value_locked();
}
}
bool
-SlavableAutomationControl::get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const
+SlavableAutomationControl::get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const
{
/* Every AutomationControl needs to implement this as-needed.
*
}
bool
-SlavableAutomationControl::masters_curve_multiply (framepos_t start, framepos_t end, float* vec, framecnt_t veclen) const
+SlavableAutomationControl::masters_curve_multiply (samplepos_t start, samplepos_t end, float* vec, samplecnt_t veclen) const
{
gain_t* scratch = _session.scratch_automation_buffer ();
bool from_list = _list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_playback();
bool rv = from_list && list()->curve().rt_safe_get_vector (start, end, scratch, veclen);
if (rv) {
- for (framecnt_t i = 0; i < veclen; ++i) {
+ for (samplecnt_t i = 0; i < veclen; ++i) {
vec[i] *= scratch[i];
}
} else {
SlavableAutomationControl::scale_automation_callback (double value, double ratio) const
{
/* derived classes can override this and e.g. add/subtract. */
- value *= ratio;
+ if (toggled ()) {
+ // XXX we should use the master's upper/lower as threshold
+ if (ratio >= 0.5 * (upper () - lower ())) {
+ value = upper ();
+ }
+ } else {
+ value *= ratio;
+ }
value = std::max (lower(), std::min(upper(), value));
return value;
}
bool update_value = false;
double master_ratio = 0;
- double list_ratio = 1;
+ double list_ratio = toggled () ? 0 : 1;
boost::shared_ptr<AutomationControl> master;
XMLNode* before = &alist ()->get_state ();
if (master->automation_playback () && master->list()) {
_list->list_merge (*master->list().get(), boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, _2));
+ printf ("y-t %s %f\n", name().c_str(), list_ratio);
_list->y_transform (boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, list_ratio));
} else {
// do we need to freeze/thaw the list? probably no: iterators & positions don't change
ControlList masters;
bool update_value = false;
double master_ratio = 0;
- double list_ratio = 1;
+ double list_ratio = toggled () ? 0 : 1;
/* null ptr means "all masters */
pre_remove_master (boost::shared_ptr<AutomationControl>());
}
void
-SlavableAutomationControl::automation_run (framepos_t start, pframes_t nframes)
+SlavableAutomationControl::automation_run (samplepos_t start, pframes_t nframes)
{
if (!automation_playback ()) {
return;
}
bool
-SlavableAutomationControl::boolean_automation_run_locked (framepos_t start, pframes_t len)
+SlavableAutomationControl::boolean_automation_run_locked (samplepos_t start, pframes_t len)
{
bool rv = false;
if (!_desc.toggled) {
}
bool
-SlavableAutomationControl::boolean_automation_run (framepos_t start, pframes_t len)
+SlavableAutomationControl::boolean_automation_run (samplepos_t start, pframes_t len)
{
bool change = false;
{