Tempo ramps - remove the concept of bars from tempo sections.
- this helps where tempo and meter have a somewhat circular dependency. MetricSection now has a musical position expressed in beats (a double). MeterSection still has a bbt, but it really isn't needed as we have enough information to discover the number of bars at a given beat without it. TempoSection now has a hack to enable loading of legacy sessions, which will ultimately be a lot cleaner than the current code. Removing bars from tempo sections also allows us to place them at arbitrary frames (implemented here).
This commit is contained in:
parent
41c8b534b7
commit
5c6e18e6a0
@ -3210,7 +3210,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
if (_copy == true) {
|
||||
_editor->begin_reversible_command (_("copy meter mark"));
|
||||
XMLNode &before = map.get_state();
|
||||
map.add_meter (_marker->meter(), when);
|
||||
map.add_meter (_marker->meter(), map.beat_at_frame (_marker->position()), when);
|
||||
XMLNode &after = map.get_state();
|
||||
_editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
|
||||
_editor->commit_reversible_command ();
|
||||
@ -3220,7 +3220,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
|
||||
/* we removed it before, so add it back now */
|
||||
|
||||
map.add_meter (_marker->meter(), when);
|
||||
map.add_meter (_marker->meter(), map.beat_at_frame (_marker->position()), when);
|
||||
XMLNode &after = map.get_state();
|
||||
_editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
|
||||
_editor->commit_reversible_command ();
|
||||
@ -3239,7 +3239,7 @@ MeterMarkerDrag::aborted (bool moved)
|
||||
if (moved) {
|
||||
TempoMap& map (_editor->session()->tempo_map());
|
||||
/* we removed it before, so add it back now */
|
||||
map.add_meter (_marker->meter(), _marker->meter().frame());
|
||||
map.add_meter (_marker->meter(), map.beat_at_frame (_marker->meter().frame()), _marker->meter().bbt());
|
||||
// delete the dummy marker we used for visual representation while moving.
|
||||
// a new visual marker will show up automatically.
|
||||
delete _marker;
|
||||
@ -3309,15 +3309,15 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
|
||||
TempoMap& map (_editor->session()->tempo_map());
|
||||
/* get current state */
|
||||
before_state = &map.get_state();
|
||||
/* remove the section while we drag it */
|
||||
//map.remove_tempo (section, true);
|
||||
}
|
||||
_marker->hide();
|
||||
}
|
||||
|
||||
framepos_t const pf = adjusted_current_frame (event, false);
|
||||
TempoMap& map (_editor->session()->tempo_map());
|
||||
_marker->set_position (pf);
|
||||
map.gui_set_tempo_frame (*_real_section, pf);
|
||||
double const baf = _editor->session()->tempo_map().beat_at_frame (pf);
|
||||
|
||||
_marker->set_position (adjusted_current_frame (event, false));
|
||||
_editor->session()->tempo_map().gui_set_tempo_frame (*_real_section, pf, baf);
|
||||
|
||||
show_verbose_cursor_time (pf);
|
||||
}
|
||||
@ -3339,22 +3339,18 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
motion (event, false);
|
||||
|
||||
TempoMap& map (_editor->session()->tempo_map());
|
||||
framepos_t beat_time = map.round_to_beat (_marker->position(), RoundNearest);
|
||||
Timecode::BBT_Time when;
|
||||
|
||||
map.bbt_time (beat_time, when);
|
||||
|
||||
if (_copy == true) {
|
||||
_editor->begin_reversible_command (_("copy tempo mark"));
|
||||
XMLNode &before = map.get_state();
|
||||
map.add_tempo (_marker->tempo(), when, _marker->tempo().type());
|
||||
map.add_tempo (_marker->tempo(), map.beat_at_frame (_marker->position()), _marker->tempo().type());
|
||||
XMLNode &after = map.get_state();
|
||||
_editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
|
||||
_editor->commit_reversible_command ();
|
||||
|
||||
} else {
|
||||
/* we removed it before, so add it back now */
|
||||
map.replace_tempo (*_real_section, _marker->tempo().beats_per_minute() , when, _marker->tempo().type());
|
||||
map.replace_tempo (*_real_section, _marker->tempo().beats_per_minute() , map.beat_at_frame (_marker->position()), _marker->tempo().type());
|
||||
XMLNode &after = map.get_state();
|
||||
_editor->session()->add_command (new MementoCommand<TempoMap>(map, before_state, &after));
|
||||
_editor->commit_reversible_command ();
|
||||
|
@ -6552,9 +6552,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end)
|
||||
} else if (t.frame() == start) {
|
||||
_session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
|
||||
} else {
|
||||
Timecode::BBT_Time bbt;
|
||||
_session->tempo_map().bbt_time (start, bbt);
|
||||
_session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), bbt, TempoSection::Type::Constant);
|
||||
_session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), _session->tempo_map().beat_at_frame (start), TempoSection::Type::Constant);
|
||||
}
|
||||
|
||||
XMLNode& after (_session->tempo_map().get_state());
|
||||
|
@ -143,13 +143,11 @@ Editor::marker_position_changed ()
|
||||
for (Marks::iterator x = metric_marks.begin(); x != metric_marks.end(); ++x) {
|
||||
if ((tempo_marker = dynamic_cast<TempoMarker*> (*x)) != 0) {
|
||||
if ((ts = &tempo_marker->tempo()) != 0) {
|
||||
cerr << "tempo section found for tempo marker " << endl;
|
||||
tempo_marker->set_position (ts->frame ());
|
||||
}
|
||||
}
|
||||
if ((meter_marker = dynamic_cast<MeterMarker*> (*x)) != 0) {
|
||||
if ((ms = &meter_marker->meter()) != 0) {
|
||||
cerr << "meter section found for meter marker " << endl;
|
||||
meter_marker->set_position (ms->frame ());
|
||||
}
|
||||
}
|
||||
@ -249,7 +247,7 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
|
||||
|
||||
begin_reversible_command (_("add tempo mark"));
|
||||
XMLNode &before = map.get_state();
|
||||
map.add_tempo (Tempo (bpm,nt), requested, tempo_dialog.get_tempo_type());
|
||||
map.add_tempo (Tempo (bpm,nt), map.bbt_to_beats (requested), tempo_dialog.get_tempo_type());
|
||||
XMLNode &after = map.get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
|
||||
commit_reversible_command ();
|
||||
@ -288,7 +286,7 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
|
||||
|
||||
begin_reversible_command (_("add meter mark"));
|
||||
XMLNode &before = map.get_state();
|
||||
map.add_meter (Meter (bpb, note_type), requested);
|
||||
map.add_meter (Meter (bpb, note_type), map.bbt_to_beats (requested), requested);
|
||||
_session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
|
||||
commit_reversible_command ();
|
||||
|
||||
@ -338,7 +336,7 @@ Editor::edit_meter_section (MeterSection* section)
|
||||
|
||||
begin_reversible_command (_("replace tempo mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
_session->tempo_map().replace_meter (*section, Meter (bpb, note_type), when);
|
||||
_session->tempo_map().replace_meter (*section, Meter (bpb, note_type), _session->tempo_map().bbt_to_beats (when), when);
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
@ -364,7 +362,7 @@ Editor::edit_tempo_section (TempoSection* section)
|
||||
|
||||
begin_reversible_command (_("replace tempo mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), when, tempo_dialog.get_tempo_type());
|
||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), _session->tempo_map().bbt_to_beats (when), tempo_dialog.get_tempo_type());
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
|
@ -99,26 +99,24 @@ class LIBARDOUR_API Meter {
|
||||
/** A section of timeline with a certain Tempo or Meter. */
|
||||
class LIBARDOUR_API MetricSection {
|
||||
public:
|
||||
MetricSection (const Timecode::BBT_Time& start)
|
||||
: _start (start), _frame (0), _movable (true), _position_lock_style (MusicTime) {}
|
||||
MetricSection (framepos_t start)
|
||||
: _frame (start), _movable (true), _position_lock_style (MusicTime) {}
|
||||
MetricSection (double start)
|
||||
: _beat (start), _frame (0), _movable (true), _position_lock_style (MusicTime) {}
|
||||
MetricSection (framepos_t frame)
|
||||
: _beat (0), _frame (frame), _movable (true), _position_lock_style (MusicTime) {}
|
||||
|
||||
virtual ~MetricSection() {}
|
||||
const double start () const { return _beat; }
|
||||
|
||||
const Timecode::BBT_Time& start() const { return _start; }
|
||||
framepos_t frame() const { return _frame; }
|
||||
|
||||
void set_movable (bool yn) { _movable = yn; }
|
||||
bool movable() const { return _movable; }
|
||||
const double& beat() const { return _beat; }
|
||||
void set_beat (double beat) { _beat = beat;}
|
||||
|
||||
framepos_t frame() const { return _frame; }
|
||||
virtual void set_frame (framepos_t f) {
|
||||
_frame = f;
|
||||
}
|
||||
|
||||
virtual void set_start (const Timecode::BBT_Time& w) {
|
||||
_start = w;
|
||||
}
|
||||
void set_movable (bool yn) { _movable = yn; }
|
||||
bool movable() const { return _movable; }
|
||||
|
||||
/* MeterSections are not stateful in the full sense,
|
||||
but we do want them to control their own
|
||||
@ -129,8 +127,7 @@ class LIBARDOUR_API MetricSection {
|
||||
void set_position_lock_style (PositionLockStyle ps) { _position_lock_style = ps; }
|
||||
|
||||
private:
|
||||
|
||||
Timecode::BBT_Time _start;
|
||||
double _beat;
|
||||
framepos_t _frame;
|
||||
bool _movable;
|
||||
PositionLockStyle _position_lock_style;
|
||||
@ -139,15 +136,23 @@ private:
|
||||
/** A section of timeline with a certain Meter. */
|
||||
class LIBARDOUR_API MeterSection : public MetricSection, public Meter {
|
||||
public:
|
||||
MeterSection (const Timecode::BBT_Time& start, double bpb, double note_type)
|
||||
: MetricSection (start), Meter (bpb, note_type) {}
|
||||
MeterSection (framepos_t start, double bpb, double note_type)
|
||||
: MetricSection (start), Meter (bpb, note_type) {}
|
||||
MeterSection (double start, const Timecode::BBT_Time& bbt, double bpb, double note_type)
|
||||
: MetricSection (start), Meter (bpb, note_type), _bbt (bbt) {}
|
||||
MeterSection (framepos_t frame, double bpb, double note_type)
|
||||
: MetricSection (frame), Meter (bpb, note_type) {}
|
||||
MeterSection (const XMLNode&);
|
||||
|
||||
static const std::string xml_state_node_name;
|
||||
|
||||
XMLNode& get_state() const;
|
||||
|
||||
void set_start (std::pair<double, Timecode::BBT_Time>& w) {
|
||||
set_beat (w.first);
|
||||
_bbt = w.second;
|
||||
}
|
||||
const Timecode::BBT_Time& bbt() const { return _bbt; }
|
||||
private:
|
||||
Timecode::BBT_Time _bbt;
|
||||
};
|
||||
|
||||
/** A section of timeline with a certain Tempo. */
|
||||
@ -158,16 +163,20 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
|
||||
Constant,
|
||||
};
|
||||
|
||||
TempoSection (const Timecode::BBT_Time& start, double qpm, double note_type, Type tempo_type)
|
||||
TempoSection (const double& 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, Type tempo_type)
|
||||
: MetricSection (start), Tempo (qpm, note_type), _bar_offset (-1.0), _type (tempo_type) {}
|
||||
TempoSection (framepos_t frame, double qpm, double note_type, Type tempo_type)
|
||||
: MetricSection (frame), Tempo (qpm, note_type), _bar_offset (-1.0), _type (tempo_type) {}
|
||||
TempoSection (const XMLNode&);
|
||||
|
||||
static const std::string xml_state_node_name;
|
||||
|
||||
XMLNode& get_state() const;
|
||||
|
||||
void set_start (const double& w) {
|
||||
set_beat (w);
|
||||
}
|
||||
|
||||
void update_bar_offset_from_bbt (const Meter&);
|
||||
void update_bbt_time_from_bar_offset (const Meter&);
|
||||
double bar_offset() const { return _bar_offset; }
|
||||
@ -184,6 +193,8 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
|
||||
double beat_at_frame (framepos_t frame, double end_bpm, framepos_t end_frame, framecnt_t frame_rate) const;
|
||||
framepos_t frame_at_beat (double beat, double end_bpm, framepos_t end_frame, framecnt_t frame_rate) const;
|
||||
|
||||
Timecode::BBT_Time legacy_bbt () { return _legacy_bbt; }
|
||||
|
||||
private:
|
||||
|
||||
framecnt_t minute_to_frame (double time, framecnt_t frame_rate) const;
|
||||
@ -217,6 +228,7 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
|
||||
*/
|
||||
double _bar_offset;
|
||||
Type _type;
|
||||
Timecode::BBT_Time _legacy_bbt;
|
||||
};
|
||||
|
||||
typedef std::list<MetricSection*> Metrics;
|
||||
@ -232,7 +244,7 @@ class LIBARDOUR_API TempoMetric {
|
||||
void set_tempo (const Tempo& t) { _tempo = &t; }
|
||||
void set_meter (const Meter& m) { _meter = &m; }
|
||||
void set_frame (framepos_t f) { _frame = f; }
|
||||
void set_start (const Timecode::BBT_Time& t) { _start = t; }
|
||||
void set_start (const double& t) { _start = t; }
|
||||
|
||||
void set_metric (const MetricSection* section) {
|
||||
const MeterSection* meter;
|
||||
@ -250,13 +262,13 @@ class LIBARDOUR_API TempoMetric {
|
||||
const Meter& meter() const { return *_meter; }
|
||||
const Tempo& tempo() const { return *_tempo; }
|
||||
framepos_t frame() const { return _frame; }
|
||||
const Timecode::BBT_Time& start() const { return _start; }
|
||||
const double& start() const { return _start; }
|
||||
|
||||
private:
|
||||
const Meter* _meter;
|
||||
const Tempo* _tempo;
|
||||
framepos_t _frame;
|
||||
Timecode::BBT_Time _start;
|
||||
double _start;
|
||||
};
|
||||
|
||||
/** Tempo Map - mapping of timecode to musical time.
|
||||
@ -346,18 +358,17 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||
const Meter& meter_at (framepos_t) const;
|
||||
|
||||
const TempoSection& tempo_section_at (framepos_t) const;
|
||||
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::Type type);
|
||||
void add_meter (const Meter&, Timecode::BBT_Time where);
|
||||
void add_tempo (const Tempo&, double where, TempoSection::Type type);
|
||||
void add_meter (const Meter&, double start, 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::Type type);
|
||||
void gui_set_tempo_frame (TempoSection&, framepos_t where);
|
||||
void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where);
|
||||
void replace_tempo (const TempoSection&, const Tempo&, const double& where, TempoSection::Type type);
|
||||
void gui_set_tempo_frame (TempoSection&, framepos_t where, double beat);
|
||||
void replace_meter (const MeterSection&, const Meter&, const double& start, const Timecode::BBT_Time& where);
|
||||
|
||||
framepos_t round_to_bar (framepos_t frame, RoundMode dir);
|
||||
framepos_t round_to_beat (framepos_t frame, RoundMode dir);
|
||||
@ -393,6 +404,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||
|
||||
PBD::Signal0<void> MetricPositionChanged;
|
||||
|
||||
double bbt_to_beats (Timecode::BBT_Time bbt);
|
||||
|
||||
private:
|
||||
|
||||
friend class ::BBTTest;
|
||||
@ -424,8 +437,8 @@ private:
|
||||
|
||||
void do_insert (MetricSection* section);
|
||||
|
||||
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);
|
||||
void add_tempo_locked (const Tempo&, double where, bool recompute, TempoSection::Type type);
|
||||
void add_meter_locked (const Meter&, double start, Timecode::BBT_Time where, bool recompute);
|
||||
|
||||
bool remove_tempo_locked (const TempoSection&);
|
||||
bool remove_meter_locked (const MeterSection&);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ BBTTest::addTest ()
|
||||
Tempo tempo(120);
|
||||
Meter meter(4.0, 4.0);
|
||||
|
||||
map.add_meter (meter, BBT_Time(1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time(1, 1, 0));
|
||||
|
||||
/* add some good stuff here */
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ FrameposMinusBeatsTest::singleTempoTest ()
|
||||
Tempo tempo (bpm);
|
||||
Meter meter (4, 4);
|
||||
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempo, 0.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Subtract 1 beat from beat 3 of the first bar */
|
||||
framepos_t r = map.framepos_minus_beats (frames_per_beat * 2, Beats(1));
|
||||
@ -42,7 +42,7 @@ FrameposMinusBeatsTest::doubleTempoTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meter (4, 4);
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
@ -63,9 +63,9 @@ FrameposMinusBeatsTest::doubleTempoTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
@ -94,7 +94,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meterA (4, 4);
|
||||
map.add_meter (meterA, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
@ -115,11 +115,11 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant);
|
||||
Meter meterB (3, 4);
|
||||
map.add_meter (meterB, BBT_Time (4, 1, 0));
|
||||
map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0));
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
@ -21,8 +21,8 @@ FrameposPlusBeatsTest::singleTempoTest ()
|
||||
Tempo tempo (bpm);
|
||||
Meter meter (4, 4);
|
||||
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempo, 0.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Add 1 beat to beat 3 of the first bar */
|
||||
framepos_t r = map.framepos_plus_beats (frames_per_beat * 2, Evoral::Beats(1));
|
||||
@ -41,7 +41,7 @@ FrameposPlusBeatsTest::doubleTempoTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meter (4, 4);
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
@ -62,9 +62,9 @@ FrameposPlusBeatsTest::doubleTempoTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
@ -93,7 +93,7 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meterA (4, 4);
|
||||
map.add_meter (meterA, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
@ -114,11 +114,11 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant);
|
||||
Meter meterB (3, 4);
|
||||
map.add_meter (meterB, BBT_Time (4, 1, 0));
|
||||
map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0));
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
@ -20,8 +20,8 @@ FramewalkToBeatsTest::singleTempoTest ()
|
||||
Tempo tempo (bpm);
|
||||
Meter meter (4, 4);
|
||||
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempo, 0.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Walk 1 beats-worth of frames from beat 3 */
|
||||
double r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1).to_double();
|
||||
@ -47,7 +47,7 @@ FramewalkToBeatsTest::doubleTempoTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meter (4, 4);
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
@ -70,9 +70,9 @@ FramewalkToBeatsTest::doubleTempoTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
@ -103,7 +103,7 @@ FramewalkToBeatsTest::tripleTempoTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meter (4, 4);
|
||||
map.add_meter (meter, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 2, 160bpm at bar 3
|
||||
@ -125,11 +125,11 @@ FramewalkToBeatsTest::tripleTempoTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (2, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 4.0, TempoSection::Type::Constant);
|
||||
Tempo tempoC (160);
|
||||
map.add_tempo (tempoC, BBT_Time (3, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoC, 8.0, TempoSection::Type::Constant);
|
||||
|
||||
/* Walk from 1|3 to 4|1 */
|
||||
double r = map.framewalk_to_beats (2 * 24e3, (2 * 24e3) + (4 * 12e3) + (4 * 18e3)).to_double();
|
||||
|
@ -48,8 +48,8 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy {
|
||||
meter (4.0, 4.0)
|
||||
{
|
||||
_tempo_map = new TempoMap (FRAME_RATE);
|
||||
_tempo_map->add_tempo (tempo, Timecode::BBT_Time(1, 1, 0), TempoSection::Type::Constant);
|
||||
_tempo_map->add_meter (meter, Timecode::BBT_Time(1, 1, 0));
|
||||
_tempo_map->add_tempo (tempo, 0.0, TempoSection::Type::Constant);
|
||||
_tempo_map->add_meter (meter, 0.0, Timecode::BBT_Time(1, 1, 0));
|
||||
}
|
||||
|
||||
// Controlling the mock object
|
||||
|
@ -14,7 +14,7 @@ TempoTest::recomputeMapTest ()
|
||||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meterA (4, 4);
|
||||
map.add_meter (meterA, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
@ -35,11 +35,11 @@ TempoTest::recomputeMapTest ()
|
||||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant);
|
||||
map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant);
|
||||
Meter meterB (3, 4);
|
||||
map.add_meter (meterB, BBT_Time (4, 1, 0));
|
||||
map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0));
|
||||
|
||||
list<MetricSection*>::iterator i = map.metrics.begin();
|
||||
CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ());
|
||||
|
Loading…
Reference in New Issue
Block a user