OSC: Add setup to GUI
This commit is contained in:
parent
a83febb268
commit
d1ed84e44e
|
@ -1219,40 +1219,7 @@ OSC::refresh_surface (lo_message msg)
|
||||||
{
|
{
|
||||||
if (address_only) {
|
if (address_only) {
|
||||||
// get rid of all surfaces and observers.
|
// get rid of all surfaces and observers.
|
||||||
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end();) {
|
clear_devices();
|
||||||
|
|
||||||
OSCRouteObserver* rc;
|
|
||||||
|
|
||||||
if ((rc = dynamic_cast<OSCRouteObserver*>(*x)) != 0) {
|
|
||||||
delete *x;
|
|
||||||
x = route_observers.erase (x);
|
|
||||||
} else {
|
|
||||||
++x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Should maybe do global_observers too
|
|
||||||
for (GlobalObservers::iterator x = global_observers.begin(); x != global_observers.end();) {
|
|
||||||
|
|
||||||
OSCGlobalObserver* gc;
|
|
||||||
|
|
||||||
if ((gc = dynamic_cast<OSCGlobalObserver*>(*x)) != 0) {
|
|
||||||
delete *x;
|
|
||||||
x = global_observers.erase (x);
|
|
||||||
} else {
|
|
||||||
++x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// delete select observers
|
|
||||||
for (uint32_t it = 0; it < _surface.size(); ++it) {
|
|
||||||
OSCSurface* sur = &_surface[it];
|
|
||||||
OSCSelectObserver* so;
|
|
||||||
if ((so = dynamic_cast<OSCSelectObserver*>(sur->sel_obs)) != 0) {
|
|
||||||
delete so;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// add one from msg + port - Nope get_surface will do that for us
|
|
||||||
// but we do want to clear out surfaces
|
|
||||||
_surface.clear();
|
|
||||||
}
|
}
|
||||||
OSCSurface *s = get_surface(get_address (msg));
|
OSCSurface *s = get_surface(get_address (msg));
|
||||||
// restart all observers
|
// restart all observers
|
||||||
|
@ -1260,6 +1227,43 @@ OSC::refresh_surface (lo_message msg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC::clear_devices ()
|
||||||
|
{
|
||||||
|
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end();) {
|
||||||
|
|
||||||
|
OSCRouteObserver* rc;
|
||||||
|
|
||||||
|
if ((rc = dynamic_cast<OSCRouteObserver*>(*x)) != 0) {
|
||||||
|
delete *x;
|
||||||
|
x = route_observers.erase (x);
|
||||||
|
} else {
|
||||||
|
++x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Should maybe do global_observers too
|
||||||
|
for (GlobalObservers::iterator x = global_observers.begin(); x != global_observers.end();) {
|
||||||
|
|
||||||
|
OSCGlobalObserver* gc;
|
||||||
|
|
||||||
|
if ((gc = dynamic_cast<OSCGlobalObserver*>(*x)) != 0) {
|
||||||
|
delete *x;
|
||||||
|
x = global_observers.erase (x);
|
||||||
|
} else {
|
||||||
|
++x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// delete select observers
|
||||||
|
for (uint32_t it = 0; it < _surface.size(); ++it) {
|
||||||
|
OSCSurface* sur = &_surface[it];
|
||||||
|
OSCSelectObserver* so;
|
||||||
|
if ((so = dynamic_cast<OSCSelectObserver*>(sur->sel_obs)) != 0) {
|
||||||
|
delete so;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// clear out surfaces
|
||||||
|
_surface.clear();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, lo_message msg)
|
OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, lo_message msg)
|
||||||
|
@ -3143,8 +3147,8 @@ OSC::get_state ()
|
||||||
{
|
{
|
||||||
XMLNode& node (ControlProtocol::get_state());
|
XMLNode& node (ControlProtocol::get_state());
|
||||||
node.add_property("debugmode", (int) _debugmode); // TODO: enum2str
|
node.add_property("debugmode", (int) _debugmode); // TODO: enum2str
|
||||||
node.add_property ("address_only", address_only);
|
node.add_property ("address-only", address_only);
|
||||||
node.add_property ("remote_port", remote_port);
|
node.add_property ("remote-port", remote_port);
|
||||||
node.add_property ("banksize", default_banksize);
|
node.add_property ("banksize", default_banksize);
|
||||||
node.add_property ("striptypes", default_strip);
|
node.add_property ("striptypes", default_strip);
|
||||||
node.add_property ("feedback", default_feedback);
|
node.add_property ("feedback", default_feedback);
|
||||||
|
@ -3176,13 +3180,13 @@ OSC::set_state (const XMLNode& node, int version)
|
||||||
if (p) {
|
if (p) {
|
||||||
_debugmode = OSCDebugMode (PBD::atoi(p->value ()));
|
_debugmode = OSCDebugMode (PBD::atoi(p->value ()));
|
||||||
}
|
}
|
||||||
p = node.property (X_("address_only"));
|
p = node.property (X_("address-only"));
|
||||||
if (p) {
|
if (p) {
|
||||||
address_only = OSCDebugMode (PBD::atoi(p->value ()));
|
address_only = OSCDebugMode (PBD::atoi(p->value ()));
|
||||||
}
|
}
|
||||||
p = node.property (X_("remote_port"));
|
p = node.property (X_("remote-port"));
|
||||||
if (p) {
|
if (p) {
|
||||||
remote_port = OSCDebugMode (PBD::atoi(p->value ()));
|
remote_port = p->value ();
|
||||||
}
|
}
|
||||||
p = node.property (X_("banksize"));
|
p = node.property (X_("banksize"));
|
||||||
if (p) {
|
if (p) {
|
||||||
|
|
|
@ -129,6 +129,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
* [10] - Send Playhead position as samples
|
* [10] - Send Playhead position as samples
|
||||||
* [11] - Send Playhead position as minutes seconds
|
* [11] - Send Playhead position as minutes seconds
|
||||||
* [12] - Send Playhead position like primary/secondary GUI clocks
|
* [12] - Send Playhead position like primary/secondary GUI clocks
|
||||||
|
* [13] - Send well known feedback (for /select/command
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +140,19 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
|
||||||
std::string get_server_url ();
|
std::string get_server_url ();
|
||||||
void set_debug_mode (OSCDebugMode m) { _debugmode = m; }
|
void set_debug_mode (OSCDebugMode m) { _debugmode = m; }
|
||||||
OSCDebugMode get_debug_mode () { return _debugmode; }
|
OSCDebugMode get_debug_mode () { return _debugmode; }
|
||||||
|
int get_portmode() { return address_only; }
|
||||||
|
void set_portmode (int pm) { address_only = pm; }
|
||||||
|
int get_banksize () { return default_banksize; }
|
||||||
|
void set_banksize (int bs) {default_banksize = bs; }
|
||||||
|
int get_gainmode() { return default_gainmode; }
|
||||||
|
void set_gainmode (int gm) { default_gainmode = gm; }
|
||||||
|
int get_defaultstrip() { return default_strip; }
|
||||||
|
void set_defaultstrip (int st) { default_strip = st; }
|
||||||
|
int get_defaultfeedback() { return default_feedback; }
|
||||||
|
void set_defaultfeedback (int fb) { default_feedback = fb; }
|
||||||
|
void clear_devices ();
|
||||||
|
std::string get_remote_port () { return remote_port; }
|
||||||
|
void set_remote_port (std::string pt) { remote_port = pt; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void thread_init ();
|
void thread_init ();
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
#include <gtkmm/table.h>
|
#include <gtkmm/table.h>
|
||||||
#include <gtkmm/label.h>
|
#include <gtkmm/label.h>
|
||||||
|
#include <gtkmm/button.h>
|
||||||
|
#include <gtkmm/spinbutton.h>
|
||||||
#include <gtkmm/comboboxtext.h>
|
#include <gtkmm/comboboxtext.h>
|
||||||
|
|
||||||
#include "gtkmm2ext/gtk_ui.h"
|
#include "gtkmm2ext/gtk_ui.h"
|
||||||
|
@ -45,8 +47,20 @@ class OSC_GUI : public Gtk::VBox
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gtk::ComboBoxText debug_combo;
|
Gtk::ComboBoxText debug_combo;
|
||||||
|
Gtk::ComboBoxText portmode_combo;
|
||||||
|
Gtk::SpinButton port_entry;
|
||||||
|
Gtk::SpinButton bank_entry;
|
||||||
|
Gtk::SpinButton striptypes_spin; // dropdown would be nicer
|
||||||
|
Gtk::SpinButton feedback_spin; // dropdown would be nicer
|
||||||
|
Gtk::ComboBoxText gainmode_combo;
|
||||||
void debug_changed ();
|
void debug_changed ();
|
||||||
|
void portmode_changed ();
|
||||||
|
void gainmode_changed ();
|
||||||
|
void clear_device ();
|
||||||
|
void port_changed ();
|
||||||
|
void bank_changed ();
|
||||||
|
void strips_changed ();
|
||||||
|
void feedback_changed ();
|
||||||
OSC& cp;
|
OSC& cp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,13 +110,109 @@ OSC_GUI::OSC_GUI (OSC& p)
|
||||||
int n = 0; // table row
|
int n = 0; // table row
|
||||||
Table* table = manage (new Table);
|
Table* table = manage (new Table);
|
||||||
Label* label;
|
Label* label;
|
||||||
|
Button* button;
|
||||||
|
|
||||||
|
// show our url
|
||||||
label = manage (new Gtk::Label(_("Connection:")));
|
label = manage (new Gtk::Label(_("Connection:")));
|
||||||
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
label = manage (new Gtk::Label(cp.get_server_url()));
|
label = manage (new Gtk::Label(cp.get_server_url()));
|
||||||
table->attach (*label, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
table->attach (*label, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
++n;
|
++n;
|
||||||
|
|
||||||
|
// show and set port to auto (default) or manual (one surface only)
|
||||||
|
label = manage (new Gtk::Label(_("Port Mode:")));
|
||||||
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
table->attach (portmode_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
std::vector<std::string> portmode_options;
|
||||||
|
portmode_options.push_back (_("Auto"));
|
||||||
|
portmode_options.push_back (_("Manual"));
|
||||||
|
|
||||||
|
set_popdown_strings (portmode_combo, portmode_options);
|
||||||
|
portmode_combo.set_active ((int)cp.get_portmode());
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// port entry box
|
||||||
|
label = manage (new Gtk::Label(_("Manual Port:")));
|
||||||
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
table->attach (port_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
port_entry.set_range(1024, 0xffff);
|
||||||
|
port_entry.set_increments (1, 100);
|
||||||
|
port_entry.set_text(cp.get_remote_port().c_str());
|
||||||
|
if (!cp.get_portmode()) {
|
||||||
|
port_entry.set_sensitive (false);
|
||||||
|
}
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// default banksize setting
|
||||||
|
label = manage (new Gtk::Label(_("Bank Size:")));
|
||||||
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
table->attach (bank_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
bank_entry.set_range (0, 0xffff);
|
||||||
|
bank_entry.set_increments (1, 8);
|
||||||
|
bank_entry.set_value (cp.get_banksize());
|
||||||
|
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// Default strip types
|
||||||
|
label = manage (new Gtk::Label(_("Strip Types:")));
|
||||||
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
table->attach (striptypes_spin, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
striptypes_spin.set_range (0, 0x3ff);
|
||||||
|
striptypes_spin.set_increments (1, 10);
|
||||||
|
striptypes_spin.set_value (cp.get_defaultstrip());
|
||||||
|
|
||||||
|
/* std::vector<std::string> strip_options;
|
||||||
|
strip_options.push_back (_("Audio Tracks"));
|
||||||
|
strip_options.push_back (_("Midi Tracks"));
|
||||||
|
strip_options.push_back (_("Audio Buses"));
|
||||||
|
strip_options.push_back (_("Midi Buses"));
|
||||||
|
strip_options.push_back (_("Control Masters"));
|
||||||
|
strip_options.push_back (_("Master"));
|
||||||
|
strip_options.push_back (_("Monitor"));
|
||||||
|
strip_options.push_back (_("Selected"));
|
||||||
|
strip_options.push_back (_("Hidden"));*/
|
||||||
|
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// default feedback settings
|
||||||
|
label = manage (new Gtk::Label(_("Feedback:")));
|
||||||
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
table->attach (feedback_spin, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
feedback_spin.set_range (0, 0x3fff);
|
||||||
|
feedback_spin.set_increments (1, 10);
|
||||||
|
feedback_spin.set_value (cp.get_defaultfeedback());
|
||||||
|
/*std::vector<std::string> feedback_options;
|
||||||
|
feedback_options.push_back (_("Strip Buttons"));
|
||||||
|
feedback_options.push_back (_("Strip Controls"));
|
||||||
|
feedback_options.push_back (_("Use SSID as Path Extension"));
|
||||||
|
feedback_options.push_back (_("Send heart beat"));
|
||||||
|
feedback_options.push_back (_("Master and Transport Feedback"));
|
||||||
|
feedback_options.push_back (_("Send Bar and Beat"));
|
||||||
|
feedback_options.push_back (_("Send SMPTE Time"));
|
||||||
|
feedback_options.push_back (_("Send metering"));
|
||||||
|
feedback_options.push_back (_("Send LED strip metering"));
|
||||||
|
feedback_options.push_back (_("Signal Present"));
|
||||||
|
feedback_options.push_back (_("Strip Controls"));
|
||||||
|
feedback_options.push_back (_("Playhead Position as Samples"));
|
||||||
|
feedback_options.push_back (_("Playhead Position as Minutes Seconds"));
|
||||||
|
feedback_options.push_back (_("Playhead Position as per GUI Clock"));
|
||||||
|
feedback_options.push_back (_("Extra Select Channel Controls"));*/
|
||||||
|
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// Gain Mode
|
||||||
|
label = manage (new Gtk::Label(_("Gain Mode:")));
|
||||||
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
table->attach (gainmode_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
std::vector<std::string> gainmode_options;
|
||||||
|
gainmode_options.push_back (_("dB"));
|
||||||
|
gainmode_options.push_back (_("Position"));
|
||||||
|
|
||||||
|
set_popdown_strings (gainmode_combo, gainmode_options);
|
||||||
|
gainmode_combo.set_active ((int)cp.get_gainmode());
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// debug setting
|
||||||
label = manage (new Gtk::Label(_("Debug:")));
|
label = manage (new Gtk::Label(_("Debug:")));
|
||||||
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
table->attach (debug_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
table->attach (debug_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
|
@ -114,11 +224,23 @@ OSC_GUI::OSC_GUI (OSC& p)
|
||||||
|
|
||||||
set_popdown_strings (debug_combo, debug_options);
|
set_popdown_strings (debug_combo, debug_options);
|
||||||
debug_combo.set_active ((int)cp.get_debug_mode());
|
debug_combo.set_active ((int)cp.get_debug_mode());
|
||||||
|
++n;
|
||||||
|
|
||||||
|
// refresh button
|
||||||
|
button = manage (new Gtk::Button(_("Clear OSC Devices")));
|
||||||
|
table->attach (*button, 0, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
|
||||||
|
|
||||||
table->show_all ();
|
table->show_all ();
|
||||||
pack_start (*table, false, false);
|
pack_start (*table, false, false);
|
||||||
|
|
||||||
debug_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::debug_changed));
|
debug_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::debug_changed));
|
||||||
|
portmode_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::portmode_changed));
|
||||||
|
gainmode_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::gainmode_changed));
|
||||||
|
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));
|
||||||
|
striptypes_spin.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::strips_changed));
|
||||||
|
feedback_spin.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::feedback_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
OSC_GUI::~OSC_GUI ()
|
OSC_GUI::~OSC_GUI ()
|
||||||
|
@ -143,3 +265,72 @@ OSC_GUI::debug_changed ()
|
||||||
assert (0);
|
assert (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::portmode_changed ()
|
||||||
|
{
|
||||||
|
std::string str = portmode_combo.get_active_text ();
|
||||||
|
if (str == _("Auto")) {
|
||||||
|
cp.set_portmode (0);
|
||||||
|
port_entry.set_sensitive (false);
|
||||||
|
}
|
||||||
|
else if (str == _("Manual")) {
|
||||||
|
cp.set_portmode (1);
|
||||||
|
port_entry.set_sensitive (true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "Invalid OSC Port Mode\n";
|
||||||
|
assert (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::port_changed ()
|
||||||
|
{
|
||||||
|
std::string str = port_entry.get_text ();
|
||||||
|
cp.set_remote_port (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::bank_changed ()
|
||||||
|
{
|
||||||
|
uint32_t bsize = bank_entry.get_value ();
|
||||||
|
cp.set_banksize (bsize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::strips_changed ()
|
||||||
|
{
|
||||||
|
uint32_t st = striptypes_spin.get_value ();
|
||||||
|
cp.set_defaultstrip (st);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::feedback_changed ()
|
||||||
|
{
|
||||||
|
uint32_t fb = feedback_spin.get_value ();
|
||||||
|
cp.set_defaultfeedback (fb);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::gainmode_changed ()
|
||||||
|
{
|
||||||
|
std::string str = gainmode_combo.get_active_text ();
|
||||||
|
if (str == _("dB")) {
|
||||||
|
cp.set_gainmode (0);
|
||||||
|
}
|
||||||
|
else if (str == _("Position")) {
|
||||||
|
cp.set_gainmode (1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "Invalid OSC Gain Mode\n";
|
||||||
|
assert (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
OSC_GUI::clear_device ()
|
||||||
|
{
|
||||||
|
cp.clear_devices();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user