Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osc: Allow enabling parameter value feedback for all plugins #901

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 69 additions & 53 deletions libs/surfaces/osc/osc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ OSC::get_surfaces ()
PBD::info << string_compose (" Strip Types: %1 Feedback: %2 No_clear flag: %3 Gain mode: %4 Use groups flag %5\n", \
sur->strip_types.to_ulong(), sur->feedback.to_ulong(), sur->no_clear, sur->gainmode, ug);
PBD::info << string_compose (" Using plugin: %1 of %2 plugins, with %3 params. Page size: %4 Page: %5\n", \
sur->plugin_id, sur->plugins.size(), sur->plug_params.size(), sur->plug_page_size, sur->plug_page);
sur->plugin_id, sur->plugins.size(), sur->plugin_input_params[sur->plugin_id - 1].size(), sur->plug_page_size, sur->plug_page);
PBD::info << string_compose (" Send page size: %1 Page: %2\n", sur->send_page_size, sur->send_page);
PBD::info << string_compose (" Expanded flag %1 Track: %2 Jogmode: %3\n", sur->expand_enable, sur->expand, sur->jogmode);
PBD::info << string_compose (" Personal monitor flag %1, Aux master: %2, Number of sends: %3\n", sur->cue, sur->aux, sur->sends.size());
Expand Down Expand Up @@ -1872,14 +1872,15 @@ OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, ui
s->bank_size = b_size;
s->strip_types = strips;
s->feedback = fb;
if (s->sel_obs) {
s->sel_obs->set_feedback(fb);
}
s->gainmode = gm;
if (s->strip_types[10]) {
s->usegroup = PBD::Controllable::UseGroup;
} else {
s->usegroup = PBD::Controllable::NoGroup;
}
s->send_page_size = se_size;
s->plug_page_size = pi_size;
if (s->temp_mode) {
s->temp_mode = TempOff;
}
Expand Down Expand Up @@ -1952,6 +1953,9 @@ OSC::set_surface_feedback (uint32_t fb, lo_message msg)
}
OSCSurface *s = get_surface(get_address (msg), true);
s->feedback = fb;
if (s->sel_obs) {
s->sel_obs->set_feedback(fb);
}

strip_feedback (s, true);
global_feedback (s);
Expand Down Expand Up @@ -2845,9 +2849,20 @@ OSC::sel_plug_page (int page, lo_message msg)
int new_page = 0;
OSCSurface *s = get_surface(get_address (msg));
if (page > 0) {
new_page = s->plug_page + s->plug_page_size;
if ((uint32_t) new_page > s->plug_params.size ()) {
new_page = s->plug_page;
// Do not change page when there are no more parameters
// in the next page
new_page = s->plug_page;
if (s->feedback[17]) {
for (auto const& params: s->plugin_input_params) {
if ((uint32_t) new_page <= params.size ()) {
new_page = s->plug_page + s->plug_page_size;
break;
}
}
} else {
if ((uint32_t) new_page <= s->plugin_input_params[s->plugin_id].size ()) {
new_page = s->plug_page + s->plug_page_size;
}
}
} else {
new_page = s->plug_page - s->plug_page_size;
Expand Down Expand Up @@ -2883,32 +2898,12 @@ OSC::_sel_plugin (int id, lo_address addr)
return 1;
}

/* find out how many plugins we have */
sur->plugins.clear();
for (int nplugs = 0; true; ++nplugs) {
std::shared_ptr<Processor> proc = r->nth_plugin (nplugs);
if (!proc) {
break;
}
if (!r->nth_plugin(nplugs)->display_to_user()) {
continue;
}
#ifdef MIXBUS
/* need to check for mixbus channel strips (and exclude them) */
std::shared_ptr<PluginInsert> pi = std::dynamic_pointer_cast<PluginInsert>(proc);
if (pi && pi->is_channelstrip()) {
continue;
}
#endif
sur->plugins.push_back (nplugs);
}

// limit plugin_id to actual plugins
if (sur->plugins.size() < 1) {
sur->plugin_id = 0;
sur->plug_page = 1;
if (sur->sel_obs) {
sur->sel_obs->set_plugin_id(-1, 1);
sur->sel_obs->set_plugin_id(0, 1);
}
return 0;
} else if (id < 1) {
Expand All @@ -2919,32 +2914,10 @@ OSC::_sel_plugin (int id, lo_address addr)
sur->plugin_id = id;
}

// we have a plugin number now get the processor
std::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
std::shared_ptr<PluginInsert> pi;
if (!(pi = std::dynamic_pointer_cast<PluginInsert>(proc))) {
PBD::warning << "OSC: Plugin: " << sur->plugin_id << " does not seem to be a plugin" << endmsg;
return 1;
}
std::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
bool ok = false;
// put only input controls into a vector
sur->plug_params.clear ();
uint32_t nplug_params = pip->parameter_count();
for ( uint32_t ppi = 0; ppi < nplug_params; ++ppi) {
uint32_t controlid = pip->nth_parameter(ppi, ok);
if (!ok) {
continue;
}
if (pip->parameter_is_input(controlid)) {
sur->plug_params.push_back (ppi);
}
}

sur->plug_page = 1;

if (sur->sel_obs) {
sur->sel_obs->set_plugin_id(sur->plugins[sur->plugin_id - 1], sur->plug_page);
sur->sel_obs->set_plugin_id(sur->plugin_id, sur->plug_page);
}
return 0;
}
Expand Down Expand Up @@ -4760,11 +4733,55 @@ OSC::_strip_select2 (std::shared_ptr<Stripable> s, OSCSurface *sur, lo_address a
_select = s;
}
if (!s) {
sur->plugins.clear();
sur->plugin_input_params.clear();
return 0;
}
if (s != old_sel) {
sur->select = s;
}

/* Create list of user-visible plugins (into which piid indexes) */
sur->plugins.clear();
sur->plugin_input_params.clear();
std::shared_ptr<Route> r = std::dynamic_pointer_cast<Route>(s);
if (r) {
for (int nplugs = 0; true; ++nplugs) {
std::shared_ptr<Processor> proc = r->nth_plugin (nplugs);
if (!proc) {
break;
}
if (!r->nth_plugin(nplugs)->display_to_user()) {
continue;
}
std::shared_ptr<PluginInsert> pi = std::dynamic_pointer_cast<PluginInsert>(proc);
std::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
#ifdef MIXBUS
/* need to check for mixbus channel strips (and exclude them) */
if (pi && pi->is_channelstrip()) {
continue;
}
#endif
sur->plugins.push_back (nplugs);
sur->plugin_input_params.emplace_back();


// put only input controls into a vector
std::vector<int>& plug_params = sur->plugin_input_params.back();
bool ok = false;
uint32_t nplug_params = pip->parameter_count();
for ( uint32_t ppi = 0; ppi < nplug_params; ++ppi) {
uint32_t controlid = pip->nth_parameter(ppi, ok);
if (!ok) {
continue;
}
if (pip->parameter_is_input(controlid)) {
plug_params.push_back (ppi);
}
}
}
}

bool sends;
uint32_t nsends = 0;
do {
Expand Down Expand Up @@ -4807,7 +4824,6 @@ OSC::_strip_select2 (std::shared_ptr<Stripable> s, OSCSurface *sur, lo_address a
}
// need to set monitor for processor changed signal (for paging)
string address = lo_address_get_url (addr);
std::shared_ptr<Route> r = std::dynamic_pointer_cast<Route>(s);
if (r) {
r->processors_changed.connect (sur->proc_connection, MISSING_INVALIDATOR, boost::bind (&OSC::processor_changed, this, address), this);
_sel_plugin (sur->plugin_id, addr);
Expand Down Expand Up @@ -5192,15 +5208,15 @@ OSC::select_plugin_parameter (const char *path, const char* types, lo_arg **argv
std::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
// paid is paged parameter convert to absolute
int parid = paid + (int)sur->plug_page - 1;
if (parid > (int) sur->plug_params.size ()) {
if (parid > (int) sur->plugin_input_params[piid - 1].size ()) {
if (sur->feedback[13]) {
float_message_with_id (X_("/select/plugin/parameter"), paid, 0, sur->feedback[2], get_address (msg));
}
return 0;
}

bool ok = false;
uint32_t controlid = pip->nth_parameter(sur->plug_params[parid - 1], ok);
uint32_t controlid = pip->nth_parameter(sur->plugin_input_params[piid - 1][parid - 1], ok);
if (!ok) {
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/surfaces/osc/osc.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
int plug_page; // current plugin page
uint32_t plug_page_size; // plugin page size (number of controls)
int plugin_id; // id of current plugin
std::vector<int> plug_params; // vector to store ports that are controls
std::vector<std::vector<int>> plugin_input_params; // vector with indices of input parameters for each plugin in plugins
std::vector<int> plugins; // stores allowable plugins with index (work around MB strip PIs)
int send_page; // current send page
uint32_t send_page_size; // send page size in channels
Expand Down
11 changes: 11 additions & 0 deletions libs/surfaces/osc/osc_gui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (scene_status, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
++fn;

label = manage (new Gtk::Label(_("Report values for all plugins:")));
label->set_alignment(1, .5);
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (all_plugins, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
++fn;

fbtable->show_all ();
append_page (*fbtable, _("Default Feedback"));
// set strips and feedback from loaded default values
Expand Down Expand Up @@ -440,6 +446,7 @@ OSC_GUI::OSC_GUI (OSC& p)
use_osc10.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
trigger_status.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
scene_status.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
all_plugins.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
preset_busy = false;

}
Expand Down Expand Up @@ -696,6 +703,7 @@ OSC_GUI::reshow_values ()
use_osc10.set_active(def_feedback & 16384);
trigger_status.set_active(def_feedback & 32768);
scene_status.set_active(def_feedback & 65536);
all_plugins.set_active(def_feedback & 131072);

calculate_strip_types ();
calculate_feedback ();
Expand Down Expand Up @@ -756,6 +764,9 @@ OSC_GUI::calculate_feedback ()
if (scene_status.get_active()) {
fbvalue += 65536;
}
if (all_plugins.get_active()) {
fbvalue += 131072;
}

current_feedback.set_text(string_compose("%1", fbvalue));
}
Expand Down
1 change: 1 addition & 0 deletions libs/surfaces/osc/osc_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class OSC_GUI : public Gtk::Notebook
Gtk::CheckButton use_osc10;
Gtk::CheckButton trigger_status;
Gtk::CheckButton scene_status;
Gtk::CheckButton all_plugins;
int fbvalue;
void set_bitsets ();

Expand Down
Loading