summaryrefslogtreecommitdiff
path: root/libs/surfaces/tranzport/tranzport_control_protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/tranzport/tranzport_control_protocol.h')
-rw-r--r--libs/surfaces/tranzport/tranzport_control_protocol.h130
1 files changed, 98 insertions, 32 deletions
diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.h b/libs/surfaces/tranzport/tranzport_control_protocol.h
index f13e4a3a44..929cca3e2b 100644
--- a/libs/surfaces/tranzport/tranzport_control_protocol.h
+++ b/libs/surfaces/tranzport/tranzport_control_protocol.h
@@ -1,22 +1,46 @@
+/*
+ Copyright (C) 2006 Paul Davis
+ Copyright (C) 2007 Mike Taht
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#ifndef ardour_tranzport_control_protocol_h
#define ardour_tranzport_control_protocol_h
-#include <vector>
+#include "tranzport_base.h"
+#include <vector>
+#include <bitset>
#include <sys/time.h>
#include <pthread.h>
+
+#if !HAVE_TRANZPORT_KERNEL_DRIVER
#include <usb.h>
+#endif
#include <glibmm/thread.h>
-
#include <ardour/types.h>
#include <control_protocol/control_protocol.h>
class TranzportControlProtocol : public ARDOUR::ControlProtocol
{
- public:
+public:
TranzportControlProtocol (ARDOUR::Session&);
virtual ~TranzportControlProtocol();
@@ -27,14 +51,19 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
XMLNode& get_state ();
int set_state (const XMLNode&);
- private:
+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;
- const static uint8_t WheelDirectionThreshold = 0x3f;
+ const static int STATUS_OK = 0x00;
+
+ const static int LIGHTS = 7;
+ const static int ROWS = 2;
+ const static int COLUMNS = 20;
+ const static uint8_t WheelDirectionThreshold = 0x7f;
enum LightID {
LightRecord = 0,
@@ -67,7 +96,8 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
ButtonStop = 0x00010000,
ButtonPlay = 0x00100000,
ButtonRecord = 0x00000100,
- ButtonShift = 0x08000000
+ ButtonShift = 0x08000000,
+ ButtonFootswitch = 0x00001000
};
enum WheelShiftMode {
@@ -86,13 +116,13 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
// FIXME - look at gtk2_ardour for snap settings
enum WheelIncrement {
- WheelIncrSlave,
- WheelIncrScreen,
- WheelIncrSample,
- WheelIncrBeat,
- WheelIncrBar,
- WheelIncrSecond,
- WheelIncrMinute
+ WheelIncrSlave,
+ WheelIncrScreen,
+ WheelIncrSample,
+ WheelIncrBeat,
+ WheelIncrBar,
+ WheelIncrSecond,
+ WheelIncrMinute
};
enum DisplayMode {
@@ -111,37 +141,55 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
BlingRotating,
BlingPairs,
BlingRows,
- BlingFlashAll
+ BlingFlashAll,
+ BlingEnter,
+ BlingExit
};
pthread_t thread;
+#if HAVE_TRANZPORT_KERNEL_DRIVER
+ int udev;
+#else
+ usb_dev_handle* udev;
+#endif
+
+#if TRANZPORT_THREADS
+ pthread_t thread_read;
+#endif
+ int last_read_error;
+
uint32_t buttonmask;
uint32_t timeout;
uint32_t inflight;
+ uint32_t current_track_id;
+#if TRANZPORT_THREADS
+ pthread_t thread_write;
+#endif
+ int last_write_error;
uint8_t _datawheel;
uint8_t _device_status;
- uint32_t current_track_id;
WheelMode wheel_mode;
WheelShiftMode wheel_shift_mode;
DisplayMode display_mode;
BlingMode bling_mode;
WheelIncrement wheel_increment;
- usb_dev_handle* udev;
ARDOUR::gain_t gain_fraction;
Glib::Mutex update_lock;
- bool screen_invalid[2][20];
- char screen_current[2][20];
- char screen_pending[2][20];
- char screen_flash[2][20];
+ std::bitset<ROWS*COLUMNS> screen_invalid;
+ char screen_current[ROWS][COLUMNS];
+ char screen_pending[ROWS][COLUMNS];
+ char screen_flash[ROWS][COLUMNS];
- bool lights_invalid[7];
- bool lights_current[7];
- bool lights_pending[7];
- bool lights_flash[7];
+ std::bitset<LIGHTS> lights_invalid;
+ std::bitset<LIGHTS> lights_current;
+ std::bitset<LIGHTS> lights_pending;
+ std::bitset<LIGHTS> lights_flash;
+ int32_t last_notify;
+ char last_notify_msg[COLUMNS+1];
uint32_t last_bars;
uint32_t last_beats;
uint32_t last_ticks;
@@ -151,7 +199,7 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
uint32_t last_mins;
uint32_t last_secs;
uint32_t last_frames;
- nframes_t last_where;
+ nframes_t last_where;
ARDOUR::gain_t last_track_gain;
uint32_t last_meter_fill;
struct timeval last_wheel_motion;
@@ -164,16 +212,25 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
int write (uint8_t* cmd, uint32_t timeout_override = 0);
int write_noretry (uint8_t* cmd, uint32_t timeout_override = 0);
int close ();
- int save(char *name = "default");
- int load(char *name = "default");
- void print (int row, int col, const char* text);
+ int save_config(char *name = "default");
+ int load_config(char *name = "default");
+ int save(char *name);
+ int load(char *name);
+ void print (int row, int col, const char* text);
void print_noretry (int row, int col, const char* text);
+ void notify(const char *msg);
+#if HAVE_TRANZPORT_KERNEL_DRIVER
+ int rtpriority_set(int priority = 3); // we don't need serious rt privs anymore
+#else
int rtpriority_set(int priority = 52);
+#endif
int rtpriority_unset(int priority = 0);
+ // I hate changing the api to do either but until I have clean io class what can you do?
+#if !HAVE_TRANZPORT_KERNEL_DRIVER
int open_core (struct usb_device*);
-
+#endif
static void* _monitor_work (void* arg);
void* monitor_work ();
@@ -191,6 +248,7 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
int screen_flush();
void screen_clear();
// bool screen_isuptodate(); // think on this -
+ int screen_show_bling();
// Commands to write to the lcd
@@ -198,8 +256,8 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
bool lcd_damage();
bool lcd_isdamaged();
- bool lcd_damage(int row, int col = 0, int length = 20);
- bool lcd_isdamaged(int row, int col = 0, int length = 20);
+ bool lcd_damage(int row, int col = 0, int length = COLUMNS);
+ bool lcd_isdamaged(int row, int col = 0, int length = COLUMNS);
int lcd_flush();
int lcd_write(uint8_t* cmd, uint32_t timeout_override = 0); // pedantic alias for write
@@ -240,6 +298,9 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
void enter_recording_mode();
void enter_bling_mode();
+ void next_marker (); // basicui doesn't give me enough info
+ void prev_marker ();
+
void next_display_mode ();
void normal_update ();
@@ -252,6 +313,9 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
void show_gain ();
void show_pan ();
void show_meter ();
+ void show_mini_meter ();
+ void show_bling();
+ void show_notify();
void datawheel ();
void scrub ();
@@ -311,8 +375,10 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol
void button_event_play_release (bool shifted);
void button_event_record_press (bool shifted);
void button_event_record_release (bool shifted);
+ void button_event_footswitch_press(bool shifted);
+ void button_event_footswitch_release (bool shifted);
- // new api
+ // new api - still thinking about it
void button_event_mute (bool pressed, bool shifted);
};