13
0

quick checks on empty control lists, to avoid unnecessary work

This commit is contained in:
Paul Davis 2016-07-06 15:20:17 -04:00
parent cf9706974c
commit db3223478c

View File

@ -37,6 +37,10 @@ using namespace Glib;
void void
Session::set_controls (boost::shared_ptr<ControlList> cl, double val, Controllable::GroupControlDisposition gcd) Session::set_controls (boost::shared_ptr<ControlList> cl, double val, Controllable::GroupControlDisposition gcd)
{ {
if (cl->empty()) {
return;
}
std::cerr << "Session::set_controls called on " << cl->size() << " controls, group = " << enum_2_string (gcd) << std::endl; std::cerr << "Session::set_controls called on " << cl->size() << " controls, group = " << enum_2_string (gcd) << std::endl;
for (ControlList::iterator ci = cl->begin(); ci != cl->end(); ++ci) { for (ControlList::iterator ci = cl->begin(); ci != cl->end(); ++ci) {
@ -50,6 +54,10 @@ Session::set_controls (boost::shared_ptr<ControlList> cl, double val, Controllab
void void
Session::set_control (boost::shared_ptr<AutomationControl> ac, double val, Controllable::GroupControlDisposition gcd) Session::set_control (boost::shared_ptr<AutomationControl> ac, double val, Controllable::GroupControlDisposition gcd)
{ {
if (!ac) {
return;
}
boost::shared_ptr<ControlList> cl (new ControlList); boost::shared_ptr<ControlList> cl (new ControlList);
cl->push_back (ac); cl->push_back (ac);
set_controls (cl, val, gcd); set_controls (cl, val, gcd);