Refactor Ctrl Surface API

* reserve "probe" to actually probe for devices
* use separate probe for libusb and MIDI port devices
* use "available" to check if surface can be used
* allow both methods to be NULL
* remove unused ControlProtocolDescriptor* argument

Most surface just return `true` for available.
This commit is contained in:
Robin Gareus
2023-05-01 03:32:00 +02:00
parent 7c02ab9937
commit 65346496f5
38 changed files with 203 additions and 321 deletions

View File

@@ -26,8 +26,7 @@ using namespace ARDOUR;
using namespace ArdourSurface;
static ControlProtocol*
new_ardour_websockets_protocol (ControlProtocolDescriptor* /*descriptor*/,
Session* s)
new_ardour_websockets_protocol (Session* s)
{
ArdourWebsockets* surface = new ArdourWebsockets (*s);
@@ -37,25 +36,20 @@ new_ardour_websockets_protocol (ControlProtocolDescriptor* /*descriptor*/,
}
static void
delete_ardour_websockets_protocol (ControlProtocolDescriptor* /*descriptor*/,
ControlProtocol* cp)
delete_ardour_websockets_protocol (ControlProtocol* cp)
{
delete cp;
}
static bool
probe_ardour_websockets_protocol (ControlProtocolDescriptor* /*descriptor*/)
{
return true;
}
static ControlProtocolDescriptor ardour_websockets_descriptor = {
/*name : */ surface_name,
/*id : */ surface_id,
/*module : */ 0,
/*probe : */ probe_ardour_websockets_protocol,
/*initialize : */ new_ardour_websockets_protocol,
/*destroy : */ delete_ardour_websockets_protocol,
/* name */ surface_name,
/* id */ surface_id,
/* module */ 0,
/* available */ 0,
/* probe_port */ 0,
/* match usb */ 0,
/* initialize */ new_ardour_websockets_protocol,
/* destroy */ delete_ardour_websockets_protocol,
};
extern "C" ARDOURSURFACE_API ControlProtocolDescriptor*