diff options
author | Len Ovens <len@ovenwerks.net> | 2017-05-13 10:15:02 -0700 |
---|---|---|
committer | Len Ovens <len@ovenwerks.net> | 2017-05-13 14:18:29 -0700 |
commit | 3e2004aa73b4807bd470b3a816b5343a5127d7a7 (patch) | |
tree | c9d7b9ca90d5e2712aa02e5a3c7d0a152d9b38c3 | |
parent | f806799c1c3771d2f94b898ac5283de657aa4b81 (diff) |
OSC: make /*/automation more generic so other controls can be easily added
-rw-r--r-- | libs/surfaces/osc/osc.cc | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 9f079e602f..634fcc674e 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -2243,28 +2243,38 @@ OSC::set_automation (const char *path, size_t len, lo_arg **argv, int argc, lo_m return ret; } if (strp) { + boost::shared_ptr<AutomationControl> control = boost::shared_ptr<AutomationControl>(); if ((!strncmp (&path[ctr], "fader", 5)) || (!strncmp (&path[ctr], "gain", 4))) { if (strp->gain_control ()) { - switch (aut) { - case 0: - strp->gain_control()->set_automation_state (ARDOUR::Off); - ret = 0; - break; - case 1: - strp->gain_control()->set_automation_state (ARDOUR::Play); - ret = 0; - break; - case 2: - strp->gain_control()->set_automation_state (ARDOUR::Write); - ret = 0; - break; - case 3: - strp->gain_control()->set_automation_state (ARDOUR::Touch); - ret = 0; - break; - default: - break; - } + control = strp->gain_control (); + } else { + PBD::warning << "No fader for this strip" << endmsg; + } + } else { + PBD::warning << "Automation not available for " << path << endmsg; + } + + if (control) { + + switch (aut) { + case 0: + control->set_automation_state (ARDOUR::Off); + ret = 0; + break; + case 1: + control->set_automation_state (ARDOUR::Play); + ret = 0; + break; + case 2: + control->set_automation_state (ARDOUR::Write); + ret = 0; + break; + case 3: + control->set_automation_state (ARDOUR::Touch); + ret = 0; + break; + default: + break; } } } |