Tempo ramps - adding a new tempo doesn't involve a dialog.
This commit is contained in:
parent
b6afce7173
commit
932c7b07fd
|
@ -223,32 +223,12 @@ Editor::mouse_add_new_tempo_event (framepos_t frame)
|
|||
}
|
||||
|
||||
TempoMap& map(_session->tempo_map());
|
||||
TempoDialog tempo_dialog (map, frame, _("add"));
|
||||
|
||||
//this causes compiz to display no border.
|
||||
//tempo_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
|
||||
|
||||
switch (tempo_dialog.run()) {
|
||||
case RESPONSE_ACCEPT:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
double bpm = 0;
|
||||
Timecode::BBT_Time requested;
|
||||
bpm = tempo_dialog.get_bpm ();
|
||||
double nt = tempo_dialog.get_note_type();
|
||||
bpm = max (0.01, bpm);
|
||||
|
||||
tempo_dialog.get_bbt_time (requested);
|
||||
begin_reversible_command (_("add tempo mark"));
|
||||
XMLNode &before = map.get_state();
|
||||
if (tempo_dialog.get_lock_style() == MusicTime) {
|
||||
map.add_tempo (Tempo (bpm,nt), map.pulse_at_beat (map.bbt_to_beats (requested)), tempo_dialog.get_tempo_type());
|
||||
} else {
|
||||
map.add_tempo (Tempo (bpm,nt), frame, tempo_dialog.get_tempo_type());
|
||||
}
|
||||
/* add music-locked ramped (?) tempo using the bpm/note type at frame*/
|
||||
map.add_tempo (map.tempo_at (frame), map.pulse_at_frame (frame), TempoSection::Ramp);
|
||||
|
||||
XMLNode &after = map.get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
|
||||
commit_reversible_command ();
|
||||
|
|
|
@ -441,13 +441,16 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
|||
double pulse_at_beat (const double& beat) const;
|
||||
double beat_at_pulse (const double& pulse) const;
|
||||
|
||||
double pulse_at_frame (const framecnt_t& frame) const;
|
||||
framecnt_t frame_at_pulse (const double& pulse) const;
|
||||
|
||||
PBD::Signal0<void> MetricPositionChanged;
|
||||
|
||||
private:
|
||||
double pulse_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
||||
double beat_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
||||
double pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
|
||||
framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& beat) const;
|
||||
framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
||||
|
||||
double beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
|
||||
framecnt_t frame_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
||||
|
|
|
@ -1485,6 +1485,13 @@ TempoMap::pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame
|
|||
return pulses_in_section + prev_t->pulse();
|
||||
}
|
||||
|
||||
double
|
||||
TempoMap::pulse_at_frame (const framecnt_t& frame) const
|
||||
{
|
||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||
return pulse_at_frame_locked (_metrics, frame);
|
||||
}
|
||||
|
||||
framecnt_t
|
||||
TempoMap::frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const
|
||||
{
|
||||
|
@ -1515,6 +1522,13 @@ TempoMap::frame_at_pulse_locked (const Metrics& metrics, const double& pulse) co
|
|||
return ret;
|
||||
}
|
||||
|
||||
framecnt_t
|
||||
TempoMap::frame_at_pulse (const double& pulse) const
|
||||
{
|
||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||
return frame_at_pulse_locked (_metrics, pulse);
|
||||
}
|
||||
|
||||
double
|
||||
TempoMap::beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user