Tempo ramps - more code consolidation wrt add meter/tempo.
This commit is contained in:
parent
82d876b48b
commit
074db3b861
|
@ -3183,13 +3183,9 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
|
|||
--bbt.bars;
|
||||
}
|
||||
const double beat = map.bbt_to_beats (bbt);
|
||||
_real_section = map.add_meter (Meter (_marker->meter().divisions_per_bar(), _marker->meter().note_divisor())
|
||||
, beat, bbt, map.frame_time (bbt), _real_section->position_lock_style());
|
||||
|
||||
if (_real_section->position_lock_style() == AudioTime) {
|
||||
_real_section = map.add_meter_frame (Meter (_marker->meter().divisions_per_bar(), _marker->meter().note_divisor())
|
||||
, map.frame_time (bbt), beat, bbt);
|
||||
} else {
|
||||
_real_section = map.add_meter_beat (Meter (_marker->meter().divisions_per_bar(), _marker->meter().note_divisor()), beat, bbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3355,7 +3351,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
|
|||
map.round_bbt (bbt, _editor->get_grid_beat_divisions (0), RoundNearest);
|
||||
}
|
||||
double const pulse = map.predict_tempo_pulse (_real_section, map.frame_time (bbt));
|
||||
_real_section = map.add_tempo_pulse (_marker->tempo(), pulse, _real_section->type());
|
||||
_real_section = map.add_tempo (_marker->tempo(), pulse, 0, _real_section->type(), MusicTime);
|
||||
} else {
|
||||
if (use_snap && _editor->snap_type() == SnapToBar) {
|
||||
map.round_bbt (bbt, -1, (frame > _real_section->frame()) ? RoundUpMaybe : RoundDownMaybe);
|
||||
|
@ -3365,7 +3361,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
|
|||
if (use_snap) {
|
||||
frame = map.predict_tempo_frame (_real_section, bbt);
|
||||
}
|
||||
_real_section = map.add_tempo_frame (_marker->tempo(), frame, _real_section->type());
|
||||
_real_section = map.add_tempo (_marker->tempo(), 0.0, frame, _real_section->type(), AudioTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1391,11 +1391,10 @@ Editor::toggle_marker_lock_style ()
|
|||
begin_reversible_command (_("change meter lock style"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
MeterSection* msp = &mm->meter();
|
||||
if (mm->meter().position_lock_style() == AudioTime) {
|
||||
_session->tempo_map().replace_meter_bbt (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->bbt());
|
||||
} else {
|
||||
_session->tempo_map().replace_meter_frame (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->frame());
|
||||
}
|
||||
const PositionLockStyle pls = (msp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
|
||||
|
||||
_session->tempo_map().replace_meter (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->bbt(), msp->frame(), pls);
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
|
@ -1404,6 +1403,7 @@ Editor::toggle_marker_lock_style ()
|
|||
XMLNode &before = _session->tempo_map().get_state();
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
|
||||
|
||||
_session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->frame(), tsp->type(), pls);
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
|
|
|
@ -6552,7 +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 {
|
||||
_session->tempo_map().add_tempo_frame (Tempo (beats_per_minute, t.note_type()), start, TempoSection::Constant);
|
||||
_session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), 0.0, start, TempoSection::Constant, AudioTime);
|
||||
}
|
||||
|
||||
XMLNode& after (_session->tempo_map().get_state());
|
||||
|
|
|
@ -300,7 +300,7 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
|
|||
if (pulse > 0.0) {
|
||||
XMLNode &before = map.get_state();
|
||||
/* add music-locked ramped (?) tempo using the bpm/note type at frame*/
|
||||
map.add_tempo_pulse (map.tempo_at (frame), pulse, TempoSection::Ramp);
|
||||
map.add_tempo (map.tempo_at (frame), pulse, 0, TempoSection::Ramp, MusicTime);
|
||||
|
||||
XMLNode &after = map.get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
|
||||
|
@ -340,9 +340,9 @@ Editor::mouse_add_new_meter_event (framepos_t frame)
|
|||
XMLNode &before = map.get_state();
|
||||
|
||||
if (meter_dialog.get_lock_style() == MusicTime) {
|
||||
map.add_meter_beat (Meter (bpb, note_type), map.bbt_to_beats (requested), requested);
|
||||
map.add_meter (Meter (bpb, note_type), map.bbt_to_beats (requested), requested, 0, MusicTime);
|
||||
} else {
|
||||
map.add_meter_frame (Meter (bpb, note_type), map.frame_time (requested), map.bbt_to_beats (requested), requested);
|
||||
map.add_meter (Meter (bpb, note_type), map.bbt_to_beats (requested), requested, map.frame_time (requested), AudioTime);
|
||||
}
|
||||
|
||||
_session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
|
||||
|
@ -394,13 +394,10 @@ Editor::edit_meter_section (MeterSection* section)
|
|||
|
||||
begin_reversible_command (_("replace meter mark"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
section->set_position_lock_style (meter_dialog.get_lock_style());
|
||||
if (meter_dialog.get_lock_style() == MusicTime) {
|
||||
_session->tempo_map().replace_meter_bbt (*section, Meter (bpb, note_type), when);
|
||||
} else {
|
||||
_session->tempo_map().replace_meter_frame (*section, Meter (bpb, note_type), frame);
|
||||
}
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
|
||||
_session->tempo_map().replace_meter (*section, Meter (bpb, note_type), when, frame, meter_dialog.get_lock_style());
|
||||
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
|
|
@ -373,28 +373,20 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
|||
const MeterSection& meter_section_at (framepos_t frame) const;
|
||||
const MeterSection& meter_section_at_beat (double beat) const;
|
||||
|
||||
/** add a music-locked tempo section at pulse
|
||||
* @param pulse pulse position of new section
|
||||
*/
|
||||
TempoSection* add_tempo_pulse (const Tempo&, const double& pulse, TempoSection::Type type);
|
||||
|
||||
/** add an audio-locked tempo section at frame
|
||||
* @param frame frame position of new section
|
||||
/** add a tempo section locked to pls. ignored values are set in recompute_tempos()
|
||||
* @param pulse pulse position of new section. ignored if pls == AudioTime
|
||||
* @param frame frame position of new section. ignored if pls == MusicTime
|
||||
* @param type type of new tempo section (Ramp, Constant)
|
||||
*/
|
||||
TempoSection* add_tempo_frame (const Tempo&, const framepos_t& frame, TempoSection::Type type);
|
||||
TempoSection* add_tempo (const Tempo&, const double& pulse, const framepos_t& frame, TempoSection::Type type, PositionLockStyle pls);
|
||||
|
||||
/** add a music-locked meter section at beat
|
||||
/** add an meter section locked to pls.. ignored values are set in recompute_meters()
|
||||
* @param beat beat position of new section
|
||||
* @param where bbt position of new section
|
||||
* @param frame frame position of new section. ignored if pls == MusicTime
|
||||
*/
|
||||
MeterSection* add_meter_beat (const Meter&, const double& beat, const Timecode::BBT_Time& where);
|
||||
|
||||
/** add an audio-locked meter section at frame
|
||||
* @param frame frame position of new section
|
||||
* @param beat beat position of new section
|
||||
* @param where bbt position of new section
|
||||
*/
|
||||
MeterSection* add_meter_frame (const Meter&, const framepos_t& frame, const double& beat, const Timecode::BBT_Time& where);
|
||||
MeterSection* add_meter (const Meter&, const double& beat, const Timecode::BBT_Time& where, const framepos_t& frame, PositionLockStyle pls);
|
||||
|
||||
void remove_tempo (const TempoSection&, bool send_signal);
|
||||
void remove_meter (const MeterSection&, bool send_signal);
|
||||
|
@ -405,6 +397,9 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
|||
void replace_tempo (const TempoSection&, const Tempo&, const double& pulse, const framepos_t& frame
|
||||
, TempoSection::Type type, PositionLockStyle pls);
|
||||
|
||||
void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, const framepos_t& frame
|
||||
, PositionLockStyle pls);
|
||||
|
||||
void gui_move_tempo_frame (TempoSection*, const framepos_t& frame);
|
||||
void gui_move_tempo_beat (TempoSection*, const double& beat);
|
||||
void gui_move_meter_frame (MeterSection*, const framepos_t& frame);
|
||||
|
@ -415,9 +410,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
|||
|
||||
bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt);
|
||||
|
||||
void replace_meter_bbt (const MeterSection&, const Meter&, const Timecode::BBT_Time& where);
|
||||
void replace_meter_frame (const MeterSection&, const Meter&, const framepos_t& frame);
|
||||
|
||||
framepos_t round_to_bar (framepos_t frame, RoundMode dir);
|
||||
framepos_t round_to_beat (framepos_t frame, RoundMode dir);
|
||||
framepos_t round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir);
|
||||
|
@ -517,10 +509,10 @@ private:
|
|||
void do_insert (MetricSection* section);
|
||||
|
||||
TempoSection* add_tempo_locked (const Tempo&, double pulse, framepos_t frame
|
||||
, TempoSection::Type type, PositionLockStyle pls, bool recompute, bool locked_to_meter = false);
|
||||
, TempoSection::Type type, PositionLockStyle pls, bool recompute, bool locked_to_meter = false);
|
||||
|
||||
MeterSection* add_meter_beat_locked (const Meter&, double beat, const Timecode::BBT_Time& where, bool recompute);
|
||||
MeterSection* add_meter_frame_locked (const Meter&, framepos_t frame, double beat, const Timecode::BBT_Time& where, bool recompute);
|
||||
MeterSection* add_meter_locked (const Meter&, double beat, const Timecode::BBT_Time& where, framepos_t frame
|
||||
, PositionLockStyle pls, bool recompute);
|
||||
|
||||
bool remove_tempo_locked (const TempoSection&);
|
||||
bool remove_meter_locked (const MeterSection&);
|
||||
|
|
|
@ -832,10 +832,8 @@ LuaBindings::common (lua_State* L)
|
|||
.endClass ()
|
||||
|
||||
.beginClass <TempoMap> ("TempoMap")
|
||||
.addFunction ("add_tempo_pulse", &TempoMap::add_tempo_pulse)
|
||||
.addFunction ("add_tempo_frame", &TempoMap::add_tempo_frame)
|
||||
.addFunction ("add_meter_beat", &TempoMap::add_meter_beat)
|
||||
.addFunction ("add_meter_frame", &TempoMap::add_meter_frame)
|
||||
.addFunction ("add_tempo", &TempoMap::add_tempo)
|
||||
.addFunction ("add_meter", &TempoMap::add_meter)
|
||||
.endClass ()
|
||||
|
||||
.beginClass <ChanCount> ("ChanCount")
|
||||
|
|
|
@ -907,7 +907,7 @@ TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const doubl
|
|||
|
||||
PropertyChanged (PropertyChange ());
|
||||
}
|
||||
|
||||
/*
|
||||
TempoSection*
|
||||
TempoMap::add_tempo_pulse (const Tempo& tempo, const double& pulse, ARDOUR::TempoSection::Type type)
|
||||
{
|
||||
|
@ -934,6 +934,22 @@ TempoMap::add_tempo_frame (const Tempo& tempo, const framepos_t& frame, ARDOUR::
|
|||
}
|
||||
|
||||
|
||||
PropertyChanged (PropertyChange ());
|
||||
|
||||
return ts;
|
||||
}
|
||||
*/
|
||||
|
||||
TempoSection*
|
||||
TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t& frame, ARDOUR::TempoSection::Type type, PositionLockStyle pls)
|
||||
{
|
||||
TempoSection* ts = 0;
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
ts = add_tempo_locked (tempo, pulse, frame, type, pls, true);
|
||||
}
|
||||
|
||||
|
||||
PropertyChanged (PropertyChange ());
|
||||
|
||||
return ts;
|
||||
|
@ -961,38 +977,15 @@ TempoMap::add_tempo_locked (const Tempo& tempo, double pulse, framepos_t frame
|
|||
}
|
||||
|
||||
void
|
||||
TempoMap::replace_meter_bbt (const MeterSection& ms, const Meter& meter, const BBT_Time& where)
|
||||
TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_Time& where, const framepos_t& frame, PositionLockStyle pls)
|
||||
{
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
const double beat = bbt_to_beats_locked (_metrics, where);
|
||||
|
||||
if (ms.movable()) {
|
||||
remove_meter_locked (ms);
|
||||
add_meter_beat_locked (meter, bbt_to_beats_locked (_metrics, where), where, true);
|
||||
} else {
|
||||
MeterSection& first (first_meter());
|
||||
/* cannot move the first meter section */
|
||||
*static_cast<Meter*>(&first) = meter;
|
||||
first.set_position_lock_style (AudioTime);
|
||||
}
|
||||
recompute_map (_metrics);
|
||||
}
|
||||
|
||||
PropertyChanged (PropertyChange ());
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::replace_meter_frame (const MeterSection& ms, const Meter& meter, const framepos_t& frame)
|
||||
{
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
|
||||
const double beat = ms.beat();
|
||||
const BBT_Time bbt = ms.bbt();
|
||||
|
||||
if (ms.movable()) {
|
||||
remove_meter_locked (ms);
|
||||
add_meter_frame_locked (meter, frame, beat, bbt, true);
|
||||
add_meter_locked (meter, beat, where, frame, pls, true);
|
||||
} else {
|
||||
MeterSection& first (first_meter());
|
||||
TempoSection& first_t (first_tempo());
|
||||
|
@ -1012,14 +1005,13 @@ TempoMap::replace_meter_frame (const MeterSection& ms, const Meter& meter, const
|
|||
PropertyChanged (PropertyChange ());
|
||||
}
|
||||
|
||||
|
||||
MeterSection*
|
||||
TempoMap::add_meter_beat (const Meter& meter, const double& beat, const BBT_Time& where)
|
||||
TempoMap::add_meter (const Meter& meter, const double& beat, const Timecode::BBT_Time& where, const framepos_t& frame, PositionLockStyle pls)
|
||||
{
|
||||
MeterSection* m = 0;
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
m = add_meter_beat_locked (meter, beat, where, true);
|
||||
m = add_meter_locked (meter, beat, where, frame, pls, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1030,70 +1022,36 @@ TempoMap::add_meter_beat (const Meter& meter, const double& beat, const BBT_Time
|
|||
#endif
|
||||
|
||||
PropertyChanged (PropertyChange ());
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
MeterSection*
|
||||
TempoMap::add_meter_frame (const Meter& meter, const framepos_t& frame, const double& beat, const Timecode::BBT_Time& where)
|
||||
TempoMap::add_meter_locked (const Meter& meter, double beat, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls, bool recompute)
|
||||
{
|
||||
MeterSection* m = 0;
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
m = add_meter_frame_locked (meter, frame, beat, where, true);
|
||||
const MeterSection& prev_m = meter_section_at_locked (_metrics, frame - 1);
|
||||
const double pulse = ((where.bars - prev_m.bbt().bars) * (prev_m.divisions_per_bar() / prev_m.note_divisor())) + prev_m.pulse();
|
||||
|
||||
if (pls == AudioTime) {
|
||||
/* add meter-locked tempo */
|
||||
add_tempo_locked (tempo_at_locked (_metrics, frame), pulse, frame, TempoSection::Ramp, AudioTime, true, true);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (DEBUG_ENABLED(DEBUG::TempoMap)) {
|
||||
dump (_metrics, std::cerr);
|
||||
}
|
||||
#endif
|
||||
|
||||
PropertyChanged (PropertyChange ());
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
MeterSection*
|
||||
TempoMap::add_meter_beat_locked (const Meter& meter, double beat, const BBT_Time& where, bool recompute)
|
||||
{
|
||||
/* a new meter always starts a new bar on the first beat. so
|
||||
round the start time appropriately. remember that
|
||||
`where' is based on the existing tempo map, not
|
||||
the result after we insert the new meter.
|
||||
|
||||
*/
|
||||
|
||||
const double pulse = pulse_at_beat_locked (_metrics, beat);
|
||||
MeterSection* new_meter = new MeterSection (pulse, 0, beat, where, meter.divisions_per_bar(), meter.note_divisor(), MusicTime);
|
||||
MeterSection* new_meter = new MeterSection (pulse, frame, beat, where, meter.divisions_per_bar(), meter.note_divisor(), pls);
|
||||
|
||||
do_insert (new_meter);
|
||||
|
||||
if (recompute) {
|
||||
solve_map_bbt (_metrics, new_meter, where);
|
||||
|
||||
if (pls == AudioTime) {
|
||||
solve_map_frame (_metrics, new_meter, frame);
|
||||
} else {
|
||||
solve_map_bbt (_metrics, new_meter, where);
|
||||
}
|
||||
}
|
||||
|
||||
return new_meter;
|
||||
}
|
||||
|
||||
MeterSection*
|
||||
TempoMap::add_meter_frame_locked (const Meter& meter, framepos_t frame, double beat, const Timecode::BBT_Time& where, bool recompute)
|
||||
{
|
||||
/* add meter-locked tempo */
|
||||
const double pulse = pulse_at_frame_locked (_metrics, frame);
|
||||
TempoSection* t = add_tempo_locked (tempo_at_locked (_metrics, frame), pulse, frame, TempoSection::Ramp, AudioTime, true, true);
|
||||
|
||||
MeterSection* new_meter = new MeterSection (pulse, frame, beat, where, meter.divisions_per_bar(), meter.note_divisor(), AudioTime);
|
||||
|
||||
do_insert (new_meter);
|
||||
|
||||
if (recompute) {
|
||||
solve_map_frame (_metrics, new_meter, frame);
|
||||
}
|
||||
return new_meter;
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::change_initial_tempo (double beats_per_minute, double note_type)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ BBTTest::addTest ()
|
|||
Tempo tempo(120);
|
||||
Meter meter(4.0, 4.0);
|
||||
|
||||
map.add_meter_beat (meter, 0.0, BBT_Time(1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time(1, 1, 0), 0, AudioTime);
|
||||
|
||||
/* add some good stuff here */
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ FrameposMinusBeatsTest::singleTempoTest ()
|
|||
Tempo tempo (bpm);
|
||||
Meter meter (4, 4);
|
||||
|
||||
map.add_meter_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo_pulse (tempo, 0.0, TempoSection::Constant);
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
map.add_tempo (tempo, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
|
||||
/* 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_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
|
@ -64,9 +64,9 @@ FrameposMinusBeatsTest::doubleTempoTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 12.0 / tempoA.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
@ -95,7 +95,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
|
|||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meterA (4, 4);
|
||||
map.add_meter_beat (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
|
@ -117,11 +117,11 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 12.0 / tempoA.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
Meter meterB (3, 4);
|
||||
map.add_meter_beat (meterB, 12.0 / tempoA.note_type(), BBT_Time (4, 1, 0));
|
||||
map.add_meter (meterB, 12.0 / tempoA.note_type(), BBT_Time (4, 1, 0), 0, MusicTime);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ FrameposPlusBeatsTest::singleTempoTest ()
|
|||
Tempo tempo (bpm);
|
||||
Meter meter (4, 4);
|
||||
|
||||
map.add_meter_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo_pulse (tempo, 0.0, TempoSection::Constant);
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
map.add_tempo (tempo, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
|
||||
/* 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_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
|
@ -63,9 +63,9 @@ FrameposPlusBeatsTest::doubleTempoTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 12.0 / tempoA.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
@ -94,7 +94,7 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest ()
|
|||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meterA (4, 4);
|
||||
map.add_meter_beat (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
|
@ -116,11 +116,11 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 12.0 / tempoA.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
Meter meterB (3, 4);
|
||||
map.add_meter_beat (meterB, 12.0 / tempoA.note_type(), BBT_Time (4, 1, 0));
|
||||
map.add_meter (meterB, 12.0 / tempoA.note_type(), BBT_Time (4, 1, 0), 0, MusicTime);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ FramewalkToBeatsTest::singleTempoTest ()
|
|||
Tempo tempo (bpm);
|
||||
Meter meter (4, 4);
|
||||
|
||||
map.add_meter_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo_pulse (tempo, 0.0, TempoSection::Constant);
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
map.add_tempo (tempo, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
|
||||
/* 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_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
|
@ -71,9 +71,9 @@ FramewalkToBeatsTest::doubleTempoTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 12.0 / tempoB.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 12.0 / tempoB.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
|
||||
/* Now some tests */
|
||||
|
||||
|
@ -104,7 +104,7 @@ FramewalkToBeatsTest::tripleTempoTest ()
|
|||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meter (4, 4);
|
||||
map.add_meter_beat (meter, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meter, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 2, 160bpm at bar 3
|
||||
|
@ -127,11 +127,11 @@ FramewalkToBeatsTest::tripleTempoTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 4.0 / tempoB.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 4.0 / tempoB.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
Tempo tempoC (160);
|
||||
map.add_tempo_pulse (tempoC, 8.0 / tempoB.note_type(), TempoSection::Constant);
|
||||
map.add_tempo (tempoC, 8.0 / tempoB.note_type(), 0, TempoSection::Constant, MusicTime);
|
||||
|
||||
/* 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_pulse (tempo, 0.0, TempoSection::Type::Constant);
|
||||
_tempo_map->add_meter_beat (meter, 0.0, Timecode::BBT_Time(1, 1, 0));
|
||||
_tempo_map->add_tempo (tempo, 0.0, 0, TempoSection::Type::Constant, AudioTime);
|
||||
_tempo_map->add_meter (meter, 0.0, Timecode::BBT_Time(1, 1, 0), 0, AudioTime);
|
||||
}
|
||||
|
||||
// Controlling the mock object
|
||||
|
|
|
@ -14,7 +14,7 @@ TempoTest::recomputeMapTest ()
|
|||
|
||||
TempoMap map (sampling_rate);
|
||||
Meter meterA (4, 4);
|
||||
map.add_meter_beat (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
120bpm at bar 1, 240bpm at bar 4
|
||||
|
@ -36,11 +36,11 @@ TempoTest::recomputeMapTest ()
|
|||
*/
|
||||
|
||||
Tempo tempoA (120);
|
||||
map.add_tempo_pulse (tempoA, 0.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Constant, AudioTime);
|
||||
Tempo tempoB (240);
|
||||
map.add_tempo_pulse (tempoB, 4.0, TempoSection::Constant);
|
||||
map.add_tempo (tempoB, 4.0, 0, TempoSection::Constant, MusicTime);
|
||||
Meter meterB (3, 4);
|
||||
map.add_meter_beat (meterB, 12.0, BBT_Time (4, 1, 0));
|
||||
map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0), 0, MusicTime);
|
||||
|
||||
list<MetricSection*>::iterator i = map._metrics.begin();
|
||||
CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ());
|
||||
|
@ -59,9 +59,9 @@ TempoTest::rampTest ()
|
|||
Meter meterA (4, 4);
|
||||
Tempo tempoA (77.0, 4.0);
|
||||
Tempo tempoB (217.0, 4.0);
|
||||
map.add_tempo_frame (tempoA, (framepos_t) 0, TempoSection::Ramp);
|
||||
map.add_tempo_frame (tempoB, (framepos_t) 60 * sampling_rate, TempoSection::Ramp);
|
||||
map.add_meter_beat (meterA, 0.0, BBT_Time (1, 1, 0));
|
||||
map.add_tempo (tempoA, 0.0, 0, TempoSection::Ramp, AudioTime);
|
||||
map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, TempoSection::Ramp, AudioTime);
|
||||
map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0), 0, AudioTime);
|
||||
|
||||
/*
|
||||
|
||||
|
|
Loading…
Reference in New Issue