use MIDI meter colors (themeable) to show MIDI note velocity.
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 5 Jul 2018 18:56:56 +0000 (14:56 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 5 Jul 2018 18:56:56 +0000 (14:56 -0400)
Selected notes no longer show the selected color for fill, following Alex
Mitchell's proof-of-concept patch that showed it was easier to see what you're
doing when the fill color shows velocity and we just use outline for selection
status.

gtk2_ardour/note_base.cc
gtk2_ardour/note_base.h

index afc72551a186f2b75f243e24fbc798ee01a204a7..52ee88a2d6794b4766a96b5fdc10b8b3018cf4f4 100644 (file)
@@ -330,3 +330,21 @@ NoteBase::big_enough_to_trim () const
        return (x1() - x0()) > 10;
 }
 
+
+uint32_t
+NoteBase::meter_style_fill_color(uint8_t vel, bool selected)
+{
+       if (vel < 32) {
+               return UINT_INTERPOLATE(UIConfiguration::instance().color ("midi meter color0"), UIConfiguration::instance().color ("midi meter color1"), (vel / 32.0));
+       } else if (vel < 64) {
+               return UINT_INTERPOLATE(UIConfiguration::instance().color ("midi meter color2"), UIConfiguration::instance().color ("midi meter color3"), ((vel-32) / 32.0));
+       } else if (vel < 100) {
+               return UINT_INTERPOLATE(UIConfiguration::instance().color ("midi meter color4"), UIConfiguration::instance().color ("midi meter color5"), ((vel-64) / 32.0));
+       } else if (vel < 112) {
+               return UINT_INTERPOLATE(UIConfiguration::instance().color ("midi meter color6"), UIConfiguration::instance().color ("midi meter color7"), ((vel-100) / 36.0));
+       } else {
+               return  UINT_INTERPOLATE(UIConfiguration::instance().color ("midi meter color8"), UIConfiguration::instance().color ("midi meter color9"), ((vel-112) / 17.0));
+       }
+}
+
+
index ebc00cbfa4e6177bdf134aeea8e2d39f7e58f512..2a3612579dfac39f7ee3f54a5e22a6d8d9cc3f9e 100644 (file)
@@ -103,15 +103,7 @@ public:
 
        static void set_colors ();
 
-       inline static uint32_t meter_style_fill_color(uint8_t vel, bool selected) {
-               if (selected) {
-                       return _selected_mod_col;
-               } else if (vel < 64) {
-                       return UINT_INTERPOLATE(_min_col, _mid_col, (vel / (double)63.0));
-               } else {
-                       return UINT_INTERPOLATE(_mid_col, _max_col, ((vel - 64) / (double)63.0));
-               }
-       }
+       static uint32_t meter_style_fill_color(uint8_t vel, bool selected);
 
        /// calculate outline colors from fill colors of notes
        inline static uint32_t calculate_outline(uint32_t color, bool selected=false) {