diff options
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/evoral/Parameter.hpp | 18 | ||||
-rw-r--r-- | libs/evoral/evoral/TypeMap.hpp | 7 | ||||
-rw-r--r-- | libs/evoral/evoral/midi_events.h | 6 | ||||
-rw-r--r-- | libs/evoral/src/Sequence.cpp | 4 |
4 files changed, 12 insertions, 23 deletions
diff --git a/libs/evoral/evoral/Parameter.hpp b/libs/evoral/evoral/Parameter.hpp index 1ff01df197..d21b1ee3b8 100644 --- a/libs/evoral/evoral/Parameter.hpp +++ b/libs/evoral/evoral/Parameter.hpp @@ -40,22 +40,10 @@ namespace Evoral { class Parameter { public: - Parameter(uint32_t type, uint8_t channel, uint32_t id=0) + Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) : _type(type), _id(id), _channel(channel) {} - Parameter(const std::string& str) { - int channel; - if (sscanf(str.c_str(), "%d_c%d_n%d", &_type, &channel, &_id) == 3) { - if (channel >= 0 && channel <= 127) { - _channel = channel; - } else { - std::cerr << "WARNING: Channel out of range: " << channel << std::endl; - } - } - std::cerr << "WARNING: Unable to create parameter from string: " << str << std::endl; - } - virtual ~Parameter() {} inline uint32_t type() const { return _type; } @@ -113,10 +101,6 @@ public: inline operator bool() const { return (_type != 0); } - virtual std::string symbol() const { - return (boost::format("%1%_c%2%_n%3%") % _type % (int)_channel % _id).str(); - } - /** Not used in indentity/comparison */ struct Metadata { Metadata(double low=0.0, double high=1.0, double mid=0.0) diff --git a/libs/evoral/evoral/TypeMap.hpp b/libs/evoral/evoral/TypeMap.hpp index 91986e0dcb..9e3d64a047 100644 --- a/libs/evoral/evoral/TypeMap.hpp +++ b/libs/evoral/evoral/TypeMap.hpp @@ -47,7 +47,12 @@ public: 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; + virtual bool is_integer(const Evoral::Parameter& param) const = 0; + + /** Create a parameter with the given type ID */ + virtual Parameter new_parameter(uint32_t type, uint8_t channel, uint32_t id) const = 0; + + virtual std::string to_symbol(const Parameter& param) const = 0; }; } // namespace Evoral diff --git a/libs/evoral/evoral/midi_events.h b/libs/evoral/evoral/midi_events.h index 1c786aa6f7..d0329cdaf8 100644 --- a/libs/evoral/evoral/midi_events.h +++ b/libs/evoral/evoral/midi_events.h @@ -18,8 +18,8 @@ * */ -#ifndef RAUL_MIDI_EVENTS_H -#define RAUL_MIDI_EVENTS_H +#ifndef EVORAL_MIDI_EVENTS_H +#define EVORAL_MIDI_EVENTS_H /** @@ -130,4 +130,4 @@ /** \} */ -#endif /* RAUL_MIDI_EVENTS_H */ +#endif /* EVORAL_MIDI_EVENTS_H */ diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 1facd6761e..3980f46ae2 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -92,7 +92,7 @@ Sequence::const_iterator::const_iterator(const Sequence& seq, EventTime t) // find the earliest control event available for (Controls::const_iterator i = seq._controls.begin(); i != seq._controls.end(); ++i) { - debugout << "Iterator: control: " << i->first.symbol() << endl; + debugout << "Iterator: control: " << seq._type_map.to_symbol(i->first) << endl; double x, y; bool ret = i->second->list()->rt_safe_earliest_event_unlocked(t, DBL_MAX, x, y); if (!ret) { @@ -628,7 +628,7 @@ Sequence::append_note_off_unlocked(uint8_t chan, EventTime time, uint8_t note_nu void Sequence::append_control_unlocked(const Parameter& param, EventTime time, double value) { - debugout << this << " " << param.symbol() << " @ " << time << " \t= \t" << value + debugout << this << " " << _type_map.to_symbol(param) << " @ " << time << " \t= \t" << value << " # controls: " << _controls.size() << endl; control(param, true)->list()->rt_add(time, value); } |