Ardour  9.0-pre0-384-ga76afae0e9
fp8_controls.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017-2018 Robin Gareus <robin@gareus.org>
3  *
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 of the License, or
7  * (at your option) any later version.
8  *
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.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_surfaces_fp8controls_h_
20 #define _ardour_surfaces_fp8controls_h_
21 
22 #include <map>
23 
24 #include "fp8_base.h"
25 #include "fp8_button.h"
26 #include "fp8_strip.h"
27 
28 namespace ArdourSurface { namespace FP_NAMESPACE {
29 
31 {
32 public:
34  virtual ~FP8Controls ();
35 
36  enum ButtonId {
43 
50 
51  // Automation
58 
59 #ifndef FADERPORT2
61 #endif
62 
63  // Pan/Param encoder press
65 
66  // Navigation
70 
79 
80  BtnF1, BtnF2, BtnF3, BtnF4,
81  BtnF5, BtnF6, BtnF7, BtnF8,
82 #ifdef FADERPORT2
83  BtnFootswitch,
84 #endif
85 
86  // FaderMode
91 
93 
94  // Mix Management
100 
106 
107  // General Controls
112 
119 
120  /* FP2 only */
122  BtnFlip
123 
124  };
125 
126  typedef std::map <ButtonId, std::string> UserButtonMap;
127 
128  UserButtonMap const& user_buttons () const {
129  return _user_buttons;
130  }
131 
132  bool button_name_to_enum (std::string const&, ButtonId&) const;
133  bool button_enum_to_name (ButtonId, std::string&) const;
134 
137 
138 #ifdef FADERPORT2
139  FP8Types::FaderMode fader_mode () const { return FP8Types::ModeTrack; }
140  FP8Types::MixMode mix_mode () const { return FP8Types::MixUser; }
141 #else
142  FP8Types::FaderMode fader_mode () const { return _fadermode; }
143  FP8Types::MixMode mix_mode () const { return _mixmode; }
144 #endif
145 
146  FP8Types::NavigationMode nav_mode () const { return _navmode; }
147  bool display_timecode () const { return _display_timecode; }
148 
150  FP8Strip& strip (uint8_t id);
151 
152  bool midi_event (uint8_t id, uint8_t val);
153  bool midi_touch (uint8_t id, uint8_t val);
154  bool midi_fader (uint8_t id, unsigned short val);
155 
156  void initialize ();
157  void all_lights_off () const;
158 
160 protected:
161  typedef std::map <uint8_t, FP8ButtonInterface*> MidiButtonMap;
162  typedef std::map <ButtonId, FP8ButtonInterface*> CtrlButtonMap;
163 
167 
171 
172  FP8Strip* chanstrip[N_STRIPS];
173 
178 
181 
182  std::map<std::string, ButtonId> _user_str_to_enum;
183  std::map<ButtonId, std::string> _user_enum_to_str;
184 
186 };
187 
188 } } /* namespace */
189 #endif /* _ardour_surfaces_fp8controls_h_ */
bool midi_event(uint8_t id, uint8_t val)
PBD::ScopedConnectionList button_connections
Definition: fp8_controls.h:185
bool button_enum_to_name(ButtonId, std::string &) const
std::map< ButtonId, FP8ButtonInterface * > CtrlButtonMap
Definition: fp8_controls.h:162
void set_mix_mode(FP8Types::MixMode)
bool midi_touch(uint8_t id, uint8_t val)
FP8ButtonInterface & button(ButtonId id)
FP8Types::FaderMode _fadermode
Definition: fp8_controls.h:174
FP8Types::NavigationMode _navmode
Definition: fp8_controls.h:175
FP8Strip & strip(uint8_t id)
FP8Types::MixMode mix_mode() const
Definition: fp8_controls.h:143
PBD::Signal< void()> MixModeChanged
Definition: fp8_controls.h:136
bool button_name_to_enum(std::string const &, ButtonId &) const
bool midi_fader(uint8_t id, unsigned short val)
std::map< ButtonId, std::string > _user_enum_to_str
Definition: fp8_controls.h:183
std::map< std::string, ButtonId > _user_str_to_enum
Definition: fp8_controls.h:182
std::map< uint8_t, FP8ButtonInterface * > MidiButtonMap
Definition: fp8_controls.h:161
void set_fader_mode(FP8Types::FaderMode)
UserButtonMap const & user_buttons() const
Definition: fp8_controls.h:128
PBD::Signal< void()> FaderModeChanged
Definition: fp8_controls.h:135
FP8Types::FaderMode fader_mode() const
Definition: fp8_controls.h:142
FP8Types::NavigationMode nav_mode() const
Definition: fp8_controls.h:146
void set_nav_mode(FP8Types::NavigationMode)
std::map< ButtonId, std::string > UserButtonMap
Definition: fp8_controls.h:126
#define FP_NAMESPACE
Definition: fp8_base.h:32
#define N_STRIPS
Definition: fp8_strip.h:36