Ardour  9.0-pre0-822-g12e3bc5c20
gtk2_ardour/midi_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2008 Hans Baier <hansfbaier@googlemail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 
22 #include <cstdint>
23 #include <string>
24 
25 namespace Gtk {
26  class Menu;
27  namespace Menu_Helpers {
28  class MenuList;
29  }
30 }
31 
32 namespace ARDOUR {
33  class InstrumentInfo;
34 }
35 
36 inline static void clamp_to_0_127(uint8_t &val)
37 {
38  if ((127 < val) && (val < 192)) {
39  val = 127;
40  } else if ((192 <= val) && (val < 255)) {
41  val = 0;
42  }
43 }
44 
45 
46 void
47 build_controller_menu (Gtk::Menu& menu, ARDOUR::InstrumentInfo const & instrument_info, uint16_t channel_mask,
48  std::function<void (Gtk::Menu_Helpers::MenuList&, int, const std::string&)> add_single,
49  std::function<void (Gtk::Menu_Helpers::MenuList&, uint16_t, int, const std::string&)> add_multi);
static void clamp_to_0_127(uint8_t &val)
void build_controller_menu(Gtk::Menu &menu, ARDOUR::InstrumentInfo const &instrument_info, uint16_t channel_mask, std::function< void(Gtk::Menu_Helpers::MenuList &, int, const std::string &)> add_single, std::function< void(Gtk::Menu_Helpers::MenuList &, uint16_t, int, const std::string &)> add_multi)
Definition: ardour_ui.h:189