diff options
author | David Robillard <d@drobilla.net> | 2015-01-07 00:12:07 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-01-07 00:12:07 -0500 |
commit | 2a251b457069ffb4b744fbd0dd7aca7acb31f381 (patch) | |
tree | 4311e63fe7ef1b5d7a5b841a4dd0eb7b26b324a7 /libs/ardour | |
parent | 4d202d9157bef5b6325fe54b7874080952f86a37 (diff) |
MusicalTime => Beats.
Diffstat (limited to 'libs/ardour')
29 files changed, 159 insertions, 159 deletions
diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_frames_converter.h index ada09b1179..908dd1909e 100644 --- a/libs/ardour/ardour/beats_frames_converter.h +++ b/libs/ardour/ardour/beats_frames_converter.h @@ -37,15 +37,15 @@ class TempoMap; * them to the opposite unit, taking tempo changes into account. */ class LIBARDOUR_API BeatsFramesConverter - : public Evoral::TimeConverter<Evoral::MusicalTime,framepos_t> { + : public Evoral::TimeConverter<Evoral::Beats,framepos_t> { public: BeatsFramesConverter (TempoMap& tempo_map, framepos_t origin) - : Evoral::TimeConverter<Evoral::MusicalTime, framepos_t> (origin) + : Evoral::TimeConverter<Evoral::Beats, framepos_t> (origin) , _tempo_map(tempo_map) {} - framepos_t to (Evoral::MusicalTime beats) const; - Evoral::MusicalTime from (framepos_t frames) const; + framepos_t to (Evoral::Beats beats) const; + Evoral::Beats from (framepos_t frames) const; private: TempoMap& _tempo_map; diff --git a/libs/ardour/ardour/legatize.h b/libs/ardour/ardour/legatize.h index 4a170e1a1c..78b384e1c7 100644 --- a/libs/ardour/ardour/legatize.h +++ b/libs/ardour/ardour/legatize.h @@ -39,10 +39,10 @@ public: Legatize(bool shrink_only); ~Legatize(); - typedef Evoral::Sequence<Evoral::MusicalTime>::Notes Notes; + typedef Evoral::Sequence<Evoral::Beats>::Notes Notes; Command* operator()(boost::shared_ptr<ARDOUR::MidiModel> model, - Evoral::MusicalTime position, + Evoral::Beats position, std::vector<Notes>& seqs); std::string name() const { return std::string ("legatize"); } diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index b86a7436bb..4214431280 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -52,9 +52,9 @@ class MidiSource; * Because of this MIDI controllers and automatable controllers/widgets/etc * are easily interchangeable. */ -class LIBARDOUR_API MidiModel : public AutomatableSequence<Evoral::MusicalTime> { +class LIBARDOUR_API MidiModel : public AutomatableSequence<Evoral::Beats> { public: - typedef Evoral::MusicalTime TimeType; + typedef Evoral::Beats TimeType; MidiModel (boost::shared_ptr<MidiSource>); @@ -259,8 +259,8 @@ public: bool write_section_to(boost::shared_ptr<MidiSource> source, const Glib::Threads::Mutex::Lock& source_lock, - Evoral::MusicalTime begin = Evoral::MinMusicalTime, - Evoral::MusicalTime end = Evoral::MaxMusicalTime); + Evoral::Beats begin = Evoral::MinBeats, + Evoral::Beats end = Evoral::MaxBeats); // MidiModel doesn't use the normal AutomationList serialisation code // since controller data is stored in the .mid diff --git a/libs/ardour/ardour/midi_operator.h b/libs/ardour/ardour/midi_operator.h index 36e87b714b..b79544ed61 100644 --- a/libs/ardour/ardour/midi_operator.h +++ b/libs/ardour/ardour/midi_operator.h @@ -38,8 +38,8 @@ class LIBARDOUR_API MidiOperator { virtual ~MidiOperator() {} virtual Command* operator() (boost::shared_ptr<ARDOUR::MidiModel>, - Evoral::MusicalTime, - std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&) = 0; + Evoral::Beats, + std::vector<Evoral::Sequence<Evoral::Beats>::Notes>&) = 0; virtual std::string name() const = 0; }; diff --git a/libs/ardour/ardour/midi_playlist_source.h b/libs/ardour/ardour/midi_playlist_source.h index f064553342..6633be3c9e 100644 --- a/libs/ardour/ardour/midi_playlist_source.h +++ b/libs/ardour/ardour/midi_playlist_source.h @@ -45,7 +45,7 @@ public: XMLNode& get_state (); int set_state (const XMLNode&, int version); - void append_event_beats(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<Evoral::MusicalTime>& ev); + void append_event_beats(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<Evoral::Beats>& ev); void append_event_frames(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<framepos_t>& ev, framepos_t source_start); void load_model(const Glib::Threads::Mutex::Lock& lock, bool force_reload=false); void destroy_model(const Glib::Threads::Mutex::Lock& lock); diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 2a4e3a6190..ece23b65f0 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -37,8 +37,8 @@ namespace ARDOUR { MidiModel used by the MidiRegion */ LIBARDOUR_API extern PBD::PropertyDescriptor<void*> midi_data; - LIBARDOUR_API extern PBD::PropertyDescriptor<Evoral::MusicalTime> start_beats; - LIBARDOUR_API extern PBD::PropertyDescriptor<Evoral::MusicalTime> length_beats; + LIBARDOUR_API extern PBD::PropertyDescriptor<Evoral::Beats> start_beats; + LIBARDOUR_API extern PBD::PropertyDescriptor<Evoral::Beats> length_beats; } } @@ -114,8 +114,8 @@ class LIBARDOUR_API MidiRegion : public Region private: friend class RegionFactory; - PBD::Property<Evoral::MusicalTime> _start_beats; - PBD::Property<Evoral::MusicalTime> _length_beats; + PBD::Property<Evoral::Beats> _start_beats; + PBD::Property<Evoral::Beats> _length_beats; MidiRegion (const SourceList&); MidiRegion (boost::shared_ptr<const MidiRegion>); diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 2b78230a00..8a0c13681d 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -43,7 +43,7 @@ template<typename T> class MidiRingBuffer; class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_shared_from_this<MidiSource> { public: - typedef Evoral::MusicalTime TimeType; + typedef Evoral::Beats TimeType; MidiSource (Session& session, std::string name, Source::Flag flags = Source::Flag(0)); MidiSource (Session& session, const XMLNode&); @@ -59,8 +59,8 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha */ int write_to (const Lock& lock, boost::shared_ptr<MidiSource> newsrc, - Evoral::MusicalTime begin = Evoral::MinMusicalTime, - Evoral::MusicalTime end = Evoral::MaxMusicalTime); + Evoral::Beats begin = Evoral::MinBeats, + Evoral::Beats end = Evoral::MaxBeats); /** Read the data in a given time range from the MIDI source. * All time stamps in parameters are in audio frames (even if the source has tempo time). @@ -93,8 +93,8 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha * * Caller must ensure that the event is later than the last written event. */ - virtual void append_event_beats(const Lock& lock, - const Evoral::Event<Evoral::MusicalTime>& ev) = 0; + virtual void append_event_beats(const Lock& lock, + const Evoral::Event<Evoral::Beats>& ev) = 0; /** Append a single event with a timestamp in frames. * @@ -132,9 +132,9 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha * etc. */ virtual void mark_midi_streaming_write_completed ( - const Lock& lock, - Evoral::Sequence<Evoral::MusicalTime>::StuckNoteOption stuck_option, - Evoral::MusicalTime when = Evoral::MusicalTime()); + const Lock& lock, + Evoral::Sequence<Evoral::Beats>::StuckNoteOption stuck_option, + Evoral::Beats when = Evoral::Beats()); virtual void session_saved(); @@ -205,11 +205,11 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha boost::shared_ptr<MidiModel> _model; bool _writing; - mutable Evoral::Sequence<Evoral::MusicalTime>::const_iterator _model_iter; - mutable bool _model_iter_valid; + mutable Evoral::Sequence<Evoral::Beats>::const_iterator _model_iter; + mutable bool _model_iter_valid; - mutable Evoral::MusicalTime _length_beats; - mutable framepos_t _last_read_end; + mutable Evoral::Beats _length_beats; + mutable framepos_t _last_read_end; /** The total duration of the current capture. */ framepos_t _capture_length; diff --git a/libs/ardour/ardour/midi_state_tracker.h b/libs/ardour/ardour/midi_state_tracker.h index 98611bc722..6690931422 100644 --- a/libs/ardour/ardour/midi_state_tracker.h +++ b/libs/ardour/ardour/midi_state_tracker.h @@ -46,7 +46,7 @@ public: void remove (uint8_t note, uint8_t chn); void resolve_notes (MidiBuffer& buffer, framepos_t time); void resolve_notes (Evoral::EventSink<framepos_t>& buffer, framepos_t time); - void resolve_notes (MidiSource& src, const Glib::Threads::Mutex::Lock& lock, Evoral::MusicalTime time); + void resolve_notes (MidiSource& src, const Glib::Threads::Mutex::Lock& lock, Evoral::Beats time); void dump (std::ostream&); void reset (); bool empty() const { return _on == 0; } diff --git a/libs/ardour/ardour/quantize.h b/libs/ardour/ardour/quantize.h index 09ba5f2aa2..639736b174 100644 --- a/libs/ardour/ardour/quantize.h +++ b/libs/ardour/ardour/quantize.h @@ -35,8 +35,8 @@ public: ~Quantize (); Command* operator() (boost::shared_ptr<ARDOUR::MidiModel>, - Evoral::MusicalTime position, - std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&); + Evoral::Beats position, + std::vector<Evoral::Sequence<Evoral::Beats>::Notes>&); std::string name() const { return std::string ("quantize"); } private: diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index d93fdb8506..29c6403694 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -51,14 +51,14 @@ public: return safe_midi_file_extension(path); } - void append_event_beats (const Lock& lock, const Evoral::Event<Evoral::MusicalTime>& ev); + void append_event_beats (const Lock& lock, const Evoral::Event<Evoral::Beats>& ev); void append_event_frames (const Lock& lock, const Evoral::Event<framepos_t>& ev, framepos_t source_start); void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode); void mark_streaming_write_completed (const Lock& lock); void mark_midi_streaming_write_completed (const Lock& lock, - Evoral::Sequence<Evoral::MusicalTime>::StuckNoteOption, - Evoral::MusicalTime when = Evoral::MusicalTime()); + Evoral::Sequence<Evoral::Beats>::StuckNoteOption, + Evoral::Beats when = Evoral::Beats()); XMLNode& get_state (); int set_state (const XMLNode&, int version); @@ -77,7 +77,7 @@ public: private: bool _open; - Evoral::MusicalTime _last_ev_time_beats; + Evoral::Beats _last_ev_time_beats; framepos_t _last_ev_time_frames; /** end time (start + duration) of last call to read_unlocked */ mutable framepos_t _smf_last_read_end; diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 19fe5b0b12..f2d314651d 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -276,9 +276,9 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible */ framepos_t framepos_plus_bbt (framepos_t pos, Timecode::BBT_Time b) const; - framepos_t framepos_plus_beats (framepos_t, Evoral::MusicalTime) const; - framepos_t framepos_minus_beats (framepos_t, Evoral::MusicalTime) const; - Evoral::MusicalTime framewalk_to_beats (framepos_t pos, framecnt_t distance) const; + framepos_t framepos_plus_beats (framepos_t, Evoral::Beats) const; + framepos_t framepos_minus_beats (framepos_t, Evoral::Beats) const; + Evoral::Beats framewalk_to_beats (framepos_t pos, framecnt_t distance) const; static const Tempo& default_tempo() { return _default_tempo; } static const Meter& default_meter() { return _default_meter; } diff --git a/libs/ardour/ardour/transform.h b/libs/ardour/ardour/transform.h index 08e4a43521..df77244a17 100644 --- a/libs/ardour/ardour/transform.h +++ b/libs/ardour/ardour/transform.h @@ -50,9 +50,9 @@ namespace ARDOUR { */ class LIBARDOUR_API Transform : public MidiOperator { public: - typedef Evoral::Sequence<Evoral::MusicalTime>::NotePtr NotePtr; - typedef Evoral::Sequence<Evoral::MusicalTime>::Notes Notes; - typedef ARDOUR::MidiModel::NoteDiffCommand::Property Property; + typedef Evoral::Sequence<Evoral::Beats>::NotePtr NotePtr; + typedef Evoral::Sequence<Evoral::Beats>::Notes Notes; + typedef ARDOUR::MidiModel::NoteDiffCommand::Property Property; /** Context while iterating over notes during transformation. */ struct Context { @@ -132,7 +132,7 @@ public: Transform(const Program& prog); Command* operator()(boost::shared_ptr<ARDOUR::MidiModel> model, - Evoral::MusicalTime position, + Evoral::Beats position, std::vector<Notes>& seqs); std::string name() const { return std::string ("transform"); } diff --git a/libs/ardour/ardour/variant.h b/libs/ardour/ardour/variant.h index 0402ffaa0b..9ecadbfe6a 100644 --- a/libs/ardour/ardour/variant.h +++ b/libs/ardour/ardour/variant.h @@ -57,7 +57,7 @@ public: explicit Variant(int32_t value) : _type(INT) { _int = value; } explicit Variant(int64_t value) : _type(LONG) { _long = value; } - explicit Variant(const Evoral::MusicalTime& beats) + explicit Variant(const Evoral::Beats& beats) : _type(BEATS) , _beats(beats) {} @@ -94,7 +94,7 @@ public: std::min(value, (double)INT64_MAX))); break; case BEATS: - _beats = Evoral::MusicalTime(value); + _beats = Evoral::Beats(value); break; default: _type = NOTHING; @@ -158,19 +158,19 @@ public: return false; } - bool operator==(const Evoral::MusicalTime& v) const { + bool operator==(const Evoral::Beats& v) const { return _type == BEATS && _beats == v; } bool operator!() const { return _type == NOTHING; } - Variant& operator=(Evoral::MusicalTime v) { + Variant& operator=(Evoral::Beats v) { _type = BEATS; _beats = v; return *this; } - const Evoral::MusicalTime& get_beats() const { + const Evoral::Beats& get_beats() const { ensure_type(BEATS); return _beats; } @@ -202,9 +202,9 @@ private: } } - Type _type; ///< Type tag - std::string _string; ///< PATH, STRING, URI - Evoral::MusicalTime _beats; ///< BEATS + Type _type; ///< Type tag + std::string _string; ///< PATH, STRING, URI + Evoral::Beats _beats; ///< BEATS // Union of all primitive numeric types union { diff --git a/libs/ardour/beats_frames_converter.cc b/libs/ardour/beats_frames_converter.cc index b99edbf51e..54db8008da 100644 --- a/libs/ardour/beats_frames_converter.cc +++ b/libs/ardour/beats_frames_converter.cc @@ -31,9 +31,9 @@ namespace ARDOUR { * taking tempo changes into account. */ framepos_t -BeatsFramesConverter::to (Evoral::MusicalTime beats) const +BeatsFramesConverter::to (Evoral::Beats beats) const { - if (beats < Evoral::MusicalTime()) { + if (beats < Evoral::Beats()) { std::cerr << "negative beats passed to BFC: " << beats << std::endl; PBD::stacktrace (std::cerr, 30); return 0; @@ -45,7 +45,7 @@ BeatsFramesConverter::to (Evoral::MusicalTime beats) const * supplied to the constructor. Returns the equivalent number of beats, * taking tempo changes into account. */ -Evoral::MusicalTime +Evoral::Beats BeatsFramesConverter::from (framepos_t frames) const { return _tempo_map.framewalk_to_beats (_origin_b, frames); @@ -60,7 +60,7 @@ DoubleBeatsFramesConverter::to (double beats) const PBD::stacktrace (std::cerr, 30); return 0; } - return _tempo_map.framepos_plus_beats (_origin_b, Evoral::MusicalTime(beats)) - _origin_b; + return _tempo_map.framepos_plus_beats (_origin_b, Evoral::Beats(beats)) - _origin_b; } /** As above, but with beats in double instead (for GUI). */ diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index eb2ed769d1..3ed028ef91 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -392,9 +392,9 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status, smfs->append_event_beats( source_lock, - Evoral::Event<Evoral::MusicalTime>( + Evoral::Event<Evoral::Beats>( 0, - Evoral::MusicalTime::ticks_at_rate(t, source->ppqn()), + Evoral::Beats::ticks_at_rate(t, source->ppqn()), size, buf)); @@ -407,9 +407,9 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status, /* we wrote something */ - const framepos_t pos = 0; - const Evoral::MusicalTime length_beats = Evoral::MusicalTime::ticks_at_rate(t, source->ppqn()); - BeatsFramesConverter converter(smfs->session().tempo_map(), pos); + const framepos_t pos = 0; + const Evoral::Beats length_beats = Evoral::Beats::ticks_at_rate(t, source->ppqn()); + BeatsFramesConverter converter(smfs->session().tempo_map(), pos); smfs->update_length(pos + converter.to(length_beats.round_up_to_beat())); smfs->mark_streaming_write_completed (source_lock); diff --git a/libs/ardour/legatize.cc b/libs/ardour/legatize.cc index c5506fe6c0..0c118a6a48 100644 --- a/libs/ardour/legatize.cc +++ b/libs/ardour/legatize.cc @@ -31,7 +31,7 @@ Legatize::~Legatize () Command* Legatize::operator()(boost::shared_ptr<ARDOUR::MidiModel> model, - Evoral::MusicalTime position, + Evoral::Beats position, std::vector<Legatize::Notes>& seqs) { MidiModel::NoteDiffCommand* cmd = new MidiModel::NoteDiffCommand(model, "legatize"); @@ -43,10 +43,10 @@ Legatize::operator()(boost::shared_ptr<ARDOUR::MidiModel> model, break; } - const Evoral::MusicalTime new_end = (*next)->time() - Evoral::MusicalTime::tick(); + const Evoral::Beats new_end = (*next)->time() - Evoral::Beats::tick(); if ((*i)->end_time() > new_end || (!_shrink_only && (*i)->end_time() < new_end)) { - const Evoral::MusicalTime new_length(new_end - (*i)->time()); + const Evoral::Beats new_length(new_end - (*i)->time()); cmd->change((*i), MidiModel::NoteDiffCommand::Length, new_length); } diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index e52a7c3ad7..fed0dbc0ce 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -940,14 +940,14 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen /* set length in beats to entire capture length */ BeatsFramesConverter converter (_session.tempo_map(), capture_info.front()->start); - const Evoral::MusicalTime total_capture_beats = converter.from (total_capture); + const Evoral::Beats total_capture_beats = converter.from (total_capture); _write_source->set_length_beats (total_capture_beats); /* flush to disk: this step differs from the audio path, where all the data is already on disk. */ - _write_source->mark_midi_streaming_write_completed (source_lock, Evoral::Sequence<Evoral::MusicalTime>::ResolveStuckNotes, total_capture_beats); + _write_source->mark_midi_streaming_write_completed (source_lock, Evoral::Sequence<Evoral::Beats>::ResolveStuckNotes, total_capture_beats); /* we will want to be able to keep (over)writing the source but we don't want it to be removable. this also differs diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 18378f5386..e3226e036f 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -620,7 +620,7 @@ MidiModel::NoteDiffCommand::unmarshal_change (XMLNode *xml_change) if ((prop = xml_change->property ("old")) != 0) { istringstream old_str (prop->value()); if (change.property == StartTime || change.property == Length) { - Evoral::MusicalTime old_time; + Evoral::Beats old_time; old_str >> old_time; change.old_value = old_time; } else { @@ -636,7 +636,7 @@ MidiModel::NoteDiffCommand::unmarshal_change (XMLNode *xml_change) if ((prop = xml_change->property ("new")) != 0) { istringstream new_str (prop->value()); if (change.property == StartTime || change.property == Length) { - Evoral::MusicalTime new_time; + Evoral::Beats new_time; new_str >> new_time; change.new_value = Variant(new_time); } else { @@ -1237,7 +1237,7 @@ MidiModel::PatchChangeDiffCommand::unmarshal_patch_change (XMLNode* n) { XMLProperty* prop; Evoral::event_id_t id = 0; - Evoral::MusicalTime time = Evoral::MusicalTime(); + Evoral::Beats time = Evoral::Beats(); int channel = 0; int program = 0; int bank = 0; @@ -1476,8 +1476,8 @@ MidiModel::sync_to_source (const Glib::Threads::Mutex::Lock& source_lock) bool MidiModel::write_section_to (boost::shared_ptr<MidiSource> source, const Glib::Threads::Mutex::Lock& source_lock, - Evoral::MusicalTime begin_time, - Evoral::MusicalTime end_time) + Evoral::Beats begin_time, + Evoral::Beats end_time) { ReadLock lock(read_lock()); MidiStateTracker mst; @@ -1489,12 +1489,12 @@ MidiModel::write_section_to (boost::shared_ptr<MidiSource> source, source->mark_streaming_midi_write_started (source_lock, note_mode()); for (Evoral::Sequence<TimeType>::const_iterator i = begin(TimeType(), true); i != end(); ++i) { - const Evoral::Event<Evoral::MusicalTime>& ev (*i); + const Evoral::Event<Evoral::Beats>& ev (*i); if (ev.time() >= begin_time && ev.time() < end_time) { - const Evoral::MIDIEvent<Evoral::MusicalTime>* mev = - static_cast<const Evoral::MIDIEvent<Evoral::MusicalTime>* > (&ev); + const Evoral::MIDIEvent<Evoral::Beats>* mev = + static_cast<const Evoral::MIDIEvent<Evoral::Beats>* > (&ev); if (!mev) { continue; @@ -2026,7 +2026,7 @@ MidiModel::transpose (TimeType from, TimeType to, int semitones) void MidiModel::control_list_marked_dirty () { - AutomatableSequence<Evoral::MusicalTime>::control_list_marked_dirty (); + AutomatableSequence<Evoral::Beats>::control_list_marked_dirty (); ContentsChanged (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/midi_playlist_source.cc b/libs/ardour/midi_playlist_source.cc index 587bc7b12f..4f474f7119 100644 --- a/libs/ardour/midi_playlist_source.cc +++ b/libs/ardour/midi_playlist_source.cc @@ -149,7 +149,7 @@ MidiPlaylistSource::write_unlocked (const Lock&, } void -MidiPlaylistSource::append_event_beats(const Glib::Threads::Mutex::Lock& /*lock*/, const Evoral::Event<Evoral::MusicalTime>& /*ev*/) +MidiPlaylistSource::append_event_beats(const Glib::Threads::Mutex::Lock& /*lock*/, const Evoral::Event<Evoral::Beats>& /*ev*/) { fatal << string_compose (_("programming error: %1"), "MidiPlaylistSource::append_event_beats() called - should be impossible") << endmsg; abort(); /*NOTREACHED*/ diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 62c642d57b..c02caff470 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -53,9 +53,9 @@ using namespace PBD; namespace ARDOUR { namespace Properties { - PBD::PropertyDescriptor<void*> midi_data; - PBD::PropertyDescriptor<Evoral::MusicalTime> start_beats; - PBD::PropertyDescriptor<Evoral::MusicalTime> length_beats; + PBD::PropertyDescriptor<void*> midi_data; + PBD::PropertyDescriptor<Evoral::Beats> start_beats; + PBD::PropertyDescriptor<Evoral::Beats> length_beats; } } @@ -80,7 +80,7 @@ MidiRegion::register_properties () /* Basic MidiRegion constructor (many channels) */ MidiRegion::MidiRegion (const SourceList& srcs) : Region (srcs) - , _start_beats (Properties::start_beats, Evoral::MusicalTime()) + , _start_beats (Properties::start_beats, Evoral::Beats()) , _length_beats (Properties::length_beats, midi_source(0)->length_beats()) { register_properties (); @@ -94,7 +94,7 @@ MidiRegion::MidiRegion (const SourceList& srcs) MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other) : Region (other) , _start_beats (Properties::start_beats, other->_start_beats) - , _length_beats (Properties::length_beats, Evoral::MusicalTime()) + , _length_beats (Properties::length_beats, Evoral::Beats()) { update_length_beats (); register_properties (); @@ -107,11 +107,11 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other) /** Create a new MidiRegion that is part of an existing one */ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t offset) : Region (other, offset) - , _start_beats (Properties::start_beats, Evoral::MusicalTime()) - , _length_beats (Properties::length_beats, Evoral::MusicalTime()) + , _start_beats (Properties::start_beats, Evoral::Beats()) + , _length_beats (Properties::length_beats, Evoral::Beats()) { BeatsFramesConverter bfc (_session.tempo_map(), _position); - Evoral::MusicalTime const offset_beats = bfc.from (offset); + Evoral::Beats const offset_beats = bfc.from (offset); _start_beats = other->_start_beats.val() + offset_beats; _length_beats = other->_length_beats.val() - offset_beats; @@ -147,8 +147,8 @@ boost::shared_ptr<MidiRegion> MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc) const { BeatsFramesConverter bfc (_session.tempo_map(), _position); - Evoral::MusicalTime const bbegin = bfc.from (_start); - Evoral::MusicalTime const bend = bfc.from (_start + _length); + Evoral::Beats const bbegin = bfc.from (_start); + Evoral::Beats const bend = bfc.from (_start + _length); { /* Lock our source since we'll be reading from it. write_to() will @@ -223,7 +223,7 @@ MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute) /* zero length regions don't exist - so if _length_beats is zero, this object is under construction. */ - if (_length_beats.val() == Evoral::MusicalTime()) { + if (_length_beats.val() == Evoral::Beats()) { /* leave _length_beats alone, and change _length to reflect the state of things at the new position (tempo map may dictate a different number of frames */ @@ -462,7 +462,7 @@ MidiRegion::fix_negative_start () model()->insert_silence_at_start (c.from (-_start)); _start = 0; - _start_beats = Evoral::MusicalTime(); + _start_beats = Evoral::Beats(); } /** Transpose the notes in this region by a given number of semitones */ diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 0c08adf4a5..8d3b130594 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -200,7 +200,7 @@ MidiSource::midi_read (const Lock& lm, if (_model) { // Find appropriate model iterator - Evoral::Sequence<Evoral::MusicalTime>::const_iterator& i = _model_iter; + Evoral::Sequence<Evoral::Beats>::const_iterator& i = _model_iter; if (_last_read_end == 0 || start != _last_read_end || !_model_iter_valid) { // Cached iterator is invalid, search for the first event past start i = _model->begin(converter.from(start), false, filtered); @@ -297,9 +297,9 @@ MidiSource::mark_streaming_write_started (const Lock& lock) } void -MidiSource::mark_midi_streaming_write_completed (const Lock& lock, - Evoral::Sequence<Evoral::MusicalTime>::StuckNoteOption option, - Evoral::MusicalTime end) +MidiSource::mark_midi_streaming_write_completed (const Lock& lock, + Evoral::Sequence<Evoral::Beats>::StuckNoteOption option, + Evoral::Beats end) { if (_model) { _model->end_write (option, end); @@ -320,11 +320,11 @@ MidiSource::mark_midi_streaming_write_completed (const Lock& void MidiSource::mark_streaming_write_completed (const Lock& lock) { - mark_midi_streaming_write_completed (lock, Evoral::Sequence<Evoral::MusicalTime>::DeleteStuckNotes); + mark_midi_streaming_write_completed (lock, Evoral::Sequence<Evoral::Beats>::DeleteStuckNotes); } int -MidiSource::write_to (const Lock& lock, boost::shared_ptr<MidiSource> newsrc, Evoral::MusicalTime begin, Evoral::MusicalTime end) +MidiSource::write_to (const Lock& lock, boost::shared_ptr<MidiSource> newsrc, Evoral::Beats begin, Evoral::Beats end) { Lock newsrc_lock (newsrc->mutex ()); @@ -333,7 +333,7 @@ MidiSource::write_to (const Lock& lock, boost::shared_ptr<MidiSource> newsrc, Ev newsrc->copy_automation_state_from (this); if (_model) { - if (begin == Evoral::MinMusicalTime && end == Evoral::MaxMusicalTime) { + if (begin == Evoral::MinBeats && end == Evoral::MaxBeats) { _model->write_to (newsrc, newsrc_lock); } else { _model->write_section_to (newsrc, newsrc_lock, begin, end); @@ -347,7 +347,7 @@ MidiSource::write_to (const Lock& lock, boost::shared_ptr<MidiSource> newsrc, Ev /* force a reload of the model if the range is partial */ - if (begin != Evoral::MinMusicalTime || end != Evoral::MaxMusicalTime) { + if (begin != Evoral::MinBeats || end != Evoral::MaxBeats) { newsrc->load_model (newsrc_lock, true); } else { newsrc->set_model (newsrc_lock, _model); diff --git a/libs/ardour/midi_state_tracker.cc b/libs/ardour/midi_state_tracker.cc index f919a02f35..9e96c4954f 100644 --- a/libs/ardour/midi_state_tracker.cc +++ b/libs/ardour/midi_state_tracker.cc @@ -168,7 +168,7 @@ MidiStateTracker::resolve_notes (Evoral::EventSink<framepos_t> &dst, framepos_t } void -MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, Evoral::MusicalTime time) +MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, Evoral::Beats time) { DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 MS-resolve notes @ %2 on = %3\n", this, time, _on)); @@ -181,7 +181,7 @@ MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, for (int channel = 0; channel < 16; ++channel) { for (int note = 0; note < 128; ++note) { while (_active_notes[note + 128 * channel]) { - Evoral::MIDIEvent<Evoral::MusicalTime> ev ((MIDI_CMD_NOTE_OFF|channel), time, 3, 0, true); + Evoral::MIDIEvent<Evoral::Beats> ev ((MIDI_CMD_NOTE_OFF|channel), time, 3, 0, true); ev.set_type (MIDI_CMD_NOTE_OFF); ev.set_channel (channel); ev.set_note (note); @@ -191,7 +191,7 @@ MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, this, (int) note, (int) channel, time)); _active_notes[note + 128 * channel]--; /* don't stack events up at the same time */ - time += Evoral::MusicalTime::tick(); + time += Evoral::Beats::tick(); } } } diff --git a/libs/ardour/midi_stretch.cc b/libs/ardour/midi_stretch.cc index 05635600d7..71ffcc21e1 100644 --- a/libs/ardour/midi_stretch.cc +++ b/libs/ardour/midi_stretch.cc @@ -108,7 +108,7 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*) new_model->append(ev, Evoral::next_event_id()); } - new_model->end_write (Evoral::Sequence<Evoral::MusicalTime>::DeleteStuckNotes); + new_model->end_write (Evoral::Sequence<Evoral::Beats>::DeleteStuckNotes); new_model->set_edited (true); new_src->copy_interpolation_from (src); diff --git a/libs/ardour/quantize.cc b/libs/ardour/quantize.cc index dc1976e9ff..6604469007 100644 --- a/libs/ardour/quantize.cc +++ b/libs/ardour/quantize.cc @@ -54,8 +54,8 @@ Quantize::~Quantize () Command* Quantize::operator () (boost::shared_ptr<MidiModel> model, - Evoral::MusicalTime position, - std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>& seqs) + Evoral::Beats position, + std::vector<Evoral::Sequence<Evoral::Beats>::Notes>& seqs) { /* TODO: Rewrite this to be precise with fixed point? */ @@ -69,7 +69,7 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, bool even; MidiModel::NoteDiffCommand* cmd = new MidiModel::NoteDiffCommand (model, "quantize"); - for (std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>::iterator s = seqs.begin(); s != seqs.end(); ++s) { + for (std::vector<Evoral::Sequence<Evoral::Beats>::Notes>::iterator s = seqs.begin(); s != seqs.end(); ++s) { even = false; @@ -119,10 +119,10 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, delta = new_end - (*i)->end_time().to_double(); if (fabs (delta) >= _threshold) { - Evoral::MusicalTime new_dur(new_end - new_start); + Evoral::Beats new_dur(new_end - new_start); if (!new_dur) { - new_dur = Evoral::MusicalTime(_end_grid); + new_dur = Evoral::Beats(_end_grid); } cmd->change ((*i), MidiModel::NoteDiffCommand::Length, new_dur); diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index d1a82eb685..7f5e8059c9 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -278,7 +278,7 @@ SMFSource::read_unlocked (const Lock& lock, /* Note that we add on the source start time (in session frames) here so that ev_frame_time is in session frames. */ - const framepos_t ev_frame_time = converter.to(Evoral::MusicalTime::ticks_at_rate(time, ppqn())) + source_start; + const framepos_t ev_frame_time = converter.to(Evoral::Beats::ticks_at_rate(time, ppqn())) + source_start; if (ev_frame_time < start + duration) { destination.write (ev_frame_time, ev_type, ev_size, ev_buffer); @@ -380,8 +380,8 @@ SMFSource::write_unlocked (const Lock& lock, /** Append an event with a timestamp in beats */ void -SMFSource::append_event_beats (const Glib::Threads::Mutex::Lock& lock, - const Evoral::Event<Evoral::MusicalTime>& ev) +SMFSource::append_event_beats (const Glib::Threads::Mutex::Lock& lock, + const Evoral::Event<Evoral::Beats>& ev) { if (!_writing || ev.size() == 0) { return; @@ -391,9 +391,9 @@ SMFSource::append_event_beats (const Glib::Threads::Mutex::Lock& lock, name().c_str(), ev.id(), ev.time(), ev.size()); for (size_t i = 0; i < ev.size(); ++i) printf("%X ", ev.buffer()[i]); printf("\n");*/ - Evoral::MusicalTime time = ev.time(); + Evoral::Beats time = ev.time(); if (time < _last_ev_time_beats) { - const Evoral::MusicalTime difference = _last_ev_time_beats - time; + const Evoral::Beats difference = _last_ev_time_beats - time; if (difference.to_double() / (double)ppqn() < 1.0) { /* Close enough. This problem occurs because Sequence is not actually ordered due to fuzzy time comparison. I'm pretty sure @@ -423,8 +423,8 @@ SMFSource::append_event_beats (const Glib::Threads::Mutex::Lock& lock, _length_beats = max(_length_beats, time); - const Evoral::MusicalTime delta_time_beats = time - _last_ev_time_beats; - const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn()); + const Evoral::Beats delta_time_beats = time - _last_ev_time_beats; + const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn()); Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id); _last_ev_time_beats = time; @@ -452,9 +452,9 @@ SMFSource::append_event_frames (const Glib::Threads::Mutex::Lock& lock, return; } - BeatsFramesConverter converter(_session.tempo_map(), position); - const Evoral::MusicalTime ev_time_beats = converter.from(ev.time()); - Evoral::event_id_t event_id; + BeatsFramesConverter converter(_session.tempo_map(), position); + const Evoral::Beats ev_time_beats = converter.from(ev.time()); + Evoral::event_id_t event_id; if (ev.id() < 0) { event_id = Evoral::next_event_id(); @@ -463,18 +463,18 @@ SMFSource::append_event_frames (const Glib::Threads::Mutex::Lock& lock, } if (_model) { - const Evoral::Event<Evoral::MusicalTime> beat_ev (ev.event_type(), - ev_time_beats, - ev.size(), - const_cast<uint8_t*>(ev.buffer())); + const Evoral::Event<Evoral::Beats> beat_ev (ev.event_type(), + ev_time_beats, + ev.size(), + const_cast<uint8_t*>(ev.buffer())); _model->append (beat_ev, event_id); } _length_beats = max(_length_beats, ev_time_beats); - const Evoral::MusicalTime last_time_beats = converter.from (_last_ev_time_frames); - const Evoral::MusicalTime delta_time_beats = ev_time_beats - last_time_beats; - const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn()); + const Evoral::Beats last_time_beats = converter.from (_last_ev_time_frames); + const Evoral::Beats delta_time_beats = ev_time_beats - last_time_beats; + const uint32_t delta_time_ticks = delta_time_beats.to_ticks(ppqn()); Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id); _last_ev_time_frames = ev.time(); @@ -518,18 +518,18 @@ SMFSource::mark_streaming_midi_write_started (const Lock& lock, NoteMode mode) MidiSource::mark_streaming_midi_write_started (lock, mode); Evoral::SMF::begin_write (); - _last_ev_time_beats = Evoral::MusicalTime(); + _last_ev_time_beats = Evoral::Beats(); _last_ev_time_frames = 0; } void SMFSource::mark_streaming_write_completed (const Lock& lock) { - mark_midi_streaming_write_completed (lock, Evoral::Sequence<Evoral::MusicalTime>::DeleteStuckNotes); + mark_midi_streaming_write_completed (lock, Evoral::Sequence<Evoral::Beats>::DeleteStuckNotes); } void -SMFSource::mark_midi_streaming_write_completed (const Lock& lm, Evoral::Sequence<Evoral::MusicalTime>::StuckNoteOption stuck_notes_option, Evoral::MusicalTime when) +SMFSource::mark_midi_streaming_write_completed (const Lock& lm, Evoral::Sequence<Evoral::Beats>::StuckNoteOption stuck_notes_option, Evoral::Beats when) { MidiSource::mark_midi_streaming_write_completed (lm, stuck_notes_option, when); @@ -587,8 +587,8 @@ SMFSource::safe_midi_file_extension (const string& file) } static bool compare_eventlist ( - const std::pair< Evoral::Event<Evoral::MusicalTime>*, gint >& a, - const std::pair< Evoral::Event<Evoral::MusicalTime>*, gint >& b) { + const std::pair< Evoral::Event<Evoral::Beats>*, gint >& a, + const std::pair< Evoral::Event<Evoral::Beats>*, gint >& b) { return ( a.first->time() < b.first->time() ); } @@ -619,7 +619,7 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload Evoral::SMF::seek_to_start(); uint64_t time = 0; /* in SMF ticks */ - Evoral::Event<Evoral::MusicalTime> ev; + Evoral::Event<Evoral::Beats> ev; uint32_t scratch_size = 0; // keep track of scratch and minimize reallocs @@ -631,7 +631,7 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload bool have_event_id; // TODO simplify event allocation - std::list< std::pair< Evoral::Event<Evoral::MusicalTime>*, gint > > eventlist; + std::list< std::pair< Evoral::Event<Evoral::Beats>*, gint > > eventlist; for (unsigned i = 1; i <= num_tracks(); ++i) { if (seek_to_track(i)) continue; @@ -658,7 +658,7 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload event_id = Evoral::next_event_id(); } const uint32_t event_type = midi_parameter_type(buf[0]); - const Evoral::MusicalTime event_time = Evoral::MusicalTime::ticks_at_rate(time, ppqn()); + const Evoral::Beats event_time = Evoral::Beats::ticks_at_rate(time, ppqn()); #ifndef NDEBUG std::string ss; @@ -673,7 +673,7 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload #endif eventlist.push_back(make_pair ( - new Evoral::Event<Evoral::MusicalTime> ( + new Evoral::Event<Evoral::Beats> ( event_type, event_time, size, buf, true) , event_id)); @@ -692,13 +692,13 @@ SMFSource::load_model (const Glib::Threads::Mutex::Lock& lock, bool force_reload eventlist.sort(compare_eventlist); - std::list< std::pair< Evoral::Event<Evoral::MusicalTime>*, gint > >::iterator it; + std::list< std::pair< Evoral::Event<Evoral::Beats>*, gint > >::iterator it; for (it=eventlist.begin(); it!=eventlist.end(); ++it) { _model->append (*it->first, it->second); delete it->first; } - _model->end_write (Evoral::Sequence<Evoral::MusicalTime>::ResolveStuckNotes, _length_beats); + _model->end_write (Evoral::Sequence<Evoral::Beats>::ResolveStuckNotes, _length_beats); _model->set_edited (false); invalidate(lock); diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 486cbb0643..dfcc264547 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1841,7 +1841,7 @@ TempoMap::insert_time (framepos_t where, framecnt_t amount) * pos can be -ve, if required. */ framepos_t -TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const +TempoMap::framepos_plus_beats (framepos_t pos, Evoral::Beats beats) const { Glib::Threads::RWLock::ReaderLock lm (lock); Metrics::const_iterator next_tempo; @@ -1891,11 +1891,11 @@ TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const framecnt_t distance_frames = (next_tempo == metrics.end() ? max_framepos : ((*next_tempo)->frame() - pos)); /* Distance to the end in beats */ - Evoral::MusicalTime distance_beats = Evoral::MusicalTime::ticks_at_rate( + Evoral::Beats distance_beats = Evoral::Beats::ticks_at_rate( distance_frames, tempo->frames_per_beat (_frame_rate)); /* Amount to subtract this time */ - Evoral::MusicalTime const delta = min (distance_beats, beats); + Evoral::Beats const delta = min (distance_beats, beats); DEBUG_TRACE (DEBUG::TempoMath, string_compose ("\tdistance to %1 = %2 (%3 beats)\n", (next_tempo == metrics.end() ? max_framepos : (*next_tempo)->frame()), @@ -1933,7 +1933,7 @@ TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const /** Subtract some (fractional) beats from a frame position, and return the result in frames */ framepos_t -TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const +TempoMap::framepos_minus_beats (framepos_t pos, Evoral::Beats beats) const { Glib::Threads::RWLock::ReaderLock lm (lock); Metrics::const_reverse_iterator prev_tempo; @@ -2000,11 +2000,11 @@ TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const framecnt_t distance_frames = (pos - tempo->frame()); /* Distance to the start in beats */ - Evoral::MusicalTime distance_beats = Evoral::MusicalTime::ticks_at_rate( + Evoral::Beats distance_beats = Evoral::Beats::ticks_at_rate( distance_frames, tempo->frames_per_beat (_frame_rate)); /* Amount to subtract this time */ - Evoral::MusicalTime const sub = min (distance_beats, beats); + Evoral::Beats const sub = min (distance_beats, beats); DEBUG_TRACE (DEBUG::TempoMath, string_compose ("\tdistance to %1 = %2 (%3 beats)\n", tempo->frame(), distance_frames, distance_beats)); @@ -2037,7 +2037,7 @@ TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const } } else { pos -= llrint (beats.to_double() * tempo->frames_per_beat (_frame_rate)); - beats = Evoral::MusicalTime(); + beats = Evoral::Beats(); } } @@ -2183,7 +2183,7 @@ TempoMap::framepos_plus_bbt (framepos_t pos, BBT_Time op) const /** Count the number of beats that are equivalent to distance when going forward, starting at pos. */ -Evoral::MusicalTime +Evoral::Beats TempoMap::framewalk_to_beats (framepos_t pos, framecnt_t distance) const { Glib::Threads::RWLock::ReaderLock lm (lock); @@ -2218,7 +2218,7 @@ TempoMap::framewalk_to_beats (framepos_t pos, framecnt_t distance) const string_compose ("frame %1 walk by %2 frames, start with tempo = %3 @ %4\n", pos, distance, *((const Tempo*)tempo), tempo->frame())); - Evoral::MusicalTime beats = Evoral::MusicalTime(); + Evoral::Beats beats = Evoral::Beats(); while (distance) { @@ -2246,7 +2246,7 @@ TempoMap::framewalk_to_beats (framepos_t pos, framecnt_t distance) const pos += sub; distance -= sub; assert (tempo); - beats += Evoral::MusicalTime::ticks_at_rate(sub, tempo->frames_per_beat (_frame_rate)); + beats += Evoral::Beats::ticks_at_rate(sub, tempo->frames_per_beat (_frame_rate)); DEBUG_TRACE (DEBUG::TempoMath, string_compose ("now at %1, beats = %2 distance left %3\n", pos, beats, distance)); diff --git a/libs/ardour/test/framepos_minus_beats_test.cc b/libs/ardour/test/framepos_minus_beats_test.cc index e4c4844146..cc6341fb0b 100644 --- a/libs/ardour/test/framepos_minus_beats_test.cc +++ b/libs/ardour/test/framepos_minus_beats_test.cc @@ -26,11 +26,11 @@ FrameposMinusBeatsTest::singleTempoTest () map.add_tempo (tempo, BBT_Time (1, 1, 0)); /* Subtract 1 beat from beat 3 of the first bar */ - framepos_t r = map.framepos_minus_beats (frames_per_beat * 2, MusicalTime(1)); + framepos_t r = map.framepos_minus_beats (frames_per_beat * 2, Beats(1)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (frames_per_beat * 1)); /* Subtract 4 beats from 3 beats in, to go beyond zero */ - r = map.framepos_minus_beats (frames_per_beat * 3, MusicalTime(4)); + r = map.framepos_minus_beats (frames_per_beat * 3, Beats(4)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (- frames_per_beat)); } @@ -70,15 +70,15 @@ FrameposMinusBeatsTest::doubleTempoTest () /* Now some tests */ /* Subtract 1 beat from 1|2 */ - framepos_t r = map.framepos_minus_beats (24e3, MusicalTime(1)); + framepos_t r = map.framepos_minus_beats (24e3, Beats(1)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (0)); /* Subtract 2 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, MusicalTime(2)); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3)); /* Subtract 2.5 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, MusicalTime(2.5)); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2.5)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3)); } @@ -124,15 +124,15 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () /* Now some tests */ /* Subtract 1 beat from 1|2 */ - framepos_t r = map.framepos_minus_beats (24e3, MusicalTime(1)); + framepos_t r = map.framepos_minus_beats (24e3, Beats(1)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (0)); /* Subtract 2 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, MusicalTime(2)); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3)); /* Subtract 2.5 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, MusicalTime(2.5)); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2.5)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3)); } diff --git a/libs/ardour/test/framepos_plus_beats_test.cc b/libs/ardour/test/framepos_plus_beats_test.cc index abe1310f62..efc57c5872 100644 --- a/libs/ardour/test/framepos_plus_beats_test.cc +++ b/libs/ardour/test/framepos_plus_beats_test.cc @@ -25,11 +25,11 @@ FrameposPlusBeatsTest::singleTempoTest () map.add_tempo (tempo, BBT_Time (1, 1, 0)); /* Add 1 beat to beat 3 of the first bar */ - framepos_t r = map.framepos_plus_beats (frames_per_beat * 2, Evoral::MusicalTime(1)); + framepos_t r = map.framepos_plus_beats (frames_per_beat * 2, Evoral::Beats(1)); CPPUNIT_ASSERT_EQUAL (framepos_t (frames_per_beat * 3), r); /* Add 4 beats to a -ve frame of 1 beat before zero */ - r = map.framepos_plus_beats (-frames_per_beat * 1, Evoral::MusicalTime(4)); + r = map.framepos_plus_beats (-frames_per_beat * 1, Evoral::Beats(4)); CPPUNIT_ASSERT_EQUAL (framepos_t (frames_per_beat * 3), r); } @@ -69,15 +69,15 @@ FrameposPlusBeatsTest::doubleTempoTest () /* Now some tests */ /* Add 1 beat to 1|2 */ - framepos_t r = map.framepos_plus_beats (24e3, Evoral::MusicalTime(1)); + framepos_t r = map.framepos_plus_beats (24e3, Evoral::Beats(1)); CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r); /* Add 2 beats to 3|4 (over the tempo change) */ - r = map.framepos_plus_beats (264e3, Evoral::MusicalTime(2)); + r = map.framepos_plus_beats (264e3, Evoral::Beats(2)); CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); /* Add 2.5 beats to 3|3|960 (over the tempo change) */ - r = map.framepos_plus_beats (264e3 - 12e3, Evoral::MusicalTime(2.5)); + r = map.framepos_plus_beats (264e3 - 12e3, Evoral::Beats(2.5)); CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); } @@ -123,15 +123,15 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () /* Now some tests */ /* Add 1 beat to 1|2 */ - framepos_t r = map.framepos_plus_beats (24e3, Evoral::MusicalTime(1)); + framepos_t r = map.framepos_plus_beats (24e3, Evoral::Beats(1)); CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r); /* Add 2 beats to 3|4 (over the tempo change) */ - r = map.framepos_plus_beats (264e3, Evoral::MusicalTime(2)); + r = map.framepos_plus_beats (264e3, Evoral::Beats(2)); CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); /* Add 2.5 beats to 3|3|960 (over the tempo change) */ - r = map.framepos_plus_beats (264e3 - 12e3, Evoral::MusicalTime(2.5)); + r = map.framepos_plus_beats (264e3 - 12e3, Evoral::Beats(2.5)); CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); } diff --git a/libs/ardour/transform.cc b/libs/ardour/transform.cc index 3b4f53c860..9f029829de 100644 --- a/libs/ardour/transform.cc +++ b/libs/ardour/transform.cc @@ -121,7 +121,7 @@ Transform::Operation::eval(Context& ctx) const Command* Transform::operator()(boost::shared_ptr<MidiModel> model, - Evoral::MusicalTime position, + Evoral::Beats position, std::vector<Notes>& seqs) { typedef MidiModel::NoteDiffCommand Command; |