2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2006-2007 John Anderson
|
|
|
|
* Copyright (C) 2007-2009 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2015-2016 Len Ovens <len@ovenwerks.net>
|
|
|
|
* Copyright (C) 2016-2018 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2009-12-20 11:49:55 -05:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
#ifndef ardour_mackie_control_protocol_h
|
|
|
|
#define ardour_mackie_control_protocol_h
|
|
|
|
|
|
|
|
#include <vector>
|
2012-04-10 22:54:25 -04:00
|
|
|
#include <map>
|
2012-04-12 23:46:38 -04:00
|
|
|
#include <list>
|
2012-04-13 17:46:26 -04:00
|
|
|
#include <set>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <pthread.h>
|
2012-04-10 10:27:44 -04:00
|
|
|
#include <boost/smart_ptr.hpp>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2013-10-17 14:36:41 -04:00
|
|
|
#define ABSTRACT_UI_EXPORTS
|
2011-10-20 07:44:46 -04:00
|
|
|
#include "pbd/abstract_ui.h"
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "midi++/types.h"
|
2012-04-10 10:27:44 -04:00
|
|
|
#include "ardour/types.h"
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "control_protocol/control_protocol.h"
|
2012-04-11 09:03:41 -04:00
|
|
|
|
|
|
|
#include "types.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
#include "midi_byte_array.h"
|
|
|
|
#include "controls.h"
|
2012-04-22 13:37:52 -04:00
|
|
|
#include "jog_wheel.h"
|
2008-12-12 17:55:03 -05:00
|
|
|
#include "timer.h"
|
2012-04-12 08:16:55 -04:00
|
|
|
#include "device_info.h"
|
2012-04-17 16:41:31 -04:00
|
|
|
#include "device_profile.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-12 17:02:43 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class AutomationControl;
|
2015-10-09 14:01:22 -04:00
|
|
|
class Port;
|
2012-04-12 17:02:43 -04:00
|
|
|
}
|
2012-04-12 10:34:03 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
namespace MIDI {
|
|
|
|
class Port;
|
|
|
|
}
|
|
|
|
|
2015-04-15 20:37:20 -04:00
|
|
|
namespace ArdourSurface {
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
namespace Mackie {
|
|
|
|
class Surface;
|
2012-04-08 11:10:46 -04:00
|
|
|
class Control;
|
|
|
|
class SurfacePort;
|
2012-04-10 22:54:25 -04:00
|
|
|
class Button;
|
2015-12-14 22:22:34 -05:00
|
|
|
class Strip;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2015-04-15 20:37:20 -04:00
|
|
|
gboolean ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data);
|
|
|
|
|
2011-09-26 20:43:04 -04:00
|
|
|
struct MackieControlUIRequest : public BaseUI::BaseRequestObject {
|
|
|
|
public:
|
|
|
|
MackieControlUIRequest () {}
|
|
|
|
~MackieControlUIRequest () {}
|
|
|
|
};
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
class MackieControlProtocol
|
2009-12-20 11:49:55 -05:00
|
|
|
: public ARDOUR::ControlProtocol
|
2011-09-26 20:43:04 -04:00
|
|
|
, public AbstractUI<MackieControlUIRequest>
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
public:
|
2012-04-11 12:21:23 -04:00
|
|
|
static const int MODIFIER_OPTION;
|
|
|
|
static const int MODIFIER_CONTROL;
|
|
|
|
static const int MODIFIER_SHIFT;
|
|
|
|
static const int MODIFIER_CMDALT;
|
2015-10-02 07:31:31 -04:00
|
|
|
static const int MODIFIER_ZOOM;
|
|
|
|
static const int MODIFIER_SCRUB;
|
2016-01-31 11:01:41 -05:00
|
|
|
static const int MODIFIER_MARKER;
|
|
|
|
static const int MODIFIER_NUDGE;
|
2015-10-02 07:31:31 -04:00
|
|
|
static const int MAIN_MODIFIER_MASK;
|
2012-04-11 12:21:23 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
enum ViewMode {
|
2012-04-12 17:02:43 -04:00
|
|
|
Mixer,
|
2012-04-11 14:51:01 -04:00
|
|
|
AudioTracks,
|
|
|
|
MidiTracks,
|
|
|
|
Busses,
|
2015-10-13 15:34:53 -04:00
|
|
|
Auxes,
|
2015-10-20 21:54:56 -04:00
|
|
|
Selected,
|
2016-01-16 10:32:30 -05:00
|
|
|
Hidden,
|
2015-10-13 15:34:53 -04:00
|
|
|
Plugins,
|
2015-12-11 11:05:57 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
enum SubViewMode {
|
|
|
|
None,
|
2015-12-10 09:17:05 -05:00
|
|
|
EQ,
|
2015-12-11 11:05:57 -05:00
|
|
|
Dynamics,
|
2016-01-27 14:15:41 -05:00
|
|
|
Sends,
|
2016-01-31 11:59:55 -05:00
|
|
|
TrackView,
|
2012-04-11 14:51:01 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum FlipMode {
|
2012-04-11 18:32:02 -04:00
|
|
|
Normal, /* fader controls primary, vpot controls secondary */
|
|
|
|
Mirror, /* fader + vpot control secondary */
|
|
|
|
Swap, /* fader controls secondary, vpot controls primary */
|
|
|
|
Zero, /* fader controls primary, but doesn't move, vpot controls secondary */
|
2012-04-11 14:51:01 -04:00
|
|
|
};
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2009-12-20 11:49:55 -05:00
|
|
|
MackieControlProtocol(ARDOUR::Session &);
|
2008-06-02 17:41:35 -04:00
|
|
|
virtual ~MackieControlProtocol();
|
|
|
|
|
2012-04-10 13:13:55 -04:00
|
|
|
static MackieControlProtocol* instance() { return _instance; }
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
const Mackie::DeviceInfo& device_info() const { return _device_info; }
|
2012-04-17 23:24:59 -04:00
|
|
|
Mackie::DeviceProfile& device_profile() { return _device_profile; }
|
2012-04-12 08:16:55 -04:00
|
|
|
|
2015-10-08 21:54:40 -04:00
|
|
|
PBD::Signal0<void> DeviceChanged;
|
2015-10-09 14:01:22 -04:00
|
|
|
PBD::Signal1<void,boost::shared_ptr<Mackie::Surface> > ConnectionChange;
|
2015-10-08 21:54:40 -04:00
|
|
|
|
2014-02-19 12:50:28 -05:00
|
|
|
void device_ready ();
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
int set_active (bool yn);
|
2015-10-09 14:01:22 -04:00
|
|
|
int set_device (const std::string&, bool force);
|
2013-09-06 10:39:14 -04:00
|
|
|
void set_profile (const std::string&);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2013-08-24 11:45:31 -04:00
|
|
|
FlipMode flip_mode () const { return _flip_mode; }
|
2012-04-11 14:51:01 -04:00
|
|
|
ViewMode view_mode () const { return _view_mode; }
|
2015-12-11 11:05:57 -05:00
|
|
|
SubViewMode subview_mode () const { return _subview_mode; }
|
2016-05-16 16:45:37 -04:00
|
|
|
static bool subview_mode_would_be_ok (SubViewMode, boost::shared_ptr<ARDOUR::Stripable>);
|
|
|
|
boost::shared_ptr<ARDOUR::Stripable> subview_stripable() const;
|
2015-10-02 07:31:31 -04:00
|
|
|
bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; }
|
2012-06-01 08:56:20 -04:00
|
|
|
bool metering_active () const { return _metering_active; }
|
2012-04-11 14:51:01 -04:00
|
|
|
|
2016-05-16 16:45:37 -04:00
|
|
|
bool is_track (boost::shared_ptr<ARDOUR::Stripable>) const;
|
|
|
|
bool is_audio_track (boost::shared_ptr<ARDOUR::Stripable>) const;
|
|
|
|
bool is_midi_track (boost::shared_ptr<ARDOUR::Stripable>) const;
|
|
|
|
bool is_mapped (boost::shared_ptr<ARDOUR::Stripable>) const;
|
|
|
|
boost::shared_ptr<ARDOUR::Stripable> first_selected_stripable () const;
|
2015-10-18 21:13:16 -04:00
|
|
|
|
2016-01-29 18:37:03 -05:00
|
|
|
void check_fader_automation_state ();
|
|
|
|
void update_fader_automation_state ();
|
2016-01-29 16:29:52 -05:00
|
|
|
void set_automation_state (ARDOUR::AutoState);
|
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
void set_view_mode (ViewMode);
|
2016-05-16 16:45:37 -04:00
|
|
|
int set_subview_mode (SubViewMode, boost::shared_ptr<ARDOUR::Stripable>);
|
2013-08-24 11:45:31 -04:00
|
|
|
void set_flip_mode (FlipMode);
|
2015-10-22 18:30:34 -04:00
|
|
|
void display_view_mode ();
|
2012-04-11 14:51:01 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
XMLNode& get_state ();
|
2009-10-15 14:56:11 -04:00
|
|
|
int set_state (const XMLNode&, int version);
|
2015-06-24 13:46:07 -04:00
|
|
|
|
|
|
|
/* Note: because Mackie control is inherently a duplex protocol,
|
|
|
|
we do not implement get/set_feedback() since this aspect of
|
|
|
|
support for the protocol is not optional.
|
|
|
|
*/
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
static bool probe();
|
2015-12-28 10:14:17 -05:00
|
|
|
static void* request_factory (uint32_t);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2015-10-08 21:54:40 -04:00
|
|
|
mutable Glib::Threads::Mutex surfaces_lock;
|
2012-04-10 10:27:44 -04:00
|
|
|
typedef std::list<boost::shared_ptr<Mackie::Surface> > Surfaces;
|
|
|
|
Surfaces surfaces;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2015-10-10 17:13:04 -04:00
|
|
|
boost::shared_ptr<Mackie::Surface> get_surface_by_raw_pointer (void*) const;
|
2015-10-08 21:54:40 -04:00
|
|
|
boost::shared_ptr<Mackie::Surface> nth_surface (uint32_t) const;
|
|
|
|
|
2015-12-14 22:22:34 -05:00
|
|
|
uint32_t global_index (Mackie::Strip&);
|
2016-07-06 21:40:29 -04:00
|
|
|
uint32_t global_index_locked (Mackie::Strip&);
|
2015-12-14 22:22:34 -05:00
|
|
|
|
2010-07-29 22:09:39 -04:00
|
|
|
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
|
|
|
|
|
2012-04-11 16:10:10 -04:00
|
|
|
void set_master_on_surface_strip (uint32_t surface, uint32_t strip);
|
|
|
|
void set_monitor_on_surface_strip (uint32_t surface, uint32_t strip);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-26 10:28:41 -04:00
|
|
|
uint32_t n_strips (bool with_locked_strips = true) const;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-05-04 05:22:11 -04:00
|
|
|
bool has_editor () const { return true; }
|
|
|
|
void* get_gui () const;
|
|
|
|
void tear_down_gui ();
|
2012-04-10 10:27:44 -04:00
|
|
|
|
|
|
|
void handle_button_event (Mackie::Surface&, Mackie::Button& button, Mackie::ButtonState);
|
|
|
|
|
2016-05-16 16:45:37 -04:00
|
|
|
void notify_subview_stripable_deleted ();
|
|
|
|
void notify_stripable_removed ();
|
|
|
|
void notify_routes_added (ARDOUR::RouteList &);
|
2016-05-16 17:48:33 -04:00
|
|
|
void notify_vca_added (ARDOUR::VCAList &);
|
2016-05-16 16:45:37 -04:00
|
|
|
|
2017-02-01 04:27:13 -05:00
|
|
|
void notify_presentation_info_changed(PBD::PropertyChange const &);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2015-10-02 21:54:40 -04:00
|
|
|
void recalibrate_faders ();
|
|
|
|
void toggle_backlight ();
|
|
|
|
void set_touch_sensitivity (int);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-05-16 16:45:37 -04:00
|
|
|
/// rebuild the current bank. Called on route or vca added/removed and
|
|
|
|
/// presentation info changed.
|
2008-06-02 17:41:35 -04:00
|
|
|
void refresh_current_bank();
|
|
|
|
|
2009-12-20 11:49:55 -05:00
|
|
|
// button-related signals
|
2008-06-02 17:41:35 -04:00
|
|
|
void notify_record_state_changed();
|
2009-12-20 11:49:55 -05:00
|
|
|
void notify_transport_state_changed();
|
2012-04-10 22:30:35 -04:00
|
|
|
void notify_loop_state_changed();
|
2012-06-01 08:56:20 -04:00
|
|
|
void notify_metering_state_changed();
|
2009-12-20 11:49:55 -05:00
|
|
|
// mainly to pick up punch-in and punch-out
|
|
|
|
void notify_parameter_changed(std::string const &);
|
|
|
|
void notify_solo_active_changed(bool);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
/// Turn timecode on and beats off, or vice versa, depending
|
2008-12-12 17:55:03 -05:00
|
|
|
/// on state of _timecode_type
|
2009-10-26 10:38:58 -04:00
|
|
|
void update_timecode_beats_led();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2008-12-12 17:55:03 -05:00
|
|
|
/// this is called to generate the midi to send in response to a button press.
|
2012-04-10 10:27:44 -04:00
|
|
|
void update_led(Mackie::Surface&, Mackie::Button & button, Mackie::LedState);
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2012-04-14 15:02:54 -04:00
|
|
|
void update_global_button (int id, Mackie::LedState);
|
|
|
|
void update_global_led (int id, Mackie::LedState);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
ARDOUR::Session & get_session() { return *session; }
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t transport_sample() const;
|
2012-04-12 17:02:43 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
int modifier_state() const { return _modifier_state; }
|
2015-10-02 07:31:31 -04:00
|
|
|
int main_modifier_state() const { return _modifier_state & MAIN_MODIFIER_MASK; }
|
2012-04-12 23:46:38 -04:00
|
|
|
|
2012-04-13 12:11:55 -04:00
|
|
|
typedef std::list<boost::shared_ptr<ARDOUR::AutomationControl> > ControlList;
|
|
|
|
|
|
|
|
void add_down_button (ARDOUR::AutomationType, int surface, int strip);
|
|
|
|
void remove_down_button (ARDOUR::AutomationType, int surface, int strip);
|
2016-07-06 21:40:29 -04:00
|
|
|
ControlList down_controls (ARDOUR::AutomationType, uint32_t pressed);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-12 23:46:38 -04:00
|
|
|
void add_down_select_button (int surface, int strip);
|
|
|
|
void remove_down_select_button (int surface, int strip);
|
2016-07-06 21:40:29 -04:00
|
|
|
void select_range (uint32_t pressed);
|
2012-04-25 17:21:36 -04:00
|
|
|
|
|
|
|
int16_t ipmidi_base() const { return _ipmidi_base; }
|
|
|
|
void set_ipmidi_base (int16_t);
|
2012-05-09 12:44:06 -04:00
|
|
|
|
2015-10-07 13:17:42 -04:00
|
|
|
void ping_devices ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
protected:
|
|
|
|
// shut down the surface
|
|
|
|
void close();
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
// This sets up the notifications and sets the
|
|
|
|
// controls to the correct values
|
|
|
|
void update_surfaces();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
// connects global (not strip) signals from the Session to here
|
|
|
|
// so the surface can be notified of changes from the other UIs.
|
|
|
|
void connect_session_signals();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
// set all controls to their zero position
|
|
|
|
void zero_all();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
/**
|
2016-05-16 16:45:37 -04:00
|
|
|
Fetch the set of Stripables to be considered for control by the
|
2012-04-11 14:51:01 -04:00
|
|
|
surface. Excluding master, hidden and control routes, and inactive routes
|
|
|
|
*/
|
2016-05-16 16:45:37 -04:00
|
|
|
typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
|
|
|
|
Sorted get_sorted_stripables();
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
// bank switching
|
2016-01-28 16:27:33 -05:00
|
|
|
int switch_banks (uint32_t first_remote_id, bool force = false);
|
2012-04-11 14:51:01 -04:00
|
|
|
void prev_track ();
|
|
|
|
void next_track ();
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
// also called from poll_automation to update timecode display
|
|
|
|
void update_timecode_display();
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
std::string format_bbt_timecode (ARDOUR::samplepos_t now_sample);
|
|
|
|
std::string format_timecode_timecode (ARDOUR::samplepos_t now_sample);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
void do_request (MackieControlUIRequest*);
|
|
|
|
int stop ();
|
|
|
|
|
|
|
|
void thread_init ();
|
|
|
|
|
2016-05-16 16:45:37 -04:00
|
|
|
bool stripable_is_locked_to_strip (boost::shared_ptr<ARDOUR::Stripable>) const;
|
2012-04-26 10:28:41 -04:00
|
|
|
|
2012-04-11 14:51:01 -04:00
|
|
|
private:
|
|
|
|
|
2012-04-12 08:16:55 -04:00
|
|
|
struct ButtonHandlers {
|
|
|
|
Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&);
|
|
|
|
Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-04-12 08:16:55 -04:00
|
|
|
ButtonHandlers (Mackie::LedState (MackieControlProtocol::*p) (Mackie::Button&),
|
2015-10-04 14:51:05 -04:00
|
|
|
Mackie::LedState (MackieControlProtocol::*r) (Mackie::Button&))
|
2012-04-12 08:16:55 -04:00
|
|
|
: press (p)
|
|
|
|
, release (r) {}
|
|
|
|
};
|
2012-04-11 14:51:01 -04:00
|
|
|
|
2012-04-14 15:02:54 -04:00
|
|
|
typedef std::map<Mackie::Button::ID,ButtonHandlers> ButtonMap;
|
2012-04-11 14:51:01 -04:00
|
|
|
|
2012-04-12 08:16:55 -04:00
|
|
|
static MackieControlProtocol* _instance;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-02-04 11:23:54 -05:00
|
|
|
bool profile_exists (std::string const&) const;
|
|
|
|
|
2012-04-12 08:16:55 -04:00
|
|
|
Mackie::DeviceInfo _device_info;
|
2012-04-17 16:41:31 -04:00
|
|
|
Mackie::DeviceProfile _device_profile;
|
2012-04-12 08:16:55 -04:00
|
|
|
sigc::connection periodic_connection;
|
2015-10-02 22:03:17 -04:00
|
|
|
sigc::connection redisplay_connection;
|
2015-10-03 12:03:07 -04:00
|
|
|
sigc::connection hui_connection;
|
2012-04-12 08:16:55 -04:00
|
|
|
uint32_t _current_initial_bank;
|
2012-04-11 14:51:01 -04:00
|
|
|
PBD::ScopedConnectionList audio_engine_connections;
|
|
|
|
PBD::ScopedConnectionList session_connections;
|
2016-05-16 16:45:37 -04:00
|
|
|
PBD::ScopedConnectionList stripable_connections;
|
|
|
|
PBD::ScopedConnectionList subview_stripable_connections;
|
2012-04-12 10:34:03 -04:00
|
|
|
PBD::ScopedConnectionList gui_connections;
|
2016-01-29 18:37:03 -05:00
|
|
|
PBD::ScopedConnectionList fader_automation_connections;
|
2012-04-11 14:51:01 -04:00
|
|
|
// timer for two quick marker left presses
|
2012-04-12 08:16:55 -04:00
|
|
|
Mackie::Timer _frm_left_last;
|
2012-04-11 14:51:01 -04:00
|
|
|
// last written timecode string
|
2012-04-12 08:16:55 -04:00
|
|
|
std::string _timecode_last;
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t _sample_last;
|
2012-04-11 14:51:01 -04:00
|
|
|
// Which timecode are we displaying? BBT or Timecode
|
2012-04-12 08:16:55 -04:00
|
|
|
ARDOUR::AnyTime::Type _timecode_type;
|
2012-04-11 14:51:01 -04:00
|
|
|
// Bundle to represent our input ports
|
|
|
|
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
|
|
|
|
// Bundle to represent our output ports
|
|
|
|
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
|
2012-04-12 08:16:55 -04:00
|
|
|
void* _gui;
|
|
|
|
bool _scrub_mode;
|
2013-08-24 11:45:31 -04:00
|
|
|
FlipMode _flip_mode;
|
2012-04-12 08:16:55 -04:00
|
|
|
ViewMode _view_mode;
|
2015-12-11 11:05:57 -05:00
|
|
|
SubViewMode _subview_mode;
|
2016-05-16 16:45:37 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Stripable> _subview_stripable;
|
2012-04-12 08:16:55 -04:00
|
|
|
int _current_selected_track;
|
|
|
|
int _modifier_state;
|
|
|
|
ButtonMap button_map;
|
2012-04-25 17:21:36 -04:00
|
|
|
int16_t _ipmidi_base;
|
|
|
|
bool needs_ipmidi_restart;
|
2012-06-01 08:56:20 -04:00
|
|
|
bool _metering_active;
|
2012-06-06 08:20:57 -04:00
|
|
|
bool _initialized;
|
2015-10-13 07:33:20 -04:00
|
|
|
XMLNode* configuration_state;
|
|
|
|
int state_version;
|
2015-10-22 18:30:34 -04:00
|
|
|
int _last_bank[9];
|
2016-01-31 11:01:41 -05:00
|
|
|
bool marker_modifier_consumed_by_button;
|
2016-01-31 11:17:23 -05:00
|
|
|
bool nudge_modifier_consumed_by_button;
|
2015-10-13 07:33:20 -04:00
|
|
|
|
2015-08-13 16:00:04 -04:00
|
|
|
boost::shared_ptr<ArdourSurface::Mackie::Surface> _master_surface;
|
2012-04-27 21:43:38 -04:00
|
|
|
|
2014-12-03 21:22:34 -05:00
|
|
|
struct ipMIDIHandler {
|
|
|
|
MackieControlProtocol* mcp;
|
|
|
|
MIDI::Port* port;
|
|
|
|
};
|
|
|
|
friend struct ipMIDIHandler; /* is this necessary */
|
2015-04-15 20:37:20 -04:00
|
|
|
friend gboolean ArdourSurface::ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data);
|
2014-12-03 21:22:34 -05:00
|
|
|
|
2013-09-06 10:39:14 -04:00
|
|
|
int create_surfaces ();
|
2012-04-12 08:16:55 -04:00
|
|
|
bool periodic();
|
2015-10-02 22:03:17 -04:00
|
|
|
bool redisplay();
|
2016-01-28 15:08:19 -05:00
|
|
|
bool redisplay_subview_mode ();
|
2015-10-03 12:03:07 -04:00
|
|
|
bool hui_heartbeat ();
|
2012-04-11 14:51:01 -04:00
|
|
|
void build_gui ();
|
|
|
|
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
|
|
|
|
void clear_ports ();
|
2012-12-31 11:04:46 -05:00
|
|
|
void clear_surfaces ();
|
2016-05-16 16:45:37 -04:00
|
|
|
void force_special_stripable_to_strip (boost::shared_ptr<ARDOUR::Stripable> r, uint32_t surface, uint32_t strip_number);
|
2012-04-12 08:16:55 -04:00
|
|
|
void build_button_map ();
|
2017-05-12 09:51:31 -04:00
|
|
|
void stripable_selection_changed ();
|
2013-09-06 10:39:14 -04:00
|
|
|
int ipmidi_restart ();
|
|
|
|
void initialize ();
|
2013-12-21 15:30:07 -05:00
|
|
|
int set_device_info (const std::string& device_name);
|
2015-10-13 07:33:20 -04:00
|
|
|
void update_configuration_state ();
|
2018-02-01 15:39:17 -05:00
|
|
|
|
2015-10-09 14:01:22 -04:00
|
|
|
/* MIDI port connection management */
|
|
|
|
|
|
|
|
PBD::ScopedConnection port_connection;
|
|
|
|
void connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool);
|
|
|
|
|
2012-04-11 16:10:10 -04:00
|
|
|
/* BUTTON HANDLING */
|
2012-04-12 23:46:38 -04:00
|
|
|
|
2012-04-13 17:46:26 -04:00
|
|
|
typedef std::set<uint32_t> DownButtonList;
|
2012-04-13 12:11:55 -04:00
|
|
|
typedef std::map<ARDOUR::AutomationType,DownButtonList> DownButtonMap;
|
|
|
|
DownButtonMap _down_buttons;
|
2015-10-04 14:51:05 -04:00
|
|
|
DownButtonList _down_select_buttons;
|
2012-04-13 12:11:55 -04:00
|
|
|
|
2016-07-06 21:40:29 -04:00
|
|
|
void pull_stripable_range (DownButtonList&, ARDOUR::StripableList&, uint32_t pressed);
|
2012-04-11 16:10:10 -04:00
|
|
|
|
2012-04-09 11:32:25 -04:00
|
|
|
/* implemented button handlers */
|
|
|
|
Mackie::LedState stop_press(Mackie::Button &);
|
|
|
|
Mackie::LedState stop_release(Mackie::Button &);
|
|
|
|
Mackie::LedState play_press(Mackie::Button &);
|
|
|
|
Mackie::LedState play_release(Mackie::Button &);
|
|
|
|
Mackie::LedState record_press(Mackie::Button &);
|
|
|
|
Mackie::LedState record_release(Mackie::Button &);
|
|
|
|
Mackie::LedState loop_press(Mackie::Button &);
|
|
|
|
Mackie::LedState loop_release(Mackie::Button &);
|
|
|
|
Mackie::LedState rewind_press(Mackie::Button & button);
|
|
|
|
Mackie::LedState rewind_release(Mackie::Button & button);
|
|
|
|
Mackie::LedState ffwd_press(Mackie::Button & button);
|
|
|
|
Mackie::LedState ffwd_release(Mackie::Button & button);
|
|
|
|
Mackie::LedState cursor_up_press (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_up_release (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_down_press (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_down_release (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_left_press (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_left_release (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_right_press (Mackie::Button &);
|
|
|
|
Mackie::LedState cursor_right_release (Mackie::Button &);
|
|
|
|
Mackie::LedState left_press(Mackie::Button &);
|
|
|
|
Mackie::LedState left_release(Mackie::Button &);
|
|
|
|
Mackie::LedState right_press(Mackie::Button &);
|
|
|
|
Mackie::LedState right_release(Mackie::Button &);
|
|
|
|
Mackie::LedState channel_left_press(Mackie::Button &);
|
|
|
|
Mackie::LedState channel_left_release(Mackie::Button &);
|
|
|
|
Mackie::LedState channel_right_press(Mackie::Button &);
|
|
|
|
Mackie::LedState channel_right_release(Mackie::Button &);
|
|
|
|
Mackie::LedState marker_press(Mackie::Button &);
|
|
|
|
Mackie::LedState marker_release(Mackie::Button &);
|
|
|
|
Mackie::LedState save_press(Mackie::Button &);
|
|
|
|
Mackie::LedState save_release(Mackie::Button &);
|
|
|
|
Mackie::LedState timecode_beats_press(Mackie::Button &);
|
|
|
|
Mackie::LedState timecode_beats_release(Mackie::Button &);
|
|
|
|
Mackie::LedState zoom_press(Mackie::Button &);
|
|
|
|
Mackie::LedState zoom_release(Mackie::Button &);
|
|
|
|
Mackie::LedState scrub_press(Mackie::Button &);
|
|
|
|
Mackie::LedState scrub_release(Mackie::Button &);
|
2012-04-09 11:50:38 -04:00
|
|
|
Mackie::LedState undo_press (Mackie::Button &);
|
|
|
|
Mackie::LedState undo_release (Mackie::Button &);
|
2012-04-09 13:48:16 -04:00
|
|
|
Mackie::LedState shift_press (Mackie::Button &);
|
|
|
|
Mackie::LedState shift_release (Mackie::Button &);
|
|
|
|
Mackie::LedState option_press (Mackie::Button &);
|
|
|
|
Mackie::LedState option_release (Mackie::Button &);
|
|
|
|
Mackie::LedState control_press (Mackie::Button &);
|
|
|
|
Mackie::LedState control_release (Mackie::Button &);
|
|
|
|
Mackie::LedState cmd_alt_press (Mackie::Button &);
|
|
|
|
Mackie::LedState cmd_alt_release (Mackie::Button &);
|
|
|
|
|
|
|
|
Mackie::LedState pan_press (Mackie::Button &);
|
|
|
|
Mackie::LedState pan_release (Mackie::Button &);
|
|
|
|
Mackie::LedState plugin_press (Mackie::Button &);
|
|
|
|
Mackie::LedState plugin_release (Mackie::Button &);
|
|
|
|
Mackie::LedState eq_press (Mackie::Button &);
|
|
|
|
Mackie::LedState eq_release (Mackie::Button &);
|
|
|
|
Mackie::LedState dyn_press (Mackie::Button &);
|
|
|
|
Mackie::LedState dyn_release (Mackie::Button &);
|
|
|
|
Mackie::LedState flip_press (Mackie::Button &);
|
|
|
|
Mackie::LedState flip_release (Mackie::Button &);
|
|
|
|
Mackie::LedState name_value_press (Mackie::Button &);
|
|
|
|
Mackie::LedState name_value_release (Mackie::Button &);
|
2017-05-08 11:12:13 -04:00
|
|
|
// Mackie::LedState F1_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F1_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F2_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F2_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F3_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F3_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F4_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F4_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F5_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F5_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F6_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F6_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F7_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F7_release (Mackie::Button &);
|
|
|
|
// Mackie::LedState F8_press (Mackie::Button &);
|
|
|
|
// Mackie::LedState F8_release (Mackie::Button &);
|
2012-04-09 13:48:16 -04:00
|
|
|
Mackie::LedState touch_press (Mackie::Button &);
|
|
|
|
Mackie::LedState touch_release (Mackie::Button &);
|
|
|
|
Mackie::LedState enter_press (Mackie::Button &);
|
|
|
|
Mackie::LedState enter_release (Mackie::Button &);
|
|
|
|
Mackie::LedState cancel_press (Mackie::Button &);
|
|
|
|
Mackie::LedState cancel_release (Mackie::Button &);
|
|
|
|
Mackie::LedState user_a_press (Mackie::Button &);
|
|
|
|
Mackie::LedState user_a_release (Mackie::Button &);
|
|
|
|
Mackie::LedState user_b_press (Mackie::Button &);
|
|
|
|
Mackie::LedState user_b_release (Mackie::Button &);
|
|
|
|
Mackie::LedState fader_touch_press (Mackie::Button &);
|
|
|
|
Mackie::LedState fader_touch_release (Mackie::Button &);
|
2012-06-09 15:06:52 -04:00
|
|
|
Mackie::LedState master_fader_touch_press (Mackie::Button &);
|
|
|
|
Mackie::LedState master_fader_touch_release (Mackie::Button &);
|
2012-04-15 09:28:45 -04:00
|
|
|
|
|
|
|
Mackie::LedState read_press (Mackie::Button&);
|
|
|
|
Mackie::LedState read_release (Mackie::Button&);
|
|
|
|
Mackie::LedState write_press (Mackie::Button&);
|
|
|
|
Mackie::LedState write_release (Mackie::Button&);
|
|
|
|
Mackie::LedState clearsolo_press (Mackie::Button&);
|
|
|
|
Mackie::LedState clearsolo_release (Mackie::Button&);
|
|
|
|
Mackie::LedState track_press (Mackie::Button&);
|
|
|
|
Mackie::LedState track_release (Mackie::Button&);
|
|
|
|
Mackie::LedState send_press (Mackie::Button&);
|
|
|
|
Mackie::LedState send_release (Mackie::Button&);
|
|
|
|
Mackie::LedState miditracks_press (Mackie::Button&);
|
|
|
|
Mackie::LedState miditracks_release (Mackie::Button&);
|
|
|
|
Mackie::LedState inputs_press (Mackie::Button&);
|
|
|
|
Mackie::LedState inputs_release (Mackie::Button&);
|
|
|
|
Mackie::LedState audiotracks_press (Mackie::Button&);
|
|
|
|
Mackie::LedState audiotracks_release (Mackie::Button&);
|
|
|
|
Mackie::LedState audioinstruments_press (Mackie::Button&);
|
|
|
|
Mackie::LedState audioinstruments_release (Mackie::Button&);
|
|
|
|
Mackie::LedState aux_press (Mackie::Button&);
|
|
|
|
Mackie::LedState aux_release (Mackie::Button&);
|
|
|
|
Mackie::LedState busses_press (Mackie::Button&);
|
|
|
|
Mackie::LedState busses_release (Mackie::Button&);
|
|
|
|
Mackie::LedState outputs_press (Mackie::Button&);
|
|
|
|
Mackie::LedState outputs_release (Mackie::Button&);
|
|
|
|
Mackie::LedState user_press (Mackie::Button&);
|
|
|
|
Mackie::LedState user_release (Mackie::Button&);
|
|
|
|
Mackie::LedState trim_press (Mackie::Button&);
|
|
|
|
Mackie::LedState trim_release (Mackie::Button&);
|
|
|
|
Mackie::LedState latch_press (Mackie::Button&);
|
|
|
|
Mackie::LedState latch_release (Mackie::Button&);
|
|
|
|
Mackie::LedState grp_press (Mackie::Button&);
|
|
|
|
Mackie::LedState grp_release (Mackie::Button&);
|
|
|
|
Mackie::LedState nudge_press (Mackie::Button&);
|
|
|
|
Mackie::LedState nudge_release (Mackie::Button&);
|
|
|
|
Mackie::LedState drop_press (Mackie::Button&);
|
|
|
|
Mackie::LedState drop_release (Mackie::Button&);
|
|
|
|
Mackie::LedState replace_press (Mackie::Button&);
|
|
|
|
Mackie::LedState replace_release (Mackie::Button&);
|
|
|
|
Mackie::LedState click_press (Mackie::Button&);
|
|
|
|
Mackie::LedState click_release (Mackie::Button&);
|
2012-04-15 09:41:20 -04:00
|
|
|
Mackie::LedState view_press (Mackie::Button&);
|
|
|
|
Mackie::LedState view_release (Mackie::Button&);
|
2015-10-07 15:12:09 -04:00
|
|
|
|
|
|
|
Mackie::LedState bank_release (Mackie::Button&, uint32_t bank_num);
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
} // namespace
|
2015-04-15 20:37:20 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
#endif // ardour_mackie_control_protocol_h
|