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 class AutomationControl;
35 class ReadOnlyControl;
38 namespace ArdourSurface {
43 FP8Strip (FP8Base& b, uint8_t id);
46 FP8ButtonInterface& solo_button () { return _solo; }
47 FP8ButtonInterface& mute_button () { return _mute; }
48 FP8ButtonInterface& selrec_button () { return _selrec; }
49 FP8ButtonInterface& recarm_button () { return *_selrec.button_shift(); }
50 FP8ButtonInterface& select_button () { return *_selrec.button(); }
52 bool midi_touch (bool t);
53 bool midi_fader (float val);
55 void initialize (); // call only when connected, sends midi
57 void set_select_cb (boost::function<void ()>&);
61 PluginSelect, // no clock display
62 PluginParam, // param value
63 SendDisplay, // param value + select-bar
66 void set_periodic_display_mode (DisplayMode m);
68 // convenience function to call all set_XXX_controllable
69 void set_stripable (boost::shared_ptr<ARDOUR::Stripable>, bool panmode);
70 void set_text_line (uint8_t, std::string const&, bool inv = false);
88 void unset_controllables (int which = CTRL_ALL);
90 void set_fader_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
91 void set_mute_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
92 void set_solo_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
93 void set_rec_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
94 void set_pan_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
95 void set_select_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
100 FP8MomentaryButton _solo;
101 FP8MomentaryButton _mute;
102 FP8ARMSensitiveButton _selrec;
106 PBD::ScopedConnection _base_connection; // periodic
107 PBD::ScopedConnectionList _button_connections;
109 boost::shared_ptr<ARDOUR::Stripable> _stripable;
111 boost::shared_ptr<ARDOUR::AutomationControl> _fader_ctrl;
112 boost::shared_ptr<ARDOUR::AutomationControl> _mute_ctrl;
113 boost::shared_ptr<ARDOUR::AutomationControl> _solo_ctrl;
114 boost::shared_ptr<ARDOUR::AutomationControl> _rec_ctrl;
115 boost::shared_ptr<ARDOUR::AutomationControl> _pan_ctrl;
116 boost::shared_ptr<ARDOUR::AutomationControl> _x_select_ctrl;
118 PBD::ScopedConnection _fader_connection;
119 PBD::ScopedConnection _mute_connection;
120 PBD::ScopedConnection _solo_connection;
121 PBD::ScopedConnection _rec_connection;
122 PBD::ScopedConnection _pan_connection;
123 PBD::ScopedConnection _x_select_connection;
125 boost::shared_ptr<ARDOUR::PeakMeter> _peak_meter;
126 boost::shared_ptr<ARDOUR::ReadOnlyControl> _redux_ctrl;
128 void set_x_select_controllable (boost::shared_ptr<ARDOUR::AutomationControl>);
129 boost::function<void ()> _select_plugin_functor;
131 void drop_automation_controls ();
133 PBD::Controllable::GroupControlDisposition group_mode () const;
135 /* notifications, update view */
136 void notify_fader_changed ();
137 void notify_solo_changed ();
138 void notify_mute_changed ();
139 void notify_rec_changed ();
140 void notify_pan_changed ();
141 void notify_x_select_changed ();
143 /* actions, update model */
144 void set_mute (bool);
145 void set_solo (bool);
149 /* periodic poll, update view */
150 void periodic_update_fader ();
151 void periodic_update_meter ();
152 void periodic_update_timecode ();
156 unsigned short _last_fader;
159 uint8_t _last_barpos;
162 void set_strip_mode (uint8_t, bool clear = false);
163 void set_bar_mode (uint8_t);
167 DisplayMode _displaymode;
168 std::string _last_line[4];
172 #endif /* _ardour_surfaces_fp8strip_h_ */