diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/configuration_vars.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/control_protocol.h | 45 | ||||
-rw-r--r-- | libs/ardour/ardour/generic_midi_control_protocol.h | 31 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 36 | ||||
-rw-r--r-- | libs/ardour/ardour/tranzport_control_protocol.h | 142 |
5 files changed, 242 insertions, 15 deletions
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 7d3a9db8b8..d54264c1c0 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -33,11 +33,12 @@ CONFIG_VARIABLE(bool, timecode_source_is_synced, "timecode-source-is-synced", tr CONFIG_VARIABLE(bool, latched_record_enable, "latched-record-enable", false) CONFIG_VARIABLE(bool, use_vst, "use-vst", true) CONFIG_VARIABLE(bool, quieten_at_speed, "quieten-at-speed", true) -CONFIG_VARIABLE(uint32_t, midi_feedback_interval_ms, "midi-feedback-interval-ms", 100) +CONFIG_VARIABLE(uint32_t, feedback_interval_ms, "feedback-interval-ms", 100) CONFIG_VARIABLE(uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000) CONFIG_VARIABLE(uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2) CONFIG_VARIABLE(SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat) CONFIG_VARIABLE(HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE) +CONFIG_VARIABLE(bool, use_tranzport, "use-tranzport", false) /* these variables have custom set() methods */ diff --git a/libs/ardour/ardour/control_protocol.h b/libs/ardour/ardour/control_protocol.h new file mode 100644 index 0000000000..c0869fad9a --- /dev/null +++ b/libs/ardour/ardour/control_protocol.h @@ -0,0 +1,45 @@ +#ifndef ardour_control_protocols_h +#define ardour_control_protocols_h + +#include <string> +#include <list> +#include <sigc++/sigc++.h> + +namespace ARDOUR { + +class Route; +class Session; + +class ControlProtocol : sigc::trackable { + public: + ControlProtocol (Session&, std::string name); + virtual ~ControlProtocol(); + + virtual int init () { return 0; } + virtual bool active() const = 0; + + enum SendWhat { + SendRoute, + SendGlobal + }; + + std::string name() const { return _name; } + + void set_send (SendWhat); + + bool send() const { return _send != 0; } + bool send_route_feedback () const { return _send & SendRoute; } + bool send_global_feedback () const { return _send & SendGlobal; } + + virtual void send_route_feedback (std::list<Route*>&) {} + virtual void send_global_feedback () {} + + protected: + ARDOUR::Session& session; + SendWhat _send; + std::string _name; +}; + +} + +#endif // ardour_control_protocols_h diff --git a/libs/ardour/ardour/generic_midi_control_protocol.h b/libs/ardour/ardour/generic_midi_control_protocol.h new file mode 100644 index 0000000000..75b514f016 --- /dev/null +++ b/libs/ardour/ardour/generic_midi_control_protocol.h @@ -0,0 +1,31 @@ +#ifndef ardour_generic_midi_control_protocol_h +#define ardour_generic_midi_control_protocol_h + +#include <ardour/control_protocol.h> + +namespace MIDI { + class Port; +} + +namespace ARDOUR { + +class GenericMidiControlProtocol : public ControlProtocol { + public: + GenericMidiControlProtocol (Session&); + virtual ~GenericMidiControlProtocol(); + + bool active() const; + + void set_port (MIDI::Port*); + MIDI::Port* port () const { return _port; } + + void send_route_feedback (std::list<Route*>&); + + private: + void route_feedback (ARDOUR::Route&, bool); + MIDI::Port* _port; +}; + +} + +#endif // ardour_generic_midi_control_protocol_h diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 1e25c5f38b..1f6f464d24 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -22,12 +22,7 @@ #define __ardour_session_h__ #include <string> -#if __GNUC__ >= 3 -#include <ext/slist> -using __gnu_cxx::slist; -#else -#include <slist.h> -#endif +#include <list> #include <map> #include <vector> #include <set> @@ -84,6 +79,8 @@ class AudioRegion; class Region; class Playlist; class VSTPlugin; +class ControlProtocol; +class GenericMidiControlProtocol; struct AudioExportSpecification; struct RouteGroup; @@ -283,7 +280,7 @@ class Session : public sigc::trackable, public Stateful void foreach_diskstream (void (DiskStream::*func)(void)); template<class T> void foreach_diskstream (T *obj, void (T::*func)(DiskStream&)); - typedef slist<Route *> RouteList; + typedef list<Route *> RouteList; RouteList get_routes() const { RWLockMonitor rlock (route_lock, false, __LINE__, __FILE__); @@ -303,6 +300,7 @@ class Session : public sigc::trackable, public Stateful template<class T, class A> void foreach_route (T *obj, void (T::*func)(Route&, A), A arg); Route *route_by_name (string); + Route *route_by_remote_id (uint32_t id); bool route_name_unique (string) const; @@ -407,7 +405,9 @@ class Session : public sigc::trackable, public Stateful CrossfadingModel, SeamlessLoop, MidiFeedback, - MidiControl + MidiControl, + TranzportControl, + Feedback }; sigc::signal<void,ControlType> ControlChanged; @@ -428,6 +428,7 @@ class Session : public sigc::trackable, public Stateful void set_do_not_record_plugins (bool yn); void set_crossfades_active (bool yn); void set_seamless_loop (bool yn); + void set_feedback (bool yn); bool get_auto_play () const { return auto_play; } bool get_auto_input () const { return auto_input; } @@ -444,6 +445,8 @@ class Session : public sigc::trackable, public Stateful bool get_midi_control () const; bool get_do_not_record_plugins () const { return do_not_record_plugins; } bool get_crossfades_active () const { return crossfades_active; } + bool get_feedback() const; + bool get_tranzport_control() const; bool get_input_auto_connect () const; AutoConnectOption get_output_auto_connect () const { return output_auto_connect; } @@ -815,7 +818,6 @@ class Session : public sigc::trackable, public Stateful bool get_trace_midi_output(MIDI::Port *port = 0); void send_midi_message (MIDI::Port * port, MIDI::eventType ev, MIDI::channel_t, MIDI::EventTwoBytes); - void send_all_midi_feedback (); void deliver_midi (MIDI::Port*, MIDI::byte*, int32_t size); @@ -1133,9 +1135,9 @@ class Session : public sigc::trackable, public Stateful bool send_mtc; bool send_mmc; bool mmc_control; - bool midi_feedback; bool midi_control; - + bool midi_feedback; + RingBuffer<Event*> pending_events; void hookup_io (); @@ -1598,9 +1600,9 @@ class Session : public sigc::trackable, public Stateful /* INSERT AND SEND MANAGEMENT */ - slist<PortInsert *> _port_inserts; - slist<PluginInsert *> _plugin_inserts; - slist<Send *> _sends; + list<PortInsert *> _port_inserts; + list<PluginInsert *> _plugin_inserts; + list<Send *> _sends; uint32_t send_cnt; uint32_t insert_cnt; @@ -1768,6 +1770,12 @@ class Session : public sigc::trackable, public Stateful LayerModel layer_model; CrossfadeModel xfade_model; + + /* control protocols */ + + vector<ControlProtocol*> control_protocols; + GenericMidiControlProtocol* generic_midi_control_protocol; + void initialize_control (); }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/tranzport_control_protocol.h b/libs/ardour/ardour/tranzport_control_protocol.h new file mode 100644 index 0000000000..448d803c36 --- /dev/null +++ b/libs/ardour/ardour/tranzport_control_protocol.h @@ -0,0 +1,142 @@ +#ifndef ardour_tranzport_control_protocol_h +#define ardour_tranzport_control_protocol_h + +#include <pthread.h> +#include <usb.h> +#include <ardour/control_protocol.h> +#include <ardour/types.h> + +namespace ARDOUR { + +class TranzportControlProtocol : public ControlProtocol { + public: + TranzportControlProtocol (Session&); + virtual ~TranzportControlProtocol(); + + int init (); + bool active() const; + + void send_route_feedback (std::list<Route*>&); + void send_global_feedback (); + + private: + static const int VENDORID = 0x165b; + static const int PRODUCTID = 0x8101; + static const int READ_ENDPOINT = 0x81; + static const int WRITE_ENDPOINT = 0x02; + const static int STATUS_OFFLINE = 0xff; + const static int STATUS_ONLINE = 0x01; + + enum LightID { + LightRecord = 0, + LightTrackrec, + LightTrackmute, + LightTracksolo, + LightAnysolo, + LightLoop, + LightPunch + }; + + enum ButtonID { + ButtonBattery = 0x00004000, + ButtonBacklight = 0x00008000, + ButtonTrackLeft = 0x04000000, + ButtonTrackRight = 0x40000000, + ButtonTrackRec = 0x00040000, + ButtonTrackMute = 0x00400000, + ButtonTrackSolo = 0x00000400, + ButtonUndo = 0x80000000, + ButtonIn = 0x02000000, + ButtonOut = 0x20000000, + ButtonPunch = 0x00800000, + ButtonLoop = 0x00080000, + ButtonPrev = 0x00020000, + ButtonAdd = 0x00200000, + ButtonNext = 0x00000200, + ButtonRewind = 0x01000000, + ButtonFastForward = 0x10000000, + ButtonStop = 0x00010000, + ButtonPlay = 0x00100000, + ButtonRecord = 0x00000100, + ButtonShift = 0x08000000 + }; + + pthread_t thread; + uint32_t buttonmask; + uint32_t timeout; + uint8_t _datawheel; + uint8_t _device_status; + usb_dev_handle* udev; + Route* current_route; + uint32_t current_track_id; + + bool last_negative; + uint32_t last_hrs; + uint32_t last_mins; + uint32_t last_secs; + uint32_t last_frames; + jack_nframes_t last_where; + + int open (); + int read (); + int write (uint8_t* cmd); + int close (); + + int open_core (struct usb_device*); + + void lcd_clear (); + int lcd_write (uint8_t cell, const char *text); + + int light_on (LightID); + int light_off (LightID); + + void show_current_track (); + + static void* _thread_work (void* arg); + void* thread_work (); + + void button_event_battery_press (bool shifted); + void button_event_battery_release (bool shifted); + void button_event_backlight_press (bool shifted); + void button_event_backlight_release (bool shifted); + void button_event_trackleft_press (bool shifted); + void button_event_trackleft_release (bool shifted); + void button_event_trackright_press (bool shifted); + void button_event_trackright_release (bool shifted); + void button_event_trackrec_press (bool shifted); + void button_event_trackrec_release (bool shifted); + void button_event_trackmute_press (bool shifted); + void button_event_trackmute_release (bool shifted); + void button_event_tracksolo_press (bool shifted); + void button_event_tracksolo_release (bool shifted); + void button_event_undo_press (bool shifted); + void button_event_undo_release (bool shifted); + void button_event_in_press (bool shifted); + void button_event_in_release (bool shifted); + void button_event_out_press (bool shifted); + void button_event_out_release (bool shifted); + void button_event_punch_press (bool shifted); + void button_event_punch_release (bool shifted); + void button_event_loop_press (bool shifted); + void button_event_loop_release (bool shifted); + void button_event_prev_press (bool shifted); + void button_event_prev_release (bool shifted); + void button_event_add_press (bool shifted); + void button_event_add_release (bool shifted); + void button_event_next_press (bool shifted); + void button_event_next_release (bool shifted); + void button_event_rewind_press (bool shifted); + void button_event_rewind_release (bool shifted); + void button_event_fastforward_press (bool shifted); + void button_event_fastforward_release (bool shifted); + void button_event_stop_press (bool shifted); + void button_event_stop_release (bool shifted); + void button_event_play_press (bool shifted); + void button_event_play_release (bool shifted); + void button_event_record_press (bool shifted); + void button_event_record_release (bool shifted); +}; + +} // namespace + +#endif // ardour_tranzport_control_protocol_h |