2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _ardour_surfaces_maschine2_h_
20 #define _ardour_surfaces_maschine2_h_
22 #ifdef PLATFORM_WINDOWS
28 #define ABSTRACT_UI_EXPORTS
29 #include "pbd/abstract_ui.h"
30 #include "ardour/types.h"
31 #include "ardour/port.h"
32 #include "control_protocol/control_protocol.h"
38 namespace ArdourSurface {
42 class Maschine2Canvas;
43 class Maschine2Layout;
45 class Maschine2Exception : public std::exception
48 Maschine2Exception (const std::string& msg) : _msg (msg) { }
49 virtual ~Maschine2Exception () throw () {}
50 const char* what () const throw () { return _msg.c_str (); }
55 struct Maschine2Request : public BaseUI::BaseRequestObject {
57 Maschine2Request () {}
58 ~Maschine2Request () {}
61 class Maschine2: public ARDOUR::ControlProtocol, public AbstractUI<Maschine2Request>
64 Maschine2 (ARDOUR::Session&);
67 static void* request_factory (uint32_t);
70 bool has_editor () const { return false; }
71 void* get_gui () const;
72 void tear_down_gui ();
75 int set_active (bool yn);
76 XMLNode& get_state ();
77 int set_state (const XMLNode & node, int version);
79 Maschine2Canvas* canvas () const { return _canvas; }
80 Maschine2Layout* current_layout() const;
89 void do_request (Maschine2Request*);
95 void run_event_loop ();
96 void stop_event_loop ();
98 sigc::connection read_connection;
99 sigc::connection write_connection;
107 Maschine2Canvas* _canvas;
109 Maschine2Type _maschine_type;
111 PBD::ScopedConnectionList session_connections;
112 PBD::ScopedConnectionList button_connections;
114 void connect_signals ();
115 void stripable_selection_changed () {}
125 void handle_master_change (enum MasterMode);
126 void notify_master_change ();
129 boost::shared_ptr<ARDOUR::Port> _midi_out;
130 MIDI::Port* _output_port;
133 void notify_record_state_changed ();
134 void notify_transport_state_changed ();
135 void notify_loop_state_changed ();
136 void notify_parameter_changed (std::string);
137 void notify_snap_change ();
138 void notify_session_dirty_changed ();
139 void notify_history_changed ();
142 void button_record ();
144 void button_metronom ();
145 void button_rewind ();
147 void button_action (const std::string&, const std::string&);
149 void button_snap_released ();
150 void button_snap_pressed ();
151 void button_snap_changed (bool);
153 void encoder_master (int);
154 void button_encoder ();
156 void pad_event (unsigned int, float, bool);
157 void pad_change (unsigned int, float);
161 #endif /* _ardour_surfaces_maschine2_h_*/