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_fp8strip_h_
20 #define _ardour_surfaces_fp8strip_h_
23 #include <boost/shared_ptr.hpp>
25 #include "pbd/signals.h"
26 #include "pbd/controllable.h"
29 #include "fp8_button.h"
33 #elif defined FADERPORT2
41 class AutomationControl;
43 class ReadOnlyControl;
46 namespace ArdourSurface { namespace FP_NAMESPACE {
51 FP8Strip (FP8Base& b, uint8_t id);
65 static uint8_t midi_ctrl_id (CtrlElement type, uint8_t id);
67 FP8ButtonInterface& solo_button () { return _solo; }
68 FP8ButtonInterface& mute_button () { return _mute; }
69 FP8ButtonInterface& selrec_button () { return _selrec; }
70 FP8ButtonInterface& recarm_button () { return *_selrec.button_shift(); }
71 FP8ButtonInterface& select_button () { return *_selrec.button(); }
73 void set_select_button_color (uint32_t color) {
74 if ((color & 0xffffff00) == 0) {
75 select_button ().set_color (0xffffffff);
77 select_button ().set_color (color);
81 bool midi_touch (bool t);
82 bool midi_fader (float val);
84 void initialize (); // call only when connected, sends midi
86 void set_select_cb (boost::function<void ()>&);
90 PluginSelect, // no clock display
91 PluginParam, // param value
92 SendDisplay, // param value + select-bar
95 void set_periodic_display_mode (DisplayMode m);
97 // convenience function to call all set_XXX_controllable
98 void set_stripable (boost::shared_ptr<ARDOUR::Stripable>, bool panmode);
99 void set_text_line (uint8_t, std::string const&, bool inv = false);
118 void unset_controllables (int which = CTRL_ALL);
120 void set_fader_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
121 void set_mute_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
122 void set_solo_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
123 void set_rec_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
124 void set_pan_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
125 void set_select_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
130 FP8MomentaryButton _solo;
131 FP8MomentaryButton _mute;
132 FP8ARMSensitiveButton _selrec;
136 PBD::ScopedConnection _base_connection; // periodic
137 PBD::ScopedConnectionList _button_connections;
139 std::string _stripable_name;
141 boost::shared_ptr<ARDOUR::AutomationControl> _fader_ctrl;
142 boost::shared_ptr<ARDOUR::AutomationControl> _mute_ctrl;
143 boost::shared_ptr<ARDOUR::AutomationControl> _solo_ctrl;
144 boost::shared_ptr<ARDOUR::AutomationControl> _rec_ctrl;
145 boost::shared_ptr<ARDOUR::AutomationControl> _pan_ctrl;
146 boost::shared_ptr<ARDOUR::AutomationControl> _x_select_ctrl;
148 PBD::ScopedConnection _fader_connection;
149 PBD::ScopedConnection _mute_connection;
150 PBD::ScopedConnection _solo_connection;
151 PBD::ScopedConnection _rec_connection;
152 PBD::ScopedConnection _pan_connection;
153 PBD::ScopedConnection _x_select_connection;
155 boost::shared_ptr<ARDOUR::PeakMeter> _peak_meter;
156 boost::shared_ptr<ARDOUR::ReadOnlyControl> _redux_ctrl;
158 void set_x_select_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
159 boost::function<void ()> _select_plugin_functor;
161 void drop_automation_controls ();
163 PBD::Controllable::GroupControlDisposition group_mode () const;
165 /* notifications, update view */
166 void notify_fader_changed ();
167 void notify_solo_changed ();
168 void notify_mute_changed ();
169 void notify_rec_changed ();
170 void notify_pan_changed ();
171 void notify_x_select_changed ();
173 /* actions, update model */
174 void set_mute (bool);
175 void set_solo (bool);
179 /* periodic poll, update view */
180 void set_strip_name ();
181 void periodic_update_fader ();
182 void periodic_update_meter ();
183 void periodic_update_timecode (uint32_t);
187 unsigned short _last_fader;
190 uint8_t _last_barpos;
193 void set_strip_mode (uint8_t, bool clear = false);
194 void set_bar_mode (uint8_t, bool force = false);
198 DisplayMode _displaymode;
199 std::string _last_line[4];
203 #endif /* _ardour_surfaces_fp8strip_h_ */