#include <vector>
#include <sys/time.h>
-
#include <pthread.h>
#include <usb.h>
-#include <ardour/control_protocol.h>
+
+#include <glibmm/thread.h>
+
#include <ardour/types.h>
-namespace ARDOUR {
+#include <control_protocol/control_protocol.h>
-class TranzportControlProtocol : public ControlProtocol {
+class TranzportControlProtocol : public ARDOUR::ControlProtocol
+{
public:
- TranzportControlProtocol (Session&);
+ TranzportControlProtocol (ARDOUR::Session&);
virtual ~TranzportControlProtocol();
- int init ();
- bool active() const;
+ int set_active (bool yn);
- void send_route_feedback (std::list<Route*>&);
- void send_global_feedback ();
+ static bool probe ();
private:
static const int VENDORID = 0x165b;
ButtonShift = 0x08000000
};
- enum WheelMode {
- WheelGain,
- WheelPan,
- WheelMaster
+ enum WheelShiftMode {
+ WheelShiftGain,
+ WheelShiftPan,
+ WheelShiftMaster
};
+ enum WheelMode {
+ WheelTimeline,
+ WheelScrub,
+ WheelShuttle
+ };
+
+ enum DisplayMode {
+ DisplayNormal,
+ DisplayBigMeter
+ };
+
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;
- char current_screen[2][20];
- bool lights[7];
WheelMode wheel_mode;
- struct timeval last_wheel_motion;
- int last_wheel_dir;
-
- std::vector<sigc::connection> track_connections;
-
- bool last_negative;
- uint32_t last_hrs;
- uint32_t last_mins;
- uint32_t last_secs;
- uint32_t last_frames;
+ WheelShiftMode wheel_shift_mode;
+ DisplayMode display_mode;
+ ARDOUR::gain_t gain_fraction;
+
+ Glib::Mutex update_lock;
+ char current_screen[2][20];
+ char pending_screen[2][20];
+ bool lights[7];
+ bool pending_lights[7];
+
+ bool last_negative;
+ uint32_t last_hrs;
+ uint32_t last_mins;
+ uint32_t last_secs;
+ uint32_t last_frames;
jack_nframes_t last_where;
+ ARDOUR::gain_t last_track_gain;
+ uint32_t last_meter_fill;
+ struct timeval last_wheel_motion;
+ int last_wheel_dir;
+
+ Glib::Mutex io_lock;
int open ();
int read (uint32_t timeout_override = 0);
int open_core (struct usb_device*);
void lcd_clear ();
- int lcd_write (int row, int col, uint8_t cell, const char *text);
void print (int row, int col, const char* text);
int light_on (LightID);
int light_off (LightID);
+ void lights_off ();
+
+ void enter_big_meter_mode ();
+ void enter_normal_display_mode ();
+
+ void next_display_mode ();
+
+ void normal_update ();
void show_current_track ();
+ void show_track_gain ();
void show_transport_time ();
void show_wheel_mode ();
void show_gain ();
void show_pan ();
-
- void track_solo_changed (void*);
- void track_rec_changed (void*);
- void track_mute_changed (void*);
- void track_gain_changed (void*);
- void record_status_changed ();
+ void show_meter ();
void datawheel ();
+ void scrub ();
+ void scroll ();
+ void shuttle ();
void next_wheel_mode ();
+ void next_wheel_shift_mode ();
+ void set_current_track (ARDOUR::Route*);
void next_track ();
void prev_track ();
- void next_marker ();
- void prev_marker ();
void step_gain_up ();
void step_gain_down ();
void step_pan_right ();
void step_pan_left ();
- static void* _thread_work (void* arg);
- void* thread_work ();
+ static void* _monitor_work (void* arg);
+ void* monitor_work ();
void button_event_battery_press (bool shifted);
void button_event_battery_release (bool shifted);
void button_event_play_release (bool shifted);
void button_event_record_press (bool shifted);
void button_event_record_release (bool shifted);
+
+ int process (uint8_t *);
+ int update_state();
};
-} // namespace
#endif // ardour_tranzport_control_protocol_h