From 03f188cc8b17edc7c727f62b22b4577a2fdbfbe8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 29 Sep 2008 20:50:21 +0000 Subject: [PATCH] Remove ARDOUR::Parameter::is_integer. git-svn-id: svn://localhost/ardour2/branches/3.0@3837 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_line.cc | 5 +++-- libs/ardour/ardour/event_type_map.h | 2 ++ libs/ardour/ardour/parameter.h | 4 ---- libs/ardour/event_type_map.cc | 7 +++++++ libs/evoral/evoral/TypeMap.hpp | 3 +++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 8754bbc21a..854eb57a92 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -614,10 +614,11 @@ AutomationLine::get_verbose_cursor_string (double fraction) } } else { view_to_model_y(fraction); - if (((ARDOUR::Parameter)alist->parameter()).is_integer()) + if (EventTypeMap::instance().is_integer(alist->parameter())) { snprintf (buf, sizeof (buf), "%d", (int)fraction); - else + } else { snprintf (buf, sizeof (buf), "%.2f", fraction); + } } return buf; diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h index 6736feeb86..4d7180c028 100644 --- a/libs/ardour/ardour/event_type_map.h +++ b/libs/ardour/ardour/event_type_map.h @@ -31,6 +31,8 @@ public: uint8_t parameter_midi_type(const Evoral::Parameter& param) const; uint32_t midi_event_type(uint8_t status) const; + bool is_integer(const Evoral::Parameter& param) const; + static EventTypeMap& instance() { return event_type_map; } private: diff --git a/libs/ardour/ardour/parameter.h b/libs/ardour/ardour/parameter.h index edb157ed57..a9aa051924 100644 --- a/libs/ardour/ardour/parameter.h +++ b/libs/ardour/ardour/parameter.h @@ -93,10 +93,6 @@ public: std::string symbol() const; - inline bool is_integer() const { - return (_type >= MidiCCAutomation && _type <= MidiChannelPressureAutomation); - } - inline operator Parameter() { return (Parameter)*this; } }; diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index cd78fd02f7..2d724a26ef 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -57,5 +57,12 @@ EventTypeMap::midi_event_type(uint8_t status) const } } +bool +EventTypeMap::is_integer(const Evoral::Parameter& param) const +{ + return ( param.type() >= MidiCCAutomation + && param.type() <= MidiChannelPressureAutomation); +} + } // namespace ARDOUR diff --git a/libs/evoral/evoral/TypeMap.hpp b/libs/evoral/evoral/TypeMap.hpp index 3ab8066f70..91986e0dcb 100644 --- a/libs/evoral/evoral/TypeMap.hpp +++ b/libs/evoral/evoral/TypeMap.hpp @@ -45,6 +45,9 @@ public: /** The type ID for a MIDI event with the given status byte */ virtual uint32_t midi_event_type(uint8_t status) const = 0; + + /** Return true iff parameter should be locked to integer boundaries */ + bool is_integer(const Evoral::Parameter& param) const; }; } // namespace Evoral -- 2.30.2