- if (_strip->send_enable_controllable (nsends)) {
- _strip->send_enable_controllable(nsends)->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message_with_id, this, X_("/select/send_enable"), nsends + 1, _strip->send_enable_controllable(nsends)), OSC::instance());
- change_message_with_id ("/select/send_enable", nsends + 1, _strip->send_enable_controllable(nsends));
- sends = true;
- } else if (sends) {
- // not used by Ardour, just mixbus so in Ardour always true
- clear_strip_with_id ("/select/send_enable", nsends + 1, 1);
- }
- // this should get signalled by the route the send goes to, (TODO)
- if (sends) { // if the gain control is there, this is too
- text_with_id ("/select/send_name", nsends + 1, _strip->send_name(nsends));
+ send_size = nsends;
+ if (sur->send_page_size) {
+ send_size = sur->send_page_size;
+ }
+ // check limits
+ uint32_t max_page = (uint32_t)(nsends / send_size) + 1;
+ if (sur->send_page < 1) {
+ sur->send_page = 1;
+ } else if ((uint32_t)sur->send_page > max_page) {
+ sur->send_page = max_page;
+ }
+ uint32_t page_start = ((sur->send_page - 1) * send_size);
+ uint32_t last_send = sur->send_page * send_size;
+ uint32_t c = 1;
+
+ for (uint32_t s = page_start; s < last_send; ++s, ++c) {
+
+ bool send_valid = false;
+ if (_strip->send_level_controllable (s)) {
+ _strip->send_level_controllable(s)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_gain, this, c, _strip->send_level_controllable(s)), OSC::instance());
+ send_timeout.push_back (0);
+ send_gain (c, _strip->send_level_controllable(s));
+ send_valid = true;
+ }
+
+ if (_strip->send_enable_controllable (s)) {
+ _strip->send_enable_controllable(s)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message_with_id, this, X_("/select/send_enable"), c, _strip->send_enable_controllable(s)), OSC::instance());
+ enable_message_with_id ("/select/send_enable", c, _strip->send_enable_controllable(s));
+ } else if (send_valid) {
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (_strip);
+ if (!r) {
+ // should never get here
+ send_float_with_id ("/select/send_enable", c, 0);
+ }
+ boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(s));
+ if (snd) {
+ boost::shared_ptr<Processor> proc = boost::dynamic_pointer_cast<Processor> (snd);
+ proc->ActiveChanged.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_enable, this, X_("/select/send_enable"), c, proc), OSC::instance());
+ send_float_with_id ("/select/send_enable", c, proc->enabled());
+ }