#include <glibmm/threads.h>
#include "pbd/undo.h"
+
#include "pbd/stateful.h"
#include "pbd/statefuldestructible.h"
Tempo (double bpm, double type=4.0) // defaulting to quarter note
: _beats_per_minute (bpm), _note_type(type) {}
- double beats_per_minute () const { return _beats_per_minute;}
+ double beats_per_minute () const { return _beats_per_minute; }
+
double ticks_per_minute () const { return _beats_per_minute * Timecode::BBT_Time::ticks_per_beat;}
double note_type () const { return _note_type;}
/** audio samples per beat
class LIBARDOUR_API MetricSection {
public:
MetricSection (const Timecode::BBT_Time& start)
- : _start (start), _frame (0), _movable (true) {}
+ : _start (start), _frame (0), _movable (true), _position_lock_style (MusicTime) {}
MetricSection (framepos_t start)
- : _frame (start), _movable (true) {}
+ : _frame (start), _movable (true), _position_lock_style (MusicTime) {}
virtual ~MetricSection() {}
XML state information.
*/
virtual XMLNode& get_state() const = 0;
+ PositionLockStyle position_lock_style () const { return _position_lock_style; }
+ void set_position_lock_style (PositionLockStyle ps) { _position_lock_style = ps; }
+
+private:
- private:
Timecode::BBT_Time _start;
framepos_t _frame;
bool _movable;
+ PositionLockStyle _position_lock_style;
};
/** A section of timeline with a certain Meter. */
/** A section of timeline with a certain Tempo. */
class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
public:
- enum TempoSectionType {
+ enum Type {
Ramp,
Constant,
};
- TempoSection (const Timecode::BBT_Time& start, double qpm, double note_type, TempoSectionType tempo_type)
+ TempoSection (const Timecode::BBT_Time& start, double qpm, double note_type, Type tempo_type)
: MetricSection (start), Tempo (qpm, note_type), _bar_offset (-1.0), _type (tempo_type) {}
- TempoSection (framepos_t start, double qpm, double note_type, TempoSectionType tempo_type)
+ TempoSection (framepos_t start, double qpm, double note_type, Type tempo_type)
: MetricSection (start), Tempo (qpm, note_type), _bar_offset (-1.0), _type (tempo_type) {}
TempoSection (const XMLNode&);
void update_bbt_time_from_bar_offset (const Meter&);
double bar_offset() const { return _bar_offset; }
- void set_type (TempoSectionType type);
- TempoSectionType type () const { return _type; }
+ void set_type (Type type);
+ Type type () const { return _type; }
double tempo_at_frame (framepos_t frame, double end_bpm, framepos_t end_frame, framecnt_t frame_rate) const;
framepos_t frame_at_tempo (double tempo, double end_bpm, framepos_t end_frame, framecnt_t frame_rate) const;
position within the bar if/when the meter changes.
*/
double _bar_offset;
- TempoSectionType _type;
+ Type _type;
};
typedef std::list<MetricSection*> Metrics;
TempoSection* tempo_section_after (framepos_t) const;
const MeterSection& meter_section_at (framepos_t) const;
- void add_tempo (const Tempo&, Timecode::BBT_Time where, TempoSection::TempoSectionType type);
+ void add_tempo (const Tempo&, Timecode::BBT_Time where, TempoSection::Type type);
void add_meter (const Meter&, Timecode::BBT_Time where);
void remove_tempo (const TempoSection&, bool send_signal);
void remove_meter (const MeterSection&, bool send_signal);
- void replace_tempo (const TempoSection&, const Tempo&, const Timecode::BBT_Time& where, TempoSection::TempoSectionType type);
+ void replace_tempo (const TempoSection&, const Tempo&, const Timecode::BBT_Time& where, TempoSection::Type type);
+ void gui_set_tempo_frame (TempoSection&, framepos_t where);
void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where);
framepos_t round_to_bar (framepos_t frame, RoundMode dir);
framecnt_t frame_rate () const { return _frame_rate; }
- private:
+ PBD::Signal0<void> MetricPositionChanged;
+
+private:
friend class ::BBTTest;
friend class ::FrameposPlusBeatsTest;
void do_insert (MetricSection* section);
- void add_tempo_locked (const Tempo&, Timecode::BBT_Time where, bool recompute, TempoSection::TempoSectionType type);
+ void add_tempo_locked (const Tempo&, Timecode::BBT_Time where, bool recompute, TempoSection::Type type);
void add_meter_locked (const Meter&, Timecode::BBT_Time where, bool recompute);
bool remove_tempo_locked (const TempoSection&);