From e3c67bceb864adc10764e901b87ad8b6677caebd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 14 Dec 2010 20:03:40 +0000 Subject: implement methods in TempoMap for walking a given distance along a tempo map and returning the resulting time; add a new property, _length_beats, to MidiRegion; use previously mentioned methods to keep _length_beats up to date as regions are moved AND as tempo map changes occur git-svn-id: svn://localhost/ardour2/branches/3.0@8274 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/midi_region.h | 5 +++++ libs/ardour/ardour/region.h | 1 + libs/ardour/ardour/tempo.h | 7 ++++--- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index dae984c331..53ffb4497c 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -117,6 +117,7 @@ class MidiRegion : public Region private: friend class RegionFactory; + PBD::Property _length_beats; MidiRegion (const SourceList&); MidiRegion (boost::shared_ptr, frameoffset_t offset = 0, bool offset_relative = true); @@ -134,6 +135,8 @@ class MidiRegion : public Region void recompute_at_end (); void set_position_internal (framepos_t pos, bool allow_bbt_recompute); + void set_length_internal (framecnt_t len); + void update_length_beats (); void model_changed (); void model_automation_state_changed (Evoral::Parameter const &); @@ -143,6 +146,8 @@ class MidiRegion : public Region PBD::ScopedConnection _model_connection; PBD::ScopedConnection _source_connection; PBD::ScopedConnection _model_contents_connection; + + double _last_length_beats; }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 8a3cb1d9f5..e1bba21b52 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -325,6 +325,7 @@ class Region void trim_to_internal (framepos_t position, framecnt_t length, void *src); virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute); + virtual void set_length_internal (framepos_t pos); void modify_front (framepos_t new_position, bool reset_fade, void* src); void modify_end (framepos_t new_position, bool reset_fade, void* src); diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index de45c788f1..90d27ebed0 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -204,15 +204,13 @@ class TempoMap : public PBD::StatefulDestructible framecnt_t frame_time (const Timecode::BBT_Time&) const; framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time&, int dir) const; - void bbt_time_add (framepos_t origin, Timecode::BBT_Time& start, const Timecode::BBT_Time& shift); - static const Tempo& default_tempo() { return _default_tempo; } static const Meter& default_meter() { return _default_meter; } const Tempo& tempo_at (framepos_t) const; const Meter& meter_at (framepos_t) const; - const TempoSection& tempo_section_at (framepos_t); + const TempoSection& tempo_section_at (framepos_t) const; void add_tempo(const Tempo&, Timecode::BBT_Time where); void add_meter(const Meter&, Timecode::BBT_Time where); @@ -250,6 +248,9 @@ class TempoMap : public PBD::StatefulDestructible Timecode::BBT_Time bbt_add (const Timecode::BBT_Time& a, const Timecode::BBT_Time& b) const; Timecode::BBT_Time bbt_subtract (const Timecode::BBT_Time&, const Timecode::BBT_Time&) const; + framepos_t framepos_plus_bbt (framepos_t pos, Timecode::BBT_Time b) const; + double framewalk_to_beats (framepos_t pos, framecnt_t distance) const; + void change_existing_tempo_at (framepos_t, double bpm, double note_type); void change_initial_tempo (double bpm, double note_type); -- cgit v1.2.3