#include "osc_controllable.h"
#include "osc_route_observer.h"
#include "osc_global_observer.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace std;
periodic_connection = periodic_timeout->connect (sigc::mem_fun (*this, &OSC::periodic));
periodic_timeout->attach (main_loop()->get_context());
- // catch GUI select changes for GUI_select mode
- StripableSelectionChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSC::gui_selection_changed, this, _1), this);
+ // catch changes to selection for GUI_select mode
+ StripableSelectionChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSC::gui_selection_changed, this), this);
// catch track reordering
// receive routes added
REGISTER_CALLBACK (serv, "/toggle_all_rec_enables", "f", toggle_all_rec_enables);
REGISTER_CALLBACK (serv, "/all_tracks_rec_in", "f", all_tracks_rec_in);
REGISTER_CALLBACK (serv, "/all_tracks_rec_out", "f", all_tracks_rec_out);
+ REGISTER_CALLBACK (serv, "/cancel_all_solos", "f", cancel_all_solos);
REGISTER_CALLBACK (serv, "/remove_marker", "", remove_marker_at_playhead);
REGISTER_CALLBACK (serv, "/remove_marker", "f", remove_marker_at_playhead);
REGISTER_CALLBACK (serv, "/jump_bars", "f", jump_by_bars);
REGISTER_CALLBACK (serv, "/select/send_fader", "if", sel_sendfader);
REGISTER_CALLBACK (serv, "/select/send_enable", "if", sel_sendenable);
REGISTER_CALLBACK (serv, "/select/expand", "i", sel_expand);
+ REGISTER_CALLBACK (serv, "/select/pan_elevation_position", "f", sel_pan_elevation);
+ REGISTER_CALLBACK (serv, "/select/pan_frontback_position", "f", sel_pan_frontback);
+ REGISTER_CALLBACK (serv, "/select/pan_lfe_position", "f", sel_pan_lfe);
+ REGISTER_CALLBACK (serv, "/select/comp_enable", "f", sel_comp_enable);
+ REGISTER_CALLBACK (serv, "/select/comp_threshold", "f", sel_comp_threshold);
+ REGISTER_CALLBACK (serv, "/select/comp_speed", "f", sel_comp_speed);
+ REGISTER_CALLBACK (serv, "/select/comp_mode", "f", sel_comp_mode);
+ REGISTER_CALLBACK (serv, "/select/comp_makeup", "f", sel_comp_makeup);
+ REGISTER_CALLBACK (serv, "/select/eq_enable", "f", sel_eq_enable);
+ REGISTER_CALLBACK (serv, "/select/eq_hpf", "f", sel_eq_hpf);
+ REGISTER_CALLBACK (serv, "/select/eq_gain", "if", sel_eq_gain);
+ REGISTER_CALLBACK (serv, "/select/eq_freq", "if", sel_eq_freq);
+ REGISTER_CALLBACK (serv, "/select/eq_q", "if", sel_eq_q);
+ REGISTER_CALLBACK (serv, "/select/eq_shape", "if", sel_eq_shape);
/* These commands require the route index in addition to the arg; TouchOSC (et al) can't use these */
REGISTER_CALLBACK (serv, "/strip/mute", "ii", route_mute);
route_solo (ssid, argv[0]->f == 1.0, msg);
ret = 0;
}
+ else if (!strncmp (path, "/select/eq_gain/", 16) && strlen (path) > 16) {
+ int ssid = atoi (&path[16]);
+ route_solo (ssid, argv[0]->f == 1.0, msg);
+ ret = 0;
+ }
+ else if (!strncmp (path, "/select/eq_freq/", 16) && strlen (path) > 16) {
+ int ssid = atoi (&path[16]);
+ route_solo (ssid, argv[0]->f == 1.0, msg);
+ ret = 0;
+ }
+ else if (!strncmp (path, "/select/eq_q/", 13) && strlen (path) > 13) {
+ int ssid = atoi (&path[13]);
+ route_solo (ssid, argv[0]->f == 1.0, msg);
+ ret = 0;
+ }
+ else if (!strncmp (path, "/select/eq_shape/", 17) && strlen (path) > 17) {
+ int ssid = atoi (&path[17]);
+ route_solo (ssid, argv[0]->f == 1.0, msg);
+ ret = 0;
+ }
}
if ((ret && _debugmode == Unhandled)) {
lo_message_free (reply);
}
+int
+OSC::cancel_all_solos ()
+{
+ session->clear_all_solo_state (session->get_routes());
+ return 0;
+}
+
int
OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, lo_message msg)
{
// set bank and strip feedback
set_bank(s->bank, msg);
- global_feedback (s->feedback, msg, s->gainmode);
+ global_feedback (s->feedback, lo_message_get_source (msg), s->gainmode);
return 0;
}
set_bank(s->bank, msg);
// Set global/master feedback
- global_feedback (s->feedback, msg, s->gainmode);
+ global_feedback (s->feedback, lo_message_get_source (msg), s->gainmode);
return 0;
}
set_bank(s->bank, msg);
// Set global/master feedback
- global_feedback (s->feedback, msg, s->gainmode);
+ global_feedback (s->feedback, lo_message_get_source (msg), s->gainmode);
return 0;
}
}
// if we do this when OSC is started we get the wrong stripable
// we don't need this until we actually have a surface to deal with
- if (!_select) {
- // guess at which stripable is the current editor mixerstrip
- // right now just choose the first one we find, may be the wrong one
- // hopefully we will have access to session->current_strip at some point
- StripableList stripables;
-
- session->get_stripables (stripables);
-
- for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
- boost::shared_ptr<Stripable> s = *it;
- if (s->is_selected()) {
- _select = s;
- break;
- }
- }
+ if (!_select || (_select != ControlProtocol::first_selected_stripable())) {
+ gui_selection_changed();
}
// No surface create one with default values
// setup global feedback for a surface
void
-OSC::global_feedback (bitset<32> feedback, lo_address msg, uint32_t gainmode)
+OSC::global_feedback (bitset<32> feedback, lo_address addr, uint32_t gainmode)
{
// first destroy global observer for this surface
GlobalObservers::iterator x;
-
for (x = global_observers.begin(); x != global_observers.end();) {
OSCGlobalObserver* ro;
if ((ro = dynamic_cast<OSCGlobalObserver*>(*x)) != 0) {
- int res = strcmp(lo_address_get_url(ro->address()), lo_address_get_url(lo_message_get_source (msg)));
+ int res = strcmp(lo_address_get_url(ro->address()), lo_address_get_url(addr));
if (res == 0) {
delete *x;
}
if (feedback[4] || feedback[3] || feedback[5] || feedback[6]) {
// create a new Global Observer for this surface
- //OSCSurface *s = get_surface (lo_message_get_source (msg));
- OSCGlobalObserver* o = new OSCGlobalObserver (*session, lo_message_get_source (msg), gainmode, /*s->*/feedback);
+ OSCGlobalObserver* o = new OSCGlobalObserver (*session, addr, gainmode, /*s->*/feedback);
global_observers.push_back (o);
}
}
void
OSC::_recalcbanks ()
{
+ if (!_select || (_select != ControlProtocol::first_selected_stripable())) {
+ _select = ControlProtocol::first_selected_stripable();
+ }
+
// do a set_bank for each surface we know about.
for (uint32_t it = 0; it < _surface.size(); ++it) {
OSCSurface* sur = &_surface[it];
// revert any expand to select
s->expand = 0;
s->expand_enable = false;
- _strip_select (_select, addr);
+ _strip_select (ControlProtocol::first_selected_stripable(), addr);
// undo all listeners for this url
StripableList stripables;
b_size = s->bank_size;
}
- // Do limits checking - high end still not quite right
+ // Do limits checking
if (bank_start < 1) bank_start = 1;
if (b_size >= s->nstrips) {
bank_start = 1;
} else if (bank_start > ((s->nstrips - b_size) + 1)) {
+ // top bank is always filled if there are enough strips for at least one bank
bank_start = (uint32_t)((s->nstrips - b_size) + 1);
}
//save bank in case we have had to change it
uint32_t
OSC::get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr)
{
+ if (!strip) {
+ return 0;
+ }
+
OSCSurface *s = get_surface(addr);
uint32_t b_size;
OSC::get_strip (uint32_t ssid, lo_address addr)
{
OSCSurface *s = get_surface(addr);
- if ((ssid + s->bank - 2) < s->nstrips) {
+ if (ssid && ((ssid + s->bank - 2) < s->nstrips)) {
return s->strips[ssid + s->bank - 2];
}
// guess it is out of range
return 0;
}
}
- return route_send_fail ("mute", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("mute", 0, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("solo", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("solo", 0, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("solo_iso", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("solo_iso", 0, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("solo_safe", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("solo_safe", 0, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("recenable", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("recenable", 0, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("record_safe", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("record_safe", 0, lo_message_get_source (msg));
}
int
}
}
}
- return route_send_fail ("monitor_input", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("monitor_input", 0, lo_message_get_source (msg));
}
int
}
}
}
- return route_send_fail ("monitor_disk", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("monitor_disk", 0, lo_message_get_source (msg));
}
return 0;
}
}
- return route_send_fail ("polarity", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("polarity", 0, lo_message_get_source (msg));
}
int
if (yn) {
s = get_strip (ssid, lo_message_get_source (msg));
} else {
- s = _select;
+ s = ControlProtocol::first_selected_stripable();
}
return _strip_select (s, lo_message_get_source (msg));
OSCSelectObserver* sel_fb = new OSCSelectObserver (s, addr, sur->gainmode, sur->feedback);
s->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::recalcbanks, this), this);
sur->sel_obs = sel_fb;
- } else if (sur->expand_enable && sur->expand) {
- route_send_fail ("select", sur->expand, 0 , addr);
+ } else if (sur->expand_enable) {
sur->expand = 0;
sur->expand_enable = false;
+ if (_select) {
+ OSCSelectObserver* sel_fb = new OSCSelectObserver (_select, addr, sur->gainmode, sur->feedback);
+ _select->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::recalcbanks, this), this);
+ sur->sel_obs = sel_fb;
+ }
+ } else {
+ route_send_fail ("select", sur->expand, 0 , addr);
}
//update buttons on surface
int b_s = sur->bank_size;
for (int i = 1; i <= b_s; i++) {
string path = "expand";
- if ((i==(int)sur->expand) && sur->expand_enable) {
+ if ((i == (int) sur->expand) && sur->expand_enable) {
lo_message reply = lo_message_new ();
if (sur->feedback[2]) {
ostringstream os;
lo_message_free (reply);
} else {
- route_send_fail (path, i, 0, addr);
+ lo_message reply = lo_message_new ();
+ lo_message_add_int32 (reply, i);
+ lo_message_add_float (reply, 0.0);
+ lo_send_message (addr, "/strip/expand", reply);
+ lo_message_free (reply);
}
}
if (!sur->expand_enable) {
sur->expand_enable = false;
boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
if (s) {
- SetStripableSelection (s->presentation_info().order());
- //s->presentation_info().set_selected(true);
+ SetStripableSelection (s);
} else {
route_send_fail ("select", ssid, 0, lo_message_get_source (msg));
}
OSC::sel_expand (uint32_t state, lo_message msg)
{
OSCSurface *sur = get_surface(lo_message_get_source (msg));
- sur->expand_enable = (bool) state;
boost::shared_ptr<Stripable> s;
- if (state) {
+ sur->expand_enable = (bool) state;
+ if (state && sur->expand) {
s = get_strip (sur->expand, lo_message_get_source (msg));
} else {
- s = _select;
+ s = ControlProtocol::first_selected_stripable();
}
return _strip_select (s, lo_message_get_source (msg));
return 0;
}
}
- return route_send_fail ("gain", 0, -193, lo_message_get_source (msg));
+ return sel_fail ("gain", -193, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("fader", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("fader", 0, lo_message_get_source (msg));
}
int
return 0;
}
}
- return route_send_fail ("trimdB", 0, 0, lo_message_get_source (msg));
+ return sel_fail ("trimdB", 0, lo_message_get_source (msg));
}
int
if (s) {
if(s->pan_azimuth_control()) {
s->pan_azimuth_control()->set_value (val, PBD::Controllable::NoGroup);
- //return route_send_fail ("pan_stereo_position", ssid, s->pan_azimuth_control()->get_value (), lo_message_get_source (msg));
return 0;
}
}
- return route_send_fail ("pan_stereo_position", 0, 0.5, lo_message_get_source (msg));
+ return sel_fail ("pan_stereo_position", 0.5, lo_message_get_source (msg));
}
int
}
if (s) {
if (s->pan_width_control()) {
- s->pan_width_control()->set_value (val, PBD::Controllable::NoGroup);
+ s->pan_width_control()->set_value (s->pan_width_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
return 0;
}
}
- return route_send_fail ("pan_stereo_width", 0, 1, lo_message_get_source (msg));
+ return sel_fail ("pan_stereo_width", 1, lo_message_get_source (msg));
}
int
return 0;
}
}
- return sel_send_fail ("send_gain", id, -193, lo_message_get_source (msg));
+ return sel_send_fail ("send_gain", id + 1, -193, lo_message_get_source (msg));
}
int
return 0;
}
-void
-OSC::gui_selection_changed (StripableNotificationListPtr stripables)
+// select
+
+int
+OSC::sel_pan_elevation (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->pan_elevation_control()) {
+ s->pan_elevation_control()->set_value (s->pan_elevation_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("pan_elevation_position", 0.5, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_pan_frontback (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->pan_frontback_control()) {
+ s->pan_frontback_control()->set_value (s->pan_frontback_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("pan_frontback_position", 0.5, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_pan_lfe (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->pan_lfe_control()) {
+ s->pan_lfe_control()->set_value (s->pan_lfe_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("pan_lfe_position", 0, lo_message_get_source (msg));
+}
+
+// compressor control
+int
+OSC::sel_comp_enable (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_enable_controllable()) {
+ s->comp_enable_controllable()->set_value (s->comp_enable_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_enable", 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_comp_threshold (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_threshold_controllable()) {
+ s->comp_threshold_controllable()->set_value (s->comp_threshold_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_threshold", 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_comp_speed (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_speed_controllable()) {
+ s->comp_speed_controllable()->set_value (s->comp_speed_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_speed", 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_comp_mode (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_mode_controllable()) {
+ s->comp_mode_controllable()->set_value (s->comp_mode_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_mode", 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_comp_makeup (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->comp_makeup_controllable()) {
+ s->comp_makeup_controllable()->set_value (s->comp_makeup_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("comp_makeup", 0, lo_message_get_source (msg));
+}
+
+// EQ control
+
+int
+OSC::sel_eq_enable (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->eq_enable_controllable()) {
+ s->eq_enable_controllable()->set_value (s->eq_enable_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_enable", 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_eq_hpf (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->eq_hpf_controllable()) {
+ s->eq_hpf_controllable()->set_value (s->eq_hpf_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_hpf", 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_eq_gain (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_gain_controllable (id)) {
+ s->eq_gain_controllable (id)->set_value (s->eq_gain_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_gain", id + 1, 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_eq_freq (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_freq_controllable (id)) {
+ s->eq_freq_controllable (id)->set_value (s->eq_freq_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_freq", id + 1, 0, lo_message_get_source (msg));
+}
+
+int
+OSC::sel_eq_q (int id, float val, lo_message msg)
{
- boost::shared_ptr<Stripable> strip;
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_q_controllable (id)) {
+ s->eq_q_controllable (id)->set_value (s->eq_q_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_q", id + 1, 0, lo_message_get_source (msg));
+}
- if (!stripables->empty()) {
- strip = stripables->front().lock();
+int
+OSC::sel_eq_shape (int id, float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(lo_message_get_source (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, lo_message_get_source (msg));
+ } else {
+ s = _select;
}
+ if (s) {
+ if (id > 0) {
+ --id;
+ }
+ if (s->eq_shape_controllable (id)) {
+ s->eq_shape_controllable (id)->set_value (s->eq_shape_controllable(id)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_send_fail ("eq_shape", id + 1, 0, lo_message_get_source (msg));
+}
+
+void
+OSC::gui_selection_changed ()
+{
+ boost::shared_ptr<Stripable> strip = ControlProtocol::first_selected_stripable();
+
if (strip) {
+ _select = strip;
for (uint32_t it = 0; it < _surface.size(); ++it) {
OSCSurface* sur = &_surface[it];
- _select = strip;
if(!sur->expand_enable) {
lo_address addr = lo_address_new_from_url (sur->remote_url.c_str());
_strip_select (strip, addr);
}
}
}
-
}
// timer callbacks
{
if (!tick) {
Glib::usleep(100); // let flurry of signals subside
+ if (global_init) {
+ for (uint32_t it = 0; it < _surface.size(); it++) {
+ OSCSurface* sur = &_surface[it];
+ lo_address addr = lo_address_new_from_url (sur->remote_url.c_str());
+ global_feedback (sur->feedback, addr, sur->gainmode);
+ }
+ global_init = false;
+ tick = true;
+ }
if (bank_dirty) {
_recalcbanks ();
bank_dirty = false;
return 0;
}
+int
+OSC::sel_fail (string path, float val, lo_address addr)
+{
+ ostringstream os;
+ os.str("");
+ os << "/select/" << path;
+ string sel_pth = os.str();
+ lo_message reply = lo_message_new ();
+ lo_message_add_float (reply, (float) val);
+ lo_send_message (addr, sel_pth.c_str(), reply);
+ lo_message_free (reply);
+
+ return 0;
+}
+
int
OSC::sel_send_fail (string path, uint32_t id, float val, lo_address addr)
{
{
XMLNode& node (ControlProtocol::get_state());
node.add_property("debugmode", (int) _debugmode); // TODO: enum2str
+ if (_surface.size()) {
+ XMLNode* config = new XMLNode (X_("Configurations"));
+ for (uint32_t it = 0; it < _surface.size(); ++it) {
+ OSCSurface* sur = &_surface[it];
+ XMLNode* devnode = new XMLNode (X_("Configuration"));
+ devnode->add_property (X_("url"), sur->remote_url);
+ devnode->add_property (X_("bank-size"), sur->bank_size);
+ devnode->add_property (X_("strip-types"), sur->strip_types.to_ulong());
+ devnode->add_property (X_("feedback"), sur->feedback.to_ulong());
+ devnode->add_property (X_("gainmode"), sur->gainmode);
+ config->add_child_nocopy (*devnode);
+ }
+ node.add_child_nocopy (*config);
+ }
return node;
}
if (p) {
_debugmode = OSCDebugMode (PBD::atoi(p->value ()));
}
+ XMLNode* cnode = node.child (X_("Configurations"));
+
+ if (cnode) {
+ XMLNodeList const& devices = cnode->children();
+ for (XMLNodeList::const_iterator d = devices.begin(); d != devices.end(); ++d) {
+ XMLProperty const * prop = (*d)->property (X_("url"));
+ if (prop) {
+ OSCSurface s;
+ bank_dirty = true;
+ s.remote_url = prop->value();
+ prop = (*d)->property (X_("bank-size"));
+ if (prop) {
+ s.bank_size = atoi (prop->value().c_str());
+ }
+ prop = (*d)->property (X_("strip-types"));
+ if (prop) {
+ s.strip_types = atoi (prop->value().c_str());
+ }
+ prop = (*d)->property (X_("feedback"));
+ if (prop) {
+ s.feedback = atoi (prop->value().c_str());
+ }
+ prop = (*d)->property (X_("gainmode"));
+ if (prop) {
+ s.gainmode = atoi (prop->value().c_str());
+ }
+ s.bank = 1;
+ s.sel_obs = 0;
+ s.expand = 0;
+ s.expand_enable = false;
+ s.strips = get_sorted_stripables(s.strip_types);
+ s.nstrips = s.strips.size();
+ _surface.push_back (s);
+ }
+ }
+ }
+ global_init = true;
+ tick = false;
return 0;
}