Special-case VCA at 0 (-inf dB), force gain slaves to -inf dB
[ardour.git] / libs / ardour / gain_control.cc
index cbafc75ad4139b403fb419af4c00c2626966838f..7b0f4e404c0d0c93d5d09e58a685b1858eef0d29 100644 (file)
@@ -92,7 +92,7 @@ GainControl::inc_gain (gain_t factor)
         * ControlGroup::set_group_values().
         */
 
-       const float desired_gain = user_double();
+       const float desired_gain = get_value ();
 
        if (fabsf (desired_gain) < GAIN_COEFF_SMALL) {
                // really?! what's the idea here?
@@ -102,8 +102,23 @@ GainControl::inc_gain (gain_t factor)
        }
 }
 
+void
+GainControl::post_add_master (boost::shared_ptr<AutomationControl> m)
+{
+       if (m->get_value() == 0) {
+               /* master is at -inf, which forces this ctrl to -inf on assignment */
+               Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
+       }
+}
+
 bool
 GainControl::get_masters_curve_locked (framepos_t start, framepos_t end, float* vec, framecnt_t veclen) const
 {
+       if (_masters.empty()) {
+               return list()->curve().rt_safe_get_vector (start, end, vec, veclen);
+       }
+       for (framecnt_t i = 0; i < veclen; ++i) {
+               vec[i] = 1.f;
+       }
        return SlavableAutomationControl::masters_curve_multiply (start, end, vec, veclen);
 }