13
0

OSC: Add send/plugin page values to GUI

This commit is contained in:
Len Ovens 2017-06-14 10:28:45 -07:00
parent d76e6d84c7
commit 7c84deb2c4
5 changed files with 107 additions and 2 deletions

View File

@ -98,6 +98,8 @@ OSC::OSC (Session& s, uint32_t port)
, default_strip (159)
, default_feedback (0)
, default_gainmode (0)
, default_send_size (0)
, default_plugin_size (0)
, tick (true)
, bank_dirty (false)
, scrub_speed (0)
@ -1659,9 +1661,9 @@ OSC::get_surface (lo_address addr)
s.aux = 0;
s.strips = get_sorted_stripables(s.strip_types, s.cue);
s.send_page = 1;
s.send_page_size = 0;
s.send_page_size = default_send_size;
s.plug_page = 1;
s.plug_page_size = 0;
s.plug_page_size = default_plugin_size;
s.plugin_id = 1;
s.nstrips = s.strips.size();
@ -4660,6 +4662,8 @@ OSC::get_state ()
node.set_property ("striptypes", default_strip);
node.set_property ("feedback", default_feedback);
node.set_property ("gainmode", default_gainmode);
node.set_property ("send-page-size", default_send_size);
node.set_property ("plug-page-size", default_plugin_size);
if (_surface.size()) {
XMLNode* config = new XMLNode (X_("Configurations"));
for (uint32_t it = 0; it < _surface.size(); ++it) {
@ -4699,6 +4703,8 @@ OSC::set_state (const XMLNode& node, int version)
node.get_property (X_("striptypes"), default_strip);
node.get_property (X_("feedback"), default_feedback);
node.get_property (X_("gainmode"), default_gainmode);
node.get_property (X_("send-page-size"), default_send_size);
node.get_property (X_("plugin-page-size"), default_plugin_size);
XMLNode* cnode = node.child (X_("Configurations"));

View File

@ -178,6 +178,10 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
void set_defaultstrip (int st) { default_strip = st; }
int get_defaultfeedback() { return default_feedback; }
void set_defaultfeedback (int fb) { default_feedback = fb; }
int get_send_size() { return default_send_size; }
void set_send_size (int ss) { default_send_size = ss; }
int get_plugin_size() { return default_plugin_size; }
void set_plugin_size (int ps) { default_plugin_size = ps; }
void clear_devices ();
void gui_changed ();
std::string get_remote_port () { return remote_port; }
@ -207,6 +211,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
uint32_t default_strip;
uint32_t default_feedback;
uint32_t default_gainmode;
uint32_t default_send_size;
uint32_t default_plugin_size;
bool tick;
bool bank_dirty;
float scrub_speed; // Current scrub speed

View File

@ -111,6 +111,28 @@ OSC_GUI::OSC_GUI (OSC& p)
++n;
// default send page setting
label = manage (new Gtk::Label(_("Send Page Size:")));
label->set_alignment(1, .5);
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (send_page_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
send_page_entry.set_range (0, 0xffff);
send_page_entry.set_increments (1, 8);
send_page_entry.set_value (cp.get_send_size());
++n;
// default plugin page setting
label = manage (new Gtk::Label(_("Plugin Page Size:")));
label->set_alignment(1, .5);
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (plugin_page_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
plugin_page_entry.set_range (0, 0xffff);
plugin_page_entry.set_increments (1, 8);
plugin_page_entry.set_value (cp.get_send_size());
++n;
// Gain Mode
label = manage (new Gtk::Label(_("Gain Mode:")));
label->set_alignment(1, .5);
@ -173,6 +195,8 @@ OSC_GUI::OSC_GUI (OSC& p)
button->signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::clear_device));
port_entry.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::port_changed));
bank_entry.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::bank_changed));
send_page_entry.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::send_page_changed));
plugin_page_entry.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::plugin_page_changed));
// Strip Types Calculate Page
int stn = 0; // table row
@ -516,6 +540,24 @@ OSC_GUI::bank_changed ()
}
void
OSC_GUI::send_page_changed ()
{
uint32_t ssize = send_page_entry.get_value ();
cp.set_send_size (ssize);
save_user ();
}
void
OSC_GUI::plugin_page_changed ()
{
uint32_t psize = plugin_page_entry.get_value ();
cp.set_plugin_size (psize);
save_user ();
}
void
OSC_GUI::gainmode_changed ()
{
@ -556,6 +598,7 @@ OSC_GUI::preset_changed ()
else {
load_preset (str);
}
cp.clear_devices ();
preset_busy = false;
}
@ -564,6 +607,10 @@ OSC_GUI::factory_reset ()
{
cp.set_banksize (0);
bank_entry.set_value (0);
cp.set_send_size (0);
send_page_entry.set_value (0);
cp.set_plugin_size (0);
plugin_page_entry.set_value (0);
cp.set_defaultstrip (159);
cp.set_defaultfeedback (0);
reshow_values ();
@ -799,6 +846,14 @@ OSC_GUI::save_user ()
child->set_property ("value", cp.get_banksize());
node->add_child_nocopy (*child);
child = new XMLNode ("Send-Size");
child->set_property ("value", cp.get_send_size());
node->add_child_nocopy (*child);
child = new XMLNode ("Plugin-Size");
child->set_property ("value", cp.get_plugin_size());
node->add_child_nocopy (*child);
child = new XMLNode ("Strip-Types");
child->set_property ("value", cp.get_defaultstrip());
node->add_child_nocopy (*child);
@ -873,6 +928,20 @@ OSC_GUI::load_preset (std::string preset)
cp.set_banksize (atoi (prop->value().c_str()));
bank_entry.set_value (atoi (prop->value().c_str()));
}
if ((child = root->child ("Send-Size")) == 0 || (prop = child->property ("value")) == 0) {
cp.set_send_size (sesn_send);
send_page_entry.set_value (sesn_send);
} else {
cp.set_send_size (atoi (prop->value().c_str()));
send_page_entry.set_value (atoi (prop->value().c_str()));
}
if ((child = root->child ("Plugin-Size")) == 0 || (prop = child->property ("value")) == 0) {
cp.set_plugin_size (sesn_plugin);
plugin_page_entry.set_value (sesn_plugin);
} else {
cp.set_plugin_size (atoi (prop->value().c_str()));
plugin_page_entry.set_value (atoi (prop->value().c_str()));
}
if ((child = root->child ("Strip-Types")) == 0 || (prop = child->property ("value")) == 0) {
cp.set_defaultstrip (sesn_strips);
} else {
@ -903,6 +972,8 @@ OSC_GUI::get_session ()
sesn_portmode = cp.get_portmode ();
sesn_port = cp.get_remote_port ();
sesn_bank = cp.get_banksize ();
sesn_send = cp.get_send_size ();
sesn_plugin = cp.get_plugin_size ();
sesn_strips = cp.get_defaultstrip ();
sesn_feedback = cp.get_defaultfeedback ();
sesn_gainmode = cp.get_gainmode ();
@ -917,6 +988,10 @@ OSC_GUI::restore_sesn_values ()
port_entry.set_text (sesn_port);
cp.set_banksize (sesn_bank);
bank_entry.set_value (sesn_bank);
cp.set_send_size (sesn_send);
send_page_entry.set_value (sesn_send);
cp.set_plugin_size (sesn_plugin);
plugin_page_entry.set_value (sesn_plugin);
cp.set_defaultstrip (sesn_strips);
cp.set_defaultfeedback (sesn_feedback);
reshow_values ();

View File

@ -45,6 +45,8 @@ private:
Gtk::ComboBoxText portmode_combo;
Gtk::SpinButton port_entry;
Gtk::SpinButton bank_entry;
Gtk::SpinButton send_page_entry;
Gtk::SpinButton plugin_page_entry;
Gtk::ComboBoxText gainmode_combo;
Gtk::ComboBoxText preset_combo;
std::vector<std::string> preset_options;
@ -55,6 +57,8 @@ private:
uint32_t sesn_portmode;
std::string sesn_port;
uint32_t sesn_bank;
uint32_t sesn_send;
uint32_t sesn_plugin;
uint32_t sesn_strips;
uint32_t sesn_feedback;
uint32_t sesn_gainmode;
@ -70,6 +74,8 @@ private:
void reshow_values ();
void port_changed ();
void bank_changed ();
void send_page_changed ();
void plugin_page_changed ();
void strips_changed ();
void feedback_changed ();
void preset_changed ();

12
osc/basic-touchosc.preset Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<OSCPreset>
<Name value="Basic TouchOSC"/>
<PortMode value="1"/>
<Remote-Port value="8000"/>
<Bank-Size value="0"/>
<Send-Size value="0"/>
<Plugin-Size value="0"/>
<Strip-Types value="159"/>
<Feedback value="4"/>
<Gain-Mode value="1"/>
</OSCPreset>