Set the toggled default metadata of parameters.
authorDavid Robillard <d@drobilla.net>
Fri, 28 Nov 2014 23:04:51 +0000 (18:04 -0500)
committerDavid Robillard <d@drobilla.net>
Fri, 28 Nov 2014 23:04:51 +0000 (18:04 -0500)
This is so generic code looking at the Parameter for gain, solo, and
rec-enable will get the correct value for toggled.

libs/ardour/event_type_map.cc

index ee6270356c8750c06b27beff54be3e87959033c2..cc15d72356689b344cd74e8688e0b87f90c0ddcc 100644 (file)
@@ -154,9 +154,10 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
 {
        Evoral::Parameter p(type, channel, id);
 
-       double min    = 0.0f;
-       double max    = 1.0f;
-       double normal = 0.0f;
+       double min     = 0.0f;
+       double max     = 1.0f;
+       double normal  = 0.0f;
+       bool   toggled = false;
 
        switch((AutomationType)type) {
        case NullAutomation:
@@ -178,6 +179,7 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
                 break;
        case RecEnableAutomation:
                /* default 0.0 - 1.0 is fine */
+               toggled = true;
                break;
        case PluginAutomation:
        case FadeInAutomation:
@@ -190,6 +192,7 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
        case MuteAutomation:
                max = 1.0f;
                normal = 0.0f;
+               toggled = true;
                break;
        case MidiCCAutomation:
        case MidiPgmChangeAutomation:
@@ -203,7 +206,7 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
                return p;
        }
 
-       p.set_range(type, min, max, normal, false);
+       p.set_range(type, min, max, normal, toggled);
        return p;
 }