2 * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
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
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _ardour_surfaces_fp8base_h_
20 #define _ardour_surfaces_fp8base_h_
25 #include "pbd/signals.h"
28 # define FP_NAMESPACE FP16
29 #elif defined FADERPORT2
30 # define FP_NAMESPACE FP2
32 # define FP_NAMESPACE FP8
35 namespace ArdourSurface { namespace FP_NAMESPACE {
37 /* conveniece wrappers depending on "FP8Base& _base" */
38 #define fp8_loop dynamic_cast<BaseUI*>(&_base)->main_loop
39 #define fp8_context() dynamic_cast<BaseUI*>(&_base)
40 #define fp8_protocol() dynamic_cast<ControlProtocol*>(&_base)
42 /** Virtual abstract base of the FaderPort8 control surface
44 * This is passed as handle to all elements (buttons, lights,..)
45 * to inteface common functionality for the current instance:
47 * - global events (signals)
50 * It is implemented by FaderPort8
57 virtual size_t tx_midi (std::vector<uint8_t> const&) const = 0;
58 virtual std::string const& timecode () const = 0;
59 virtual std::string const& musical_time () const = 0;
60 virtual bool shift_mod () const = 0;
61 virtual bool show_meters () const = 0;
62 virtual bool show_panner () const = 0;
63 virtual bool twolinetext () const = 0;
64 virtual uint32_t clock_mode () const = 0;
66 size_t tx_midi2 (uint8_t sb, uint8_t d1) const
68 std::vector<uint8_t> d;
74 size_t tx_midi3 (uint8_t sb, uint8_t d1, uint8_t d2) const
76 std::vector<uint8_t> d;
83 size_t tx_sysex (size_t count, ...)
85 std::vector<uint8_t> d;
89 va_start (var_args, count);
90 for (size_t i = 0; i < count; ++i)
92 // uint8_t {aka unsigned char} is promoted to βintβ when passed through β...β
93 uint8_t b = va_arg (var_args, int);
102 size_t tx_text (uint8_t id, uint8_t line, uint8_t align, std::string const& txt)
104 std::vector<uint8_t> d;
107 d.push_back (id & 0x0f);
108 d.push_back (line & 0x03);
109 d.push_back (align & 0x07);
111 for (size_t i = 0; i < txt.size(); ++i)
113 d.push_back (txt[i]);
123 PBD::Signal1<void, bool> ShiftButtonChange;
124 PBD::Signal1<void, bool> ARMButtonChange;
127 PBD::Signal1<void, bool> BlinkIt;
128 PBD::Signal0<void> Periodic;
131 void sysexhdr (std::vector<uint8_t>& d)
133 /* faderport8 <SysExHdr> */
155 enum NavigationMode {
163 NavPan /* FP2 only */
183 #endif /* _ardour_surfaces_fp8base_h_ */