mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 19:56:31 +01:00
OSC: Add Sorted or not to custom strip list
fix bug where processor_changed sometimes gets null address
This commit is contained in:
parent
559344d99d
commit
886244feea
2 changed files with 61 additions and 32 deletions
|
|
@ -415,7 +415,7 @@ OSC::register_callbacks()
|
||||||
REGISTER_CALLBACK (serv, "/refresh", "f", refresh_surface);
|
REGISTER_CALLBACK (serv, "/refresh", "f", refresh_surface);
|
||||||
REGISTER_CALLBACK (serv, "/strip/list", "", routes_list);
|
REGISTER_CALLBACK (serv, "/strip/list", "", routes_list);
|
||||||
REGISTER_CALLBACK (serv, "/strip/list", "f", routes_list);
|
REGISTER_CALLBACK (serv, "/strip/list", "f", routes_list);
|
||||||
REGISTER_CALLBACK (serv, "/strip/custom/enable", "f", custom_enable);
|
REGISTER_CALLBACK (serv, "/strip/custom/mode", "f", custom_mode);
|
||||||
REGISTER_CALLBACK (serv, "/strip/custom/clear", "f", custom_clear);
|
REGISTER_CALLBACK (serv, "/strip/custom/clear", "f", custom_clear);
|
||||||
REGISTER_CALLBACK (serv, "/strip/custom/clear", "", custom_clear);
|
REGISTER_CALLBACK (serv, "/strip/custom/clear", "", custom_clear);
|
||||||
REGISTER_CALLBACK (serv, "/surface/list", "", surface_list);
|
REGISTER_CALLBACK (serv, "/surface/list", "", surface_list);
|
||||||
|
|
@ -835,7 +835,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
|
||||||
if (strcmp (path, "/strip/listen") == 0) {
|
if (strcmp (path, "/strip/listen") == 0) {
|
||||||
if (argc <= 0) {
|
if (argc <= 0) {
|
||||||
PBD::warning << "OSC: Wrong number of parameters." << endmsg;
|
PBD::warning << "OSC: Wrong number of parameters." << endmsg;
|
||||||
} else if (sur->custom_enable) {
|
} else if (sur->custom_mode) {
|
||||||
PBD::warning << "OSC: Can't add strips with custom enabled." << endmsg;
|
PBD::warning << "OSC: Can't add strips with custom enabled." << endmsg;
|
||||||
} else {
|
} else {
|
||||||
for (int n = 0; n < argc; ++n) {
|
for (int n = 0; n < argc; ++n) {
|
||||||
|
|
@ -851,7 +851,7 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
|
||||||
if (strcmp (path, "/strip/ignore") == 0) {
|
if (strcmp (path, "/strip/ignore") == 0) {
|
||||||
if (argc <= 0) {
|
if (argc <= 0) {
|
||||||
PBD::warning << "OSC: Wrong number of parameters." << endmsg;
|
PBD::warning << "OSC: Wrong number of parameters." << endmsg;
|
||||||
} else if (!sur->custom_enable) {
|
} else if (!sur->custom_mode) {
|
||||||
PBD::warning << "OSC: Can't remove strips without custom enabled." << endmsg;
|
PBD::warning << "OSC: Can't remove strips without custom enabled." << endmsg;
|
||||||
} else {
|
} else {
|
||||||
for (int n = 0; n < argc; ++n) {
|
for (int n = 0; n < argc; ++n) {
|
||||||
|
|
@ -1251,7 +1251,7 @@ OSC::surface_list (lo_message msg)
|
||||||
OSCSurface* sur = &_surface[it];
|
OSCSurface* sur = &_surface[it];
|
||||||
cerr << string_compose (" Surface: %1 URL: %2\n", it, sur->remote_url);
|
cerr << string_compose (" Surface: %1 URL: %2\n", it, sur->remote_url);
|
||||||
cerr << string_compose (" Number of strips: %1 Bank size: %2 Current Bank %3\n", sur->nstrips, sur->bank_size, sur->bank);
|
cerr << string_compose (" Number of strips: %1 Bank size: %2 Current Bank %3\n", sur->nstrips, sur->bank_size, sur->bank);
|
||||||
cerr << string_compose (" Use Custom: %1 Custom Strips: %2\n", sur->custom_enable, sur->custom_strips.size ());
|
cerr << string_compose (" Use Custom: %1 Custom Strips: %2\n", sur->custom_mode, sur->custom_strips.size ());
|
||||||
bool ug = false;
|
bool ug = false;
|
||||||
if (sur->usegroup == PBD::Controllable::UseGroup) {
|
if (sur->usegroup == PBD::Controllable::UseGroup) {
|
||||||
ug = true;
|
ug = true;
|
||||||
|
|
@ -1290,7 +1290,7 @@ OSC::custom_clear (lo_message msg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
OSCSurface *sur = get_surface(get_address (msg), true);
|
OSCSurface *sur = get_surface(get_address (msg), true);
|
||||||
sur->custom_enable = false;
|
sur->custom_mode = 0;
|
||||||
sur->custom_strips.clear ();
|
sur->custom_strips.clear ();
|
||||||
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, false, sur->custom_strips);
|
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, false, sur->custom_strips);
|
||||||
sur->nstrips = sur->strips.size();
|
sur->nstrips = sur->strips.size();
|
||||||
|
|
@ -1298,7 +1298,7 @@ OSC::custom_clear (lo_message msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
OSC::custom_enable (float state, lo_message msg)
|
OSC::custom_mode (float state, lo_message msg)
|
||||||
{
|
{
|
||||||
if (!session) {
|
if (!session) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1307,17 +1307,21 @@ OSC::custom_enable (float state, lo_message msg)
|
||||||
if (state > 0){
|
if (state > 0){
|
||||||
if (sur->custom_strips.size () == 0) {
|
if (sur->custom_strips.size () == 0) {
|
||||||
PBD::warning << "No custom strips set to enable" << endmsg;
|
PBD::warning << "No custom strips set to enable" << endmsg;
|
||||||
sur->custom_enable = false;
|
sur->custom_mode = 0;
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
sur->custom_enable = true;
|
if (sur->bank_size) {
|
||||||
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, true, sur->custom_strips);
|
sur->custom_mode = (uint32_t) state | 0x4;
|
||||||
|
} else {
|
||||||
|
sur->custom_mode = (uint32_t) state;
|
||||||
|
}
|
||||||
|
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips);
|
||||||
sur->nstrips = sur->custom_strips.size();
|
sur->nstrips = sur->custom_strips.size();
|
||||||
return set_bank (1, msg);
|
return set_bank (1, msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sur->custom_enable = false;
|
sur->custom_mode = 0;
|
||||||
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, false, sur->custom_strips);
|
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, 0, sur->custom_strips);
|
||||||
sur->nstrips = sur->strips.size();
|
sur->nstrips = sur->strips.size();
|
||||||
return set_bank (1, msg);
|
return set_bank (1, msg);
|
||||||
}
|
}
|
||||||
|
|
@ -1812,6 +1816,9 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui
|
||||||
}
|
}
|
||||||
OSCSurface *s = get_surface(get_address (msg), true);
|
OSCSurface *s = get_surface(get_address (msg), true);
|
||||||
s->bank_size = b_size;
|
s->bank_size = b_size;
|
||||||
|
if (s->custom_mode && b_size) {
|
||||||
|
s->custom_mode = s->custom_mode | 0x4;
|
||||||
|
}
|
||||||
s->strip_types = strips;
|
s->strip_types = strips;
|
||||||
s->feedback = fb;
|
s->feedback = fb;
|
||||||
s->gainmode = gm;
|
s->gainmode = gm;
|
||||||
|
|
@ -1845,6 +1852,9 @@ OSC::set_surface_bank_size (uint32_t bs, lo_message msg)
|
||||||
}
|
}
|
||||||
OSCSurface *s = get_surface(get_address (msg), true);
|
OSCSurface *s = get_surface(get_address (msg), true);
|
||||||
s->bank_size = bs;
|
s->bank_size = bs;
|
||||||
|
if (s->custom_mode && bs) {
|
||||||
|
s->custom_mode = s->custom_mode | 0x4;
|
||||||
|
}
|
||||||
if (s->linkset) {
|
if (s->linkset) {
|
||||||
set_link (s->linkset, s->linkid, get_address (msg));
|
set_link (s->linkset, s->linkid, get_address (msg));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1955,7 +1965,7 @@ OSC::get_surface (lo_address addr , bool quiet)
|
||||||
s.gainmode = default_gainmode;
|
s.gainmode = default_gainmode;
|
||||||
s.usegroup = PBD::Controllable::NoGroup;
|
s.usegroup = PBD::Controllable::NoGroup;
|
||||||
s.custom_strips.clear ();
|
s.custom_strips.clear ();
|
||||||
s.custom_enable = false;
|
s.custom_mode = 0;
|
||||||
s.sel_obs = 0;
|
s.sel_obs = 0;
|
||||||
s.expand = 0;
|
s.expand = 0;
|
||||||
s.expand_enable = false;
|
s.expand_enable = false;
|
||||||
|
|
@ -2001,9 +2011,9 @@ void
|
||||||
OSC::strip_feedback (OSCSurface* sur, bool new_bank_size)
|
OSC::strip_feedback (OSCSurface* sur, bool new_bank_size)
|
||||||
{
|
{
|
||||||
if (sur->custom_strips.size () == 0) {
|
if (sur->custom_strips.size () == 0) {
|
||||||
sur->custom_enable = false;
|
sur->custom_mode = 0;
|
||||||
}
|
}
|
||||||
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_enable, sur->custom_strips);
|
sur->strips = get_sorted_stripables(sur->strip_types, sur->cue, sur->custom_mode, sur->custom_strips);
|
||||||
sur->nstrips = sur->strips.size();
|
sur->nstrips = sur->strips.size();
|
||||||
if (new_bank_size || (!sur->feedback[0] && !sur->feedback[1])) {
|
if (new_bank_size || (!sur->feedback[0] && !sur->feedback[1])) {
|
||||||
// delete old observers
|
// delete old observers
|
||||||
|
|
@ -3695,11 +3705,11 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
|
||||||
sur->sel_obs = 0;
|
sur->sel_obs = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to set monitor for processor changed signal (for paging)
|
// need to set monitor for processor changed signal (for paging)
|
||||||
|
string address = lo_address_get_url (addr);
|
||||||
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
|
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
|
||||||
if (r) {
|
if (r) {
|
||||||
r->processors_changed.connect (sur->proc_connection, MISSING_INVALIDATOR, boost::bind (&OSC::processor_changed, this, addr), this);
|
r->processors_changed.connect (sur->proc_connection, MISSING_INVALIDATOR, boost::bind (&OSC::processor_changed, this, address), this);
|
||||||
_sel_plugin (sur->plugin_id, addr);
|
_sel_plugin (sur->plugin_id, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3707,8 +3717,9 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OSC::processor_changed (lo_address addr)
|
OSC::processor_changed (string address)
|
||||||
{
|
{
|
||||||
|
lo_address addr = lo_address_new_from_url (address.c_str());
|
||||||
OSCSurface *sur = get_surface (addr);
|
OSCSurface *sur = get_surface (addr);
|
||||||
_sel_plugin (sur->plugin_id, addr);
|
_sel_plugin (sur->plugin_id, addr);
|
||||||
if (sur->sel_obs) {
|
if (sur->sel_obs) {
|
||||||
|
|
@ -5307,16 +5318,17 @@ struct StripableByPresentationOrder
|
||||||
};
|
};
|
||||||
|
|
||||||
OSC::Sorted
|
OSC::Sorted
|
||||||
OSC::get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted my_list)
|
OSC::get_sorted_stripables(std::bitset<32> types, bool cue, uint32_t custom, Sorted my_list)
|
||||||
{
|
{
|
||||||
Sorted sorted;
|
Sorted sorted;
|
||||||
StripableList stripables;
|
StripableList stripables;
|
||||||
|
StripableList custom_list;
|
||||||
|
|
||||||
// fetch all stripables
|
// fetch all stripables
|
||||||
session->get_stripables (stripables);
|
session->get_stripables (stripables);
|
||||||
|
|
||||||
if (custom) {
|
if (custom) {
|
||||||
uint32_t nstps = my_list.size ();
|
uint32_t nstps = my_list.size ();
|
||||||
|
// check each custom strip to see if it still exists
|
||||||
boost::shared_ptr<Stripable> s;
|
boost::shared_ptr<Stripable> s;
|
||||||
for (uint32_t i = 0; i < nstps; i++) {
|
for (uint32_t i = 0; i < nstps; i++) {
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
|
|
@ -5330,14 +5342,27 @@ OSC::get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted
|
||||||
}
|
}
|
||||||
if(!exists) {
|
if(!exists) {
|
||||||
my_list[i] = boost::shared_ptr<Stripable>();
|
my_list[i] = boost::shared_ptr<Stripable>();
|
||||||
|
} else {
|
||||||
|
custom_list.push_back (s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return my_list;
|
if (custom == 1) {
|
||||||
|
return my_list;
|
||||||
|
} else {
|
||||||
|
stripables = custom_list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Look for stripables that match bit in sur->strip_types
|
// Look for stripables that match bit in sur->strip_types
|
||||||
for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
|
for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
|
||||||
|
|
||||||
boost::shared_ptr<Stripable> s = *it;
|
boost::shared_ptr<Stripable> s = *it;
|
||||||
|
if (!s) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (custom == 2) {
|
||||||
|
// banking off use all valid custom strips
|
||||||
|
sorted.push_back (s);
|
||||||
|
} else
|
||||||
if ((!cue) && (!types[9]) && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
|
if ((!cue) && (!types[9]) && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
|
||||||
// do nothing... skip it
|
// do nothing... skip it
|
||||||
} else if (types[8] && (s->is_selected())) {
|
} else if (types[8] && (s->is_selected())) {
|
||||||
|
|
@ -5385,14 +5410,18 @@ OSC::get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort (sorted.begin(), sorted.end(), StripableByPresentationOrder());
|
if (!custom || (custom & 0x2)) {
|
||||||
// Master/Monitor might be anywhere... we put them at the end - Sorry ;)
|
sort (sorted.begin(), sorted.end(), StripableByPresentationOrder());
|
||||||
if (types[5]) {
|
|
||||||
sorted.push_back (session->master_out());
|
|
||||||
}
|
}
|
||||||
if (types[6]) {
|
if (!custom) {
|
||||||
if (session->monitor_out()) {
|
// Master/Monitor might be anywhere... we put them at the end - Sorry ;)
|
||||||
sorted.push_back (session->monitor_out());
|
if (types[5]) {
|
||||||
|
sorted.push_back (session->master_out());
|
||||||
|
}
|
||||||
|
if (types[6]) {
|
||||||
|
if (session->monitor_out()) {
|
||||||
|
sorted.push_back (session->monitor_out());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sorted;
|
return sorted;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
|
typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
|
||||||
Sorted get_sorted_stripables(std::bitset<32> types, bool cue, bool custom, Sorted my_list);
|
Sorted get_sorted_stripables(std::bitset<32> types, bool cue, uint32_t custom, Sorted my_list);
|
||||||
typedef std::map<boost::shared_ptr<ARDOUR::AutomationControl>, uint32_t> FakeTouchMap;
|
typedef std::map<boost::shared_ptr<ARDOUR::AutomationControl>, uint32_t> FakeTouchMap;
|
||||||
FakeTouchMap _touch_timeout;
|
FakeTouchMap _touch_timeout;
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
int gainmode; // what kind of faders do we have Gain db or position 0 to 1?
|
int gainmode; // what kind of faders do we have Gain db or position 0 to 1?
|
||||||
PBD::Controllable::GroupControlDisposition usegroup; // current group disposition
|
PBD::Controllable::GroupControlDisposition usegroup; // current group disposition
|
||||||
Sorted custom_strips; // a sorted list of user selected strips
|
Sorted custom_strips; // a sorted list of user selected strips
|
||||||
int custom_enable; // use custom strip list
|
uint32_t custom_mode; // use custom strip list
|
||||||
Sorted strips; // list of stripables for this surface
|
Sorted strips; // list of stripables for this surface
|
||||||
// strips
|
// strips
|
||||||
uint32_t bank; // current bank
|
uint32_t bank; // current bank
|
||||||
|
|
@ -511,7 +511,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
PATH_CALLBACK1_MSG(sel_eq_lpf_enable,f);
|
PATH_CALLBACK1_MSG(sel_eq_lpf_enable,f);
|
||||||
PATH_CALLBACK1_MSG(sel_eq_lpf_slope,f);
|
PATH_CALLBACK1_MSG(sel_eq_lpf_slope,f);
|
||||||
PATH_CALLBACK1_MSG(sel_expand,i);
|
PATH_CALLBACK1_MSG(sel_expand,i);
|
||||||
PATH_CALLBACK1_MSG(custom_enable,f);
|
PATH_CALLBACK1_MSG(custom_mode,f);
|
||||||
|
|
||||||
#define PATH_CALLBACK2(name,arg1type,arg2type) \
|
#define PATH_CALLBACK2(name,arg1type,arg2type) \
|
||||||
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
|
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
|
||||||
|
|
@ -660,7 +660,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
int set_surface_gainmode (uint32_t gm, lo_message msg);
|
int set_surface_gainmode (uint32_t gm, lo_message msg);
|
||||||
int refresh_surface (lo_message msg);
|
int refresh_surface (lo_message msg);
|
||||||
int custom_clear (lo_message msg);
|
int custom_clear (lo_message msg);
|
||||||
int custom_enable (float state, lo_message msg);
|
int custom_mode (float state, lo_message msg);
|
||||||
// select
|
// select
|
||||||
int sel_send_pagesize (uint32_t size, lo_message msg);
|
int sel_send_pagesize (uint32_t size, lo_message msg);
|
||||||
int sel_send_page (int page, lo_message msg);
|
int sel_send_page (int page, lo_message msg);
|
||||||
|
|
@ -670,7 +670,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
int _sel_plugin (int id, lo_address addr);
|
int _sel_plugin (int id, lo_address addr);
|
||||||
int sel_plugin_activate (float state, lo_message msg);
|
int sel_plugin_activate (float state, lo_message msg);
|
||||||
int select_plugin_parameter (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg);
|
int select_plugin_parameter (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg);
|
||||||
void processor_changed (lo_address addr);
|
void processor_changed (std::string remote_url);
|
||||||
|
|
||||||
int scrub (float delta, lo_message msg);
|
int scrub (float delta, lo_message msg);
|
||||||
int jog (float delta, lo_message msg);
|
int jog (float delta, lo_message msg);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue