Stop passing references to things that may disappear when a metric section is replaced.
This commit is contained in:
parent
828cb52f86
commit
0bdbe56cf1
@ -3324,14 +3324,16 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
|
|||||||
_editor->begin_reversible_command (_("move tempo mark"));
|
_editor->begin_reversible_command (_("move tempo mark"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
const Tempo tempo (_marker->tempo());
|
||||||
const framepos_t frame = adjusted_current_frame (event) + 1;
|
const framepos_t frame = adjusted_current_frame (event) + 1;
|
||||||
|
const TempoSection::Type type = _real_section->type();
|
||||||
|
|
||||||
_editor->begin_reversible_command (_("copy tempo mark"));
|
_editor->begin_reversible_command (_("copy tempo mark"));
|
||||||
|
|
||||||
if (_real_section->position_lock_style() == MusicTime) {
|
if (_real_section->position_lock_style() == MusicTime) {
|
||||||
_real_section = map.add_tempo (_marker->tempo(), map.pulse_at_frame (frame), 0, _real_section->type(), MusicTime);
|
_real_section = map.add_tempo (tempo, map.pulse_at_frame (frame), 0, type, MusicTime);
|
||||||
} else {
|
} else {
|
||||||
_real_section = map.add_tempo (_marker->tempo(), 0.0, frame, _real_section->type(), AudioTime);
|
_real_section = map.add_tempo (tempo, 0.0, frame, type, AudioTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_real_section) {
|
if (!_real_section) {
|
||||||
|
@ -1391,20 +1391,30 @@ Editor::toggle_marker_lock_style ()
|
|||||||
begin_reversible_command (_("change meter lock style"));
|
begin_reversible_command (_("change meter lock style"));
|
||||||
XMLNode &before = _session->tempo_map().get_state();
|
XMLNode &before = _session->tempo_map().get_state();
|
||||||
MeterSection* msp = &mm->meter();
|
MeterSection* msp = &mm->meter();
|
||||||
|
|
||||||
|
const Meter meter (msp->divisions_per_bar(), msp->note_divisor());
|
||||||
|
const Timecode::BBT_Time bbt (msp->bbt());
|
||||||
|
const framepos_t frame = msp->frame();
|
||||||
const PositionLockStyle pls = (msp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
|
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);
|
_session->tempo_map().replace_meter (*msp, meter, bbt, frame, pls);
|
||||||
|
|
||||||
XMLNode &after = _session->tempo_map().get_state();
|
XMLNode &after = _session->tempo_map().get_state();
|
||||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||||
commit_reversible_command ();
|
commit_reversible_command ();
|
||||||
} else if (tm) {
|
} else if (tm) {
|
||||||
begin_reversible_command (_("change tempo lock style"));
|
|
||||||
XMLNode &before = _session->tempo_map().get_state();
|
|
||||||
TempoSection* tsp = &tm->tempo();
|
TempoSection* tsp = &tm->tempo();
|
||||||
|
|
||||||
|
const Tempo tempo (tsp->beats_per_minute());
|
||||||
|
const double pulse = tsp->pulse();
|
||||||
|
const framepos_t frame = tsp->frame();
|
||||||
|
const TempoSection::Type type = tsp->type();
|
||||||
const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
|
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);
|
begin_reversible_command (_("change tempo lock style"));
|
||||||
|
XMLNode &before = _session->tempo_map().get_state();
|
||||||
|
|
||||||
|
_session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, type, pls);
|
||||||
|
|
||||||
XMLNode &after = _session->tempo_map().get_state();
|
XMLNode &after = _session->tempo_map().get_state();
|
||||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||||
@ -1420,12 +1430,18 @@ Editor::toggle_tempo_type ()
|
|||||||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||||
|
|
||||||
if (tm) {
|
if (tm) {
|
||||||
|
TempoSection* tsp = &tm->tempo();
|
||||||
|
|
||||||
|
const Tempo tempo (tsp->beats_per_minute(), tsp->note_type());
|
||||||
|
const double pulse = tsp->pulse();
|
||||||
|
const framepos_t frame = tsp->frame();
|
||||||
|
const TempoSection::Type type = (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp;
|
||||||
|
const PositionLockStyle pls = tsp->position_lock_style();
|
||||||
|
|
||||||
begin_reversible_command (_("change tempo type"));
|
begin_reversible_command (_("change tempo type"));
|
||||||
XMLNode &before = _session->tempo_map().get_state();
|
XMLNode &before = _session->tempo_map().get_state();
|
||||||
TempoSection* tsp = &tm->tempo();
|
|
||||||
const TempoSection::Type type = (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp;
|
_session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, type, pls);
|
||||||
_session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->frame()
|
|
||||||
, type, tsp->position_lock_style());
|
|
||||||
|
|
||||||
XMLNode &after = _session->tempo_map().get_state();
|
XMLNode &after = _session->tempo_map().get_state();
|
||||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||||
|
@ -6557,7 +6557,8 @@ Editor::define_one_bar (framepos_t start, framepos_t end)
|
|||||||
} else if (t.frame() == start) {
|
} else if (t.frame() == start) {
|
||||||
_session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
|
_session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type());
|
||||||
} else {
|
} else {
|
||||||
_session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), 0.0, start, TempoSection::Constant, AudioTime);
|
const Tempo tempo (beats_per_minute, t.note_type());
|
||||||
|
_session->tempo_map().add_tempo (tempo, 0.0, start, TempoSection::Constant, AudioTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode& after (_session->tempo_map().get_state());
|
XMLNode& after (_session->tempo_map().get_state());
|
||||||
|
@ -409,14 +409,18 @@ Editor::edit_meter_section (MeterSection* section)
|
|||||||
bpb = max (1.0, bpb); // XXX is this a reasonable limit?
|
bpb = max (1.0, bpb); // XXX is this a reasonable limit?
|
||||||
|
|
||||||
double const note_type = meter_dialog.get_note_type ();
|
double const note_type = meter_dialog.get_note_type ();
|
||||||
|
const Meter meter (bpb, note_type);
|
||||||
|
|
||||||
Timecode::BBT_Time when;
|
Timecode::BBT_Time when;
|
||||||
meter_dialog.get_bbt_time (when);
|
meter_dialog.get_bbt_time (when);
|
||||||
|
|
||||||
framepos_t const frame = _session->tempo_map().frame_at_bbt (when);
|
framepos_t const frame = _session->tempo_map().frame_at_bbt (when);
|
||||||
|
const PositionLockStyle pls = (meter_dialog.get_lock_style() == AudioTime) ? AudioTime : MusicTime;
|
||||||
|
|
||||||
begin_reversible_command (_("replace meter mark"));
|
begin_reversible_command (_("replace meter mark"));
|
||||||
XMLNode &before = _session->tempo_map().get_state();
|
XMLNode &before = _session->tempo_map().get_state();
|
||||||
|
|
||||||
_session->tempo_map().replace_meter (*section, Meter (bpb, note_type), when, frame, meter_dialog.get_lock_style());
|
_session->tempo_map().replace_meter (*section, meter, when, frame, pls);
|
||||||
|
|
||||||
XMLNode &after = _session->tempo_map().get_state();
|
XMLNode &after = _session->tempo_map().get_state();
|
||||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||||
@ -437,21 +441,23 @@ Editor::edit_tempo_section (TempoSection* section)
|
|||||||
|
|
||||||
double bpm = tempo_dialog.get_bpm ();
|
double bpm = tempo_dialog.get_bpm ();
|
||||||
double nt = tempo_dialog.get_note_type ();
|
double nt = tempo_dialog.get_note_type ();
|
||||||
Timecode::BBT_Time when;
|
bpm = max (0.01, bpm);
|
||||||
|
const Tempo tempo (bpm, nt);
|
||||||
|
|
||||||
|
Timecode::BBT_Time when;
|
||||||
tempo_dialog.get_bbt_time (when);
|
tempo_dialog.get_bbt_time (when);
|
||||||
|
|
||||||
bpm = max (0.01, bpm);
|
const TempoSection::Type ttype (tempo_dialog.get_tempo_type());
|
||||||
|
|
||||||
begin_reversible_command (_("replace tempo mark"));
|
begin_reversible_command (_("replace tempo mark"));
|
||||||
XMLNode &before = _session->tempo_map().get_state();
|
XMLNode &before = _session->tempo_map().get_state();
|
||||||
|
|
||||||
if (tempo_dialog.get_lock_style() == AudioTime) {
|
if (tempo_dialog.get_lock_style() == AudioTime) {
|
||||||
framepos_t const f = _session->tempo_map().predict_tempo_position (section, when).second;
|
framepos_t const f = _session->tempo_map().predict_tempo_position (section, when).second;
|
||||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), 0.0, f, tempo_dialog.get_tempo_type(), AudioTime);
|
_session->tempo_map().replace_tempo (*section, tempo, 0.0, f, ttype, AudioTime);
|
||||||
} else {
|
} else {
|
||||||
double const p = _session->tempo_map().predict_tempo_position (section, when).first;
|
double const p = _session->tempo_map().predict_tempo_position (section, when).first;
|
||||||
_session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), p, 0, tempo_dialog.get_tempo_type(), MusicTime);
|
_session->tempo_map().replace_tempo (*section, tempo, p, 0, ttype, MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode &after = _session->tempo_map().get_state();
|
XMLNode &after = _session->tempo_map().get_state();
|
||||||
|
Loading…
Reference in New Issue
Block a user