X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fcontrol_protocol%2Fcontrol_protocol%2Fcontrol_protocol.h;h=d0294511f69df4c5b1c0b020d54bbcef336a807c;hb=e0ff70cf86c01c42f98faf8b0eaf1a8ccf867946;hp=9efb4b299c8a0314ab586c7c4c01ee91f24f98d1;hpb=b65f8073ba306ac2d85133875746767e7c6b0eb6;p=ardour.git diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index 9efb4b299c..d0294511f6 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser @@ -24,49 +24,79 @@ #include #include #include + #include -#include -#include -#include + +#include "pbd/stateful.h" +#include "pbd/signals.h" + +#include "control_protocol/visibility.h" +#include "control_protocol/basic_ui.h" +#include "control_protocol/types.h" namespace ARDOUR { class Route; class Session; +class Bundle; -class ControlProtocol : public sigc::trackable, public PBD::Stateful, public BasicUI { +class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI +{ public: ControlProtocol (Session&, std::string name); virtual ~ControlProtocol(); std::string name() const { return _name; } - virtual int set_active (bool yn) = 0; - bool get_active() const { return _active; } + virtual int set_active (bool yn); + bool active() const { return _active; } virtual int set_feedback (bool /*yn*/) { return 0; } virtual bool get_feedback () const { return false; } - virtual void route_list_changed () {} + virtual void midi_connectivity_established () {} - sigc::signal ActiveChanged; + PBD::Signal0 ActiveChanged; /* signals that a control protocol can emit and other (presumably graphical) user interfaces can respond to */ - static sigc::signal ZoomToSession; - static sigc::signal ZoomIn; - static sigc::signal ZoomOut; - static sigc::signal Enter; - static sigc::signal ScrollTimeline; + static PBD::Signal0 ZoomToSession; + static PBD::Signal0 ZoomIn; + static PBD::Signal0 ZoomOut; + static PBD::Signal0 Enter; + static PBD::Signal0 Undo; + static PBD::Signal0 Redo; + static PBD::Signal1 ScrollTimeline; + static PBD::Signal1 GotoView; + static PBD::Signal0 CloseDialog; + static PBD::Signal0 VerticalZoomInAll; + static PBD::Signal0 VerticalZoomOutAll; + static PBD::Signal0 VerticalZoomInSelected; + static PBD::Signal0 VerticalZoomOutSelected; + static PBD::Signal0 StepTracksDown; + static PBD::Signal0 StepTracksUp; + + static PBD::Signal1 AddRouteToSelection; + static PBD::Signal1 SetRouteSelection; + static PBD::Signal1 ToggleRouteSelection; + static PBD::Signal1 RemoveRouteFromSelection; + static PBD::Signal0 ClearRouteSelection; + + /* signals that one UI (e.g. the GUI) can emit to get all other UI's to + respond. Typically this will always be GUI->"others" - the GUI pays + no attention to these signals. + */ + + static PBD::Signal1 TrackSelectionChanged; /* the model here is as follows: we imagine most control surfaces being able to control from 1 to N tracks at a time, with a session that may contain 1 to M tracks, where M may be smaller, larger or - equal to N. + equal to N. the control surface has a fixed set of physical controllers which can potentially be mapped onto different tracks/busses @@ -98,29 +128,50 @@ class ControlProtocol : public sigc::trackable, public PBD::Stateful, public Bas std::string route_get_name (uint32_t table_index); + virtual std::list > bundles (); + + virtual bool has_editor () const { return false; } + virtual void* get_gui() const { return 0; } + virtual void tear_down_gui() { } + + XMLNode& get_state (); + int set_state (XMLNode const &, int version); + + static const std::string state_node_name; + protected: std::vector > route_table; std::string _name; - bool _active; - - void add_strip (std::list >); void next_track (uint32_t initial_id); void prev_track (uint32_t initial_id); + + private: + LIBCONTROLCP_LOCAL ControlProtocol (const ControlProtocol&); /* noncopyable */ + bool _active; }; extern "C" { - struct ControlProtocolDescriptor { - 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*); - + 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*); + /* this is required if the control protocol connects to signals + from libardour. they all do. It should allocate a + type-specific request buffer for the calling thread, and + store it in a thread-local location that will be used to + find it when sending the event loop a message + (e.g. call_slot()). It should also return the allocated + buffer as a void*. + */ + void* (*request_buffer_factory)(uint32_t); }; }