2 Copyright (C) 2007 Paul Davis
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.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk_ardour_midi_util_h__
21 #define __gtk_ardour_midi_util_h__
23 #include "rgb_macros.h"
24 #include "ardour_ui.h"
25 #include "ui_config.h"
27 inline static uint32_t note_outline_color(uint8_t vel)
30 return UINT_INTERPOLATE(
31 ARDOUR_UI::config()->canvasvar_MidiNoteOutlineMin.get(),
32 ARDOUR_UI::config()->canvasvar_MidiNoteOutlineMid.get(),
33 (vel / (double)63.0));
35 return UINT_INTERPOLATE(
36 ARDOUR_UI::config()->canvasvar_MidiNoteOutlineMid.get(),
37 ARDOUR_UI::config()->canvasvar_MidiNoteOutlineMax.get(),
38 ((vel-64) / (double)63.0));
42 inline static uint32_t note_fill_color(uint8_t vel)
45 return UINT_INTERPOLATE(
46 ARDOUR_UI::config()->canvasvar_MidiNoteFillMin.get(),
47 ARDOUR_UI::config()->canvasvar_MidiNoteFillMid.get(),
48 (vel / (double)63.0));
50 return UINT_INTERPOLATE(
51 ARDOUR_UI::config()->canvasvar_MidiNoteFillMid.get(),
52 ARDOUR_UI::config()->canvasvar_MidiNoteFillMax.get(),
53 ((vel-64) / (double)63.0));
57 inline static void clamp_0_to_127(uint8_t &val)
59 if( (127 < val) && (val < 192) ) {
61 } else if( (192 <= val) && (val < 255) ) {
66 #endif /* __gtk_ardour_midi_util_h__ */