diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-19 03:03:28 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-19 03:03:28 +0000 |
commit | e258b2622a4386b405c2216d79b34887c3ed55bf (patch) | |
tree | c2abdacc5a31e9d572257050256c704b41fb46f5 /libs/evoral | |
parent | c25c7598c134af88bb85b5690aabc35472c77adf (diff) |
MIDI region forking, plus Playlist::regions_to_read() fix forward ported from 2.X. region forking requires a few cleanups
git-svn-id: svn://localhost/ardour2/branches/3.0@7118 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral')
-rw-r--r-- | libs/evoral/evoral/ControlSet.hpp | 1 | ||||
-rw-r--r-- | libs/evoral/evoral/MIDIEvent.hpp | 1 | ||||
-rw-r--r-- | libs/evoral/evoral/Sequence.hpp | 1 | ||||
-rw-r--r-- | libs/evoral/evoral/types.hpp | 3 | ||||
-rw-r--r-- | libs/evoral/src/ControlSet.cpp | 6 | ||||
-rw-r--r-- | libs/evoral/src/Sequence.cpp | 26 |
6 files changed, 38 insertions, 0 deletions
diff --git a/libs/evoral/evoral/ControlSet.hpp b/libs/evoral/evoral/ControlSet.hpp index 39c3eba344..f0c6bd0807 100644 --- a/libs/evoral/evoral/ControlSet.hpp +++ b/libs/evoral/evoral/ControlSet.hpp @@ -36,6 +36,7 @@ class ControlEvent; class ControlSet : public boost::noncopyable { public: ControlSet(); + ControlSet (const ControlSet&); virtual ~ControlSet() {} virtual boost::shared_ptr<Evoral::Control> diff --git a/libs/evoral/evoral/MIDIEvent.hpp b/libs/evoral/evoral/MIDIEvent.hpp index c06a323d73..359d640fe5 100644 --- a/libs/evoral/evoral/MIDIEvent.hpp +++ b/libs/evoral/evoral/MIDIEvent.hpp @@ -68,6 +68,7 @@ struct MIDIEvent : public Event<Time> { inline bool is_aftertouch() const { return (type() == MIDI_CMD_NOTE_PRESSURE); } inline bool is_channel_pressure() const { return (type() == MIDI_CMD_CHANNEL_PRESSURE); } inline uint8_t note() const { return (this->_buf[1]); } + inline void set_note(uint8_t n) { this->_buf[1] = n; } inline uint8_t velocity() const { return (this->_buf[2]); } inline void set_velocity(uint8_t value) { this->_buf[2] = value; } inline void scale_velocity(float factor) { diff --git a/libs/evoral/evoral/Sequence.hpp b/libs/evoral/evoral/Sequence.hpp index 8c0eab1be9..3aafb15312 100644 --- a/libs/evoral/evoral/Sequence.hpp +++ b/libs/evoral/evoral/Sequence.hpp @@ -61,6 +61,7 @@ template<typename Time> class Sequence : virtual public ControlSet { public: Sequence(const TypeMap& type_map); + Sequence(const Sequence<Time>& other); protected: struct WriteLockImpl { diff --git a/libs/evoral/evoral/types.hpp b/libs/evoral/evoral/types.hpp index 2ba5ba86cb..a2cc814c69 100644 --- a/libs/evoral/evoral/types.hpp +++ b/libs/evoral/evoral/types.hpp @@ -22,6 +22,7 @@ #include <stdint.h> #include <list> #include <cmath> +#include <cfloat> namespace Evoral { @@ -30,6 +31,8 @@ typedef uint32_t FrameTime; /** Musical time: beats relative to some defined origin */ typedef double MusicalTime; +const MusicalTime MaxMusicalTime = DBL_MAX; +const MusicalTime MinMusicalTime = DBL_MIN; static inline bool musical_time_equal (MusicalTime a, MusicalTime b) { /* acceptable tolerance is 1 tick. Nice if there was no magic number here */ diff --git a/libs/evoral/src/ControlSet.cpp b/libs/evoral/src/ControlSet.cpp index 29d3b40344..e19acf7689 100644 --- a/libs/evoral/src/ControlSet.cpp +++ b/libs/evoral/src/ControlSet.cpp @@ -31,6 +31,12 @@ ControlSet::ControlSet() { } +ControlSet::ControlSet (const ControlSet& other) + : noncopyable () +{ + /* derived class must copy controls */ +} + void ControlSet::add_control(boost::shared_ptr<Control> ac) { diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 93eccb6cce..281aec514b 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -398,6 +398,32 @@ Sequence<Time>::Sequence(const TypeMap& type_map) assert( ! _end_iter._lock); } +template<typename Time> +Sequence<Time>::Sequence(const Sequence<Time>& other) + : ControlSet (other) + , _edited(false) + , _type_map(other._type_map) + , _writing(false) + , _end_iter(*this, DBL_MAX) + , _percussive(other._percussive) + , _lowest_note(other._lowest_note) + , _highest_note(other._highest_note) +{ + for (typename Notes::const_iterator i = other._notes.begin(); i != other._notes.end(); ++i) { + boost::shared_ptr<Note<Time> > n (new Note<Time> (**i)); + _notes.insert (n); + } + + for (typename SysExes::const_iterator i = other._sysexes.begin(); i != other._sysexes.end(); ++i) { + boost::shared_ptr<Event<Time> > n (new Event<Time> (**i, true)); + _sysexes.push_back (n); + } + + DUMP(format("Sequence copied: %1%\n") % this); + assert(_end_iter._is_end); + assert(! _end_iter._lock); +} + /** Write the controller event pointed to by \a iter to \a ev. * The buffer of \a ev will be allocated or resized as necessary. * The event_type of \a ev should be set to the expected output type. |