Tempo ramps - restore bbt settings in tempo dialog for audio-locked tempo markers
- see comments
This commit is contained in:
parent
c98e008745
commit
b8b6d562a4
@ -378,7 +378,9 @@ Editor::edit_tempo_section (TempoSection* section)
|
||||
if (tempo_dialog.get_lock_style() == MusicTime) {
|
||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), beat, tempo_dialog.get_tempo_type());
|
||||
} else {
|
||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), section->frame(), tempo_dialog.get_tempo_type());
|
||||
_session->tempo_map().replace_c_func_from_tempo_and_beat (bpm, beat);
|
||||
framepos_t const f = _session->tempo_map().frame_at_beat (beat);
|
||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), f, tempo_dialog.get_tempo_type());
|
||||
}
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
|
@ -465,8 +465,8 @@ MeterDialog::init (const Timecode::BBT_Time& when, double bpb, double divisor, b
|
||||
|
||||
lock_styles.insert (make_pair (_("music"), PositionLockStyle::MusicTime));
|
||||
strings.push_back (_("music"));
|
||||
lock_styles.insert (make_pair (_("audio ur brane wul xplod"), PositionLockStyle::AudioTime));
|
||||
strings.push_back (_("audio"));
|
||||
lock_styles.insert (make_pair (_("audio"), PositionLockStyle::AudioTime));
|
||||
strings.push_back (_("audio ur brane wul xplod"));
|
||||
set_popdown_strings (lock_style, strings);
|
||||
LockStyles::iterator ls;
|
||||
for (ls = lock_styles.begin(); ls != lock_styles.end(); ++ls) {
|
||||
@ -488,7 +488,7 @@ MeterDialog::init (const Timecode::BBT_Time& when, double bpb, double divisor, b
|
||||
table->attach (*bpb_label, 0, 1, 0, 1, FILL|EXPAND, FILL|EXPAND);
|
||||
table->attach (bpb_entry, 1, 2, 0, 1, FILL|EXPAND, FILL|EXPAND);
|
||||
table->attach (*note_label, 0, 1, 1, 2, FILL|EXPAND, FILL|EXPAND);
|
||||
table->attach (note_type, 1, 2, 1, 2, FILL|EXPAND, SHRINK);
|
||||
table->attach (note_type, 1, 2, 1, 2, FILL|EXPAND, FILL|EXPAND);
|
||||
|
||||
snprintf (buf, sizeof (buf), "%" PRIu32, when.bars);
|
||||
when_bar_entry.set_text (buf);
|
||||
@ -499,10 +499,13 @@ MeterDialog::init (const Timecode::BBT_Time& when, double bpb, double divisor, b
|
||||
|
||||
table->attach (*when_label, 0, 1, 2, 3, FILL | EXPAND, FILL | EXPAND);
|
||||
table->attach (when_bar_entry, 1, 2, 2, 3, FILL | EXPAND, FILL | EXPAND);
|
||||
}
|
||||
|
||||
table->attach (*lock_label, 0, 1, 3, 4, FILL|EXPAND, FILL|EXPAND);
|
||||
table->attach (lock_style, 1, 2, 3, 4, FILL|EXPAND, SHRINK);
|
||||
table->attach (*lock_label, 0, 1, 3, 4, FILL|EXPAND, FILL|EXPAND);
|
||||
table->attach (lock_style, 1, 2, 3, 4, FILL|EXPAND, SHRINK);
|
||||
} else {
|
||||
table->attach (*lock_label, 0, 1, 2, 3, FILL|EXPAND, FILL|EXPAND);
|
||||
table->attach (lock_style, 1, 2, 2, 3, FILL|EXPAND, SHRINK);
|
||||
}
|
||||
|
||||
get_vbox()->set_border_width (12);
|
||||
get_vbox()->pack_start (*table, false, false);
|
||||
|
@ -371,6 +371,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||
void remove_tempo (const TempoSection&, bool send_signal);
|
||||
void remove_meter (const MeterSection&, bool send_signal);
|
||||
|
||||
void replace_c_func_from_tempo_and_beat (const double& tempo, const double& beat);
|
||||
void replace_tempo (const TempoSection&, const Tempo&, const double& where, TempoSection::Type type);
|
||||
void replace_tempo (const TempoSection&, const Tempo&, const framepos_t& where, TempoSection::Type type);
|
||||
|
||||
|
@ -824,6 +824,30 @@ TempoMap::do_insert (MetricSection* section)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This is for a gui who needs to know the frame of a beat if a proposed tempo section were to be placed there.
|
||||
You probably shouldn't use this unless you know what you're doing,
|
||||
as it doesn't recompute the tempo map and will make a ramp invalid intil that next happens.
|
||||
It is assumed that the next frame calculation is the last time you need this c_func before the next do_insert() and/or recompute_map().
|
||||
*/
|
||||
void
|
||||
TempoMap::replace_c_func_from_tempo_and_beat (const double& bpm, const double& beat)
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
TempoSection* prev_ts = 0;
|
||||
TempoSection* t;
|
||||
|
||||
for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
|
||||
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
|
||||
if (prev_ts && t->beat() > prev_ts->beat()) {
|
||||
prev_ts->set_c_func_from_tempo_and_beat (bpm, beat, _frame_rate);
|
||||
break;
|
||||
}
|
||||
prev_ts = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const double& where, TempoSection::Type type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user