Clean up ctrl surface API

Remove unused fields, no mandatory surfaces
This commit is contained in:
Robin Gareus 2023-05-01 02:22:45 +02:00
parent 0b355c0412
commit 847f1e54c1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
20 changed files with 6 additions and 100 deletions

View File

@ -48,12 +48,13 @@ class LIBARDOUR_API ControlProtocolInfo {
std::string name;
std::string path;
bool requested;
bool mandatory;
bool supports_feedback;
XMLNode* state;
ControlProtocolInfo() : descriptor (0), protocol (0), requested(false),
mandatory(false), supports_feedback(false), state (0)
ControlProtocolInfo()
: descriptor (0)
, protocol (0)
, requested(false)
, state (0)
{}
~ControlProtocolInfo();
@ -69,7 +70,6 @@ class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR
void set_session (Session*);
void discover_control_protocols ();
void foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)>);
void load_mandatory_protocols ();
void midi_connectivity_established ();
void drop_protocols ();

View File

@ -100,7 +100,7 @@ ControlProtocolManager::set_session (Session* s)
Glib::Threads::RWLock::ReaderLock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
if ((*i)->requested || (*i)->mandatory) {
if ((*i)->requested) {
(void) activate (**i);
}
}
@ -262,10 +262,6 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi, bool lock_required)
return 0;
}
if (cpi.mandatory) {
return 0;
}
/* save current state */
delete cpi.state;
@ -306,24 +302,6 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi, bool lock_required)
return 0;
}
void
ControlProtocolManager::load_mandatory_protocols ()
{
if (_session == 0) {
return;
}
Glib::Threads::RWLock::ReaderLock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
if ((*i)->mandatory && ((*i)->protocol == 0)) {
DEBUG_TRACE (DEBUG::ControlProtocols,
string_compose (_("Instantiating mandatory control protocol %1"), (*i)->name));
instantiate (**i);
}
}
}
struct ControlProtocolOrderByName
{
bool operator() (ControlProtocolInfo* const & a, ControlProtocolInfo* const & b) const {
@ -406,8 +384,6 @@ ControlProtocolManager::control_protocol_discover (string path)
cpi->path = path;
cpi->protocol = 0;
cpi->requested = false;
cpi->mandatory = descriptor->mandatory;
cpi->supports_feedback = descriptor->supports_feedback;
cpi->state = 0;
control_protocol_info.push_back (cpi);

View File

@ -173,10 +173,7 @@ class ControlProtocolDescriptor
public:
const char* name; /* descriptive */
const char* id; /* unique and version-specific */
void* ptr; /* protocol can store a value here */
void* module; /* not for public access */
int mandatory; /* if non-zero, always load and do not make optional */
bool supports_feedback; /* if true, protocol has toggleable feedback mechanism */
bool (*probe) (ControlProtocolDescriptor*);
ControlProtocol* (*initialize) (ControlProtocolDescriptor*, Session*);
void (*destroy) (ControlProtocolDescriptor*, ControlProtocol*);

View File

@ -59,10 +59,7 @@ probe_cc121_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor cc121_midi_descriptor = {
/*name : */ "Steinberg CC121",
/*id : */ "uri://ardour.org/surfaces/cc121:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_cc121_midi_protocol,
/*initialize : */ new_cc121_midi_protocol,
/*destroy : */ delete_cc121_midi_protocol,

View File

@ -52,10 +52,7 @@ probe_contourdesign_protocol (ControlProtocolDescriptor*)
static ControlProtocolDescriptor contourdesign_descriptor = {
/* name : */ "ContourDesign",
/* id : */ "uri://ardour.org/surfaces/contourdesign:0",
/* ptr : */ 0,
/* module : */ 0,
/* mandatory : */ 0,
/* supports_feedback : */ false,
/* probe : */ probe_contourdesign_protocol,
/* initialize : */ new_contourdesign_protocol,
/* destroy : */ delete_contourdesign_protocol,

View File

@ -59,10 +59,7 @@ probe_faderport_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor faderport_midi_descriptor = {
/*name : */ "PreSonus FaderPort",
/*id : */ "uri://ardour.org/surfaces/faderport:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_faderport_midi_protocol,
/*initialize : */ new_faderport_midi_protocol,
/*destroy : */ delete_faderport_midi_protocol,

View File

@ -58,10 +58,7 @@ probe_faderport16_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor faderport16_midi_descriptor = {
/*name : */ "PreSonus FaderPort16",
/*id : */ "uri://ardour.org/surfaces/faderport16:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_faderport16_midi_protocol,
/*initialize : */ new_faderport16_midi_protocol,
/*destroy : */ delete_faderport16_midi_protocol,

View File

@ -58,10 +58,7 @@ probe_faderport2_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor faderport2_midi_descriptor = {
/*name : */ "PreSonus FaderPort2",
/*id : */ "uri://ardour.org/surfaces/faderport2:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_faderport2_midi_protocol,
/*initialize : */ new_faderport2_midi_protocol,
/*destroy : */ delete_faderport2_midi_protocol,

View File

@ -58,10 +58,7 @@ probe_faderport8_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor faderport8_midi_descriptor = {
/*name : */ "PreSonus FaderPort8",
/*id : */ "uri://ardour.org/surfaces/faderport8:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_faderport8_midi_protocol,
/*initialize : */ new_faderport8_midi_protocol,
/*destroy : */ delete_faderport8_midi_protocol,

View File

@ -50,10 +50,7 @@ probe_tranzport_protocol (ControlProtocolDescriptor* descriptor)
static ControlProtocolDescriptor tranzport_descriptor = {
name : "Tranzport",
id : "uri://ardour.org/surfaces/tranzport:0",
ptr : 0,
module : 0,
mandatory : 0,
supports_feedback : false,
probe : probe_tranzport_protocol,
initialize : new_tranzport_protocol,
destroy : delete_tranzport_protocol

View File

@ -59,10 +59,7 @@ probe_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor generic_midi_descriptor = {
/*name : */ "Generic MIDI",
/*id : */ "uri://ardour.org/surfaces/generic_midi:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_generic_midi_protocol,
/*initialize : */ new_generic_midi_protocol,
/*destroy : */ delete_generic_midi_protocol,

View File

@ -77,14 +77,7 @@ probe_launch_control_xl (ControlProtocolDescriptor*)
static ControlProtocolDescriptor launch_control_xl_descriptor = {
/*name : */ "Novation Launch Control XL",
/*id : */ "uri://ardour.org/surfaces/launch_control_xl:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
// actually, the surface does support feedback, but all this
// flag does is show a submenu on the UI, which is useless for the mackie
// because feedback is always on. In any case, who'd want to use the
// mcu without the motorised sliders doing their thing?
/*supports_feedback : */ true,
/*probe : */ probe_launch_control_xl,
/*initialize : */ new_launch_control_xl,
/*destroy : */ delete_launch_control_xl,

View File

@ -81,14 +81,7 @@ probe_mackie_protocol (ControlProtocolDescriptor*)
static ControlProtocolDescriptor mackie_descriptor = {
/*name : */ "Mackie",
/*id : */ "uri://ardour.org/surfaces/mackie:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
// actually, the surface does support feedback, but all this
// flag does is show a submenu on the UI, which is useless for the mackie
// because feedback is always on. In any case, who'd want to use the
// mcu without the motorised sliders doing their thing?
/*supports_feedback : */ false,
/*probe : */ probe_mackie_protocol,
/*initialize : */ new_mackie_protocol,
/*destroy : */ delete_mackie_protocol,

View File

@ -60,10 +60,7 @@ probe_maschine2 (ControlProtocolDescriptor*)
static ControlProtocolDescriptor maschine2_descriptor = {
/*name : */ "NI Maschine2",
/*id : */ "uri://ardour.org/surfaces/maschine2:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ false,
/*probe : */ probe_maschine2,
/*initialize : */ new_maschine2,
/*destroy : */ delete_maschine2,

View File

@ -49,10 +49,7 @@ probe_osc_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor osc_descriptor = {
/*name : */ "Open Sound Control (OSC)",
/*id : */ "uri://ardour.org/surfaces/osc:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_osc_protocol,
/*initialize : */ new_osc_protocol,
/*destroy : */ delete_osc_protocol,

View File

@ -75,14 +75,7 @@ probe_push2 (ControlProtocolDescriptor*)
static ControlProtocolDescriptor push2_descriptor = {
/*name : */ "Ableton Push 2",
/*id : */ "uri://ardour.org/surfaces/push2:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
// actually, the surface does support feedback, but all this
// flag does is show a submenu on the UI, which is useless for the mackie
// because feedback is always on. In any case, who'd want to use the
// mcu without the motorised sliders doing their thing?
/*supports_feedback : */ false,
/*probe : */ probe_push2,
/*initialize : */ new_push2,
/*destroy : */ delete_push2,

View File

@ -52,10 +52,7 @@ probe_tranzport_protocol (ControlProtocolDescriptor* descriptor)
static ControlProtocolDescriptor tranzport_descriptor = {
name : "Tranzport",
id : "uri://ardour.org/surfaces/tranzport:0",
ptr : 0,
module : 0,
mandatory : 0,
supports_feedback : false,
probe : probe_tranzport_protocol,
initialize : new_tranzport_protocol,
destroy : delete_tranzport_protocol

View File

@ -78,14 +78,7 @@ probe_us2400_protocol (ControlProtocolDescriptor*)
static ControlProtocolDescriptor us2400_descriptor = {
/*name : */ "Tascam US-2400",
/*id : */ "uri://ardour.org/surfaces/us2400:0",
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
// actually, the surface does support feedback, but all this
// flag does is show a submenu on the UI, which is useless for the mackie
// because feedback is always on. In any case, who'd want to use the
// mcu without the motorised sliders doing their thing?
/*supports_feedback : */ false,
/*probe : */ probe_us2400_protocol,
/*initialize : */ new_us2400_protocol,
/*destroy : */ delete_us2400_protocol,

View File

@ -52,10 +52,7 @@ probe_ardour_websockets_protocol (ControlProtocolDescriptor* /*descriptor*/)
static ControlProtocolDescriptor ardour_websockets_descriptor = {
/*name : */ surface_name,
/*id : */ surface_id,
/*ptr : */ 0,
/*module : */ 0,
/*mandatory : */ 0,
/*supports_feedback : */ true,
/*probe : */ probe_ardour_websockets_protocol,
/*initialize : */ new_ardour_websockets_protocol,
/*destroy : */ delete_ardour_websockets_protocol,

View File

@ -50,10 +50,7 @@ probe_wiimote_protocol (ControlProtocolDescriptor*)
static ControlProtocolDescriptor wiimote_descriptor = {
name : "Wiimote",
id : "uri://ardour.org/surfaces/wiimote:0",
ptr : 0,
module : 0,
mandatory : 0,
supports_feedback : false,
probe : probe_wiimote_protocol,
initialize : new_wiimote_protocol,
destroy : delete_wiimote_protocol,