diff options
author | David Robillard <d@drobilla.net> | 2015-01-07 00:12:07 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-01-07 00:12:07 -0500 |
commit | 2a251b457069ffb4b744fbd0dd7aca7acb31f381 (patch) | |
tree | 4311e63fe7ef1b5d7a5b841a4dd0eb7b26b324a7 /gtk2_ardour | |
parent | 4d202d9157bef5b6325fe54b7874080952f86a37 (diff) |
MusicalTime => Beats.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/edit_note_dialog.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 42 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 20 | ||||
-rw-r--r-- | gtk2_ardour/hit.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_cut_buffer.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_cut_buffer.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/midi_list_editor.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/midi_list_editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 152 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.h | 50 | ||||
-rw-r--r-- | gtk2_ardour/note.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/note_base.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/note_player.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/patch_change_dialog.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/patch_change_dialog.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/quantize_dialog.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/step_editor.cc | 32 | ||||
-rw-r--r-- | gtk2_ardour/step_editor.h | 16 | ||||
-rw-r--r-- | gtk2_ardour/step_entry.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/step_entry.h | 4 |
23 files changed, 200 insertions, 200 deletions
diff --git a/gtk2_ardour/edit_note_dialog.cc b/gtk2_ardour/edit_note_dialog.cc index 5f8add9ffd..0568468d63 100644 --- a/gtk2_ardour/edit_note_dialog.cc +++ b/gtk2_ardour/edit_note_dialog.cc @@ -116,8 +116,8 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n) int test_channel = (*_events.begin())->note()->channel (); int test_pitch = (*_events.begin())->note()->note (); int test_velocity = (*_events.begin())->note()->velocity (); - Evoral::MusicalTime test_time = (*_events.begin())->note()->time (); - Evoral::MusicalTime test_length = (*_events.begin())->note()->length (); + Evoral::Beats test_time = (*_events.begin())->note()->time (); + Evoral::Beats test_length = (*_events.begin())->note()->length (); for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) { if ((*i)->note()->channel() != test_channel) { @@ -193,7 +193,7 @@ EditNoteDialog::done (int r) } } - Evoral::MusicalTime const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ()); + Evoral::Beats const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ()); if (!_time_all.get_sensitive() || _time_all.get_active ()) { for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) { @@ -204,7 +204,7 @@ EditNoteDialog::done (int r) } } - Evoral::MusicalTime const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ()); + Evoral::Beats const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ()); if (!_length_all.get_sensitive() || _length_all.get_active ()) { for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) { diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 019d2f91e8..217d55bb9a 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4001,71 +4001,71 @@ Editor::get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t durat return offset; } -Evoral::MusicalTime +Evoral::Beats Editor::get_grid_type_as_beats (bool& success, framepos_t position) { success = true; switch (_snap_type) { case SnapToBeat: - return Evoral::MusicalTime(1.0); + return Evoral::Beats(1.0); break; case SnapToBeatDiv128: - return Evoral::MusicalTime(1.0/128.0); + return Evoral::Beats(1.0/128.0); break; case SnapToBeatDiv64: - return Evoral::MusicalTime(1.0/64.0); + return Evoral::Beats(1.0/64.0); break; case SnapToBeatDiv32: - return Evoral::MusicalTime(1.0/32.0); + return Evoral::Beats(1.0/32.0); break; case SnapToBeatDiv28: - return Evoral::MusicalTime(1.0/28.0); + return Evoral::Beats(1.0/28.0); break; case SnapToBeatDiv24: - return Evoral::MusicalTime(1.0/24.0); + return Evoral::Beats(1.0/24.0); break; case SnapToBeatDiv20: - return Evoral::MusicalTime(1.0/20.0); + return Evoral::Beats(1.0/20.0); break; case SnapToBeatDiv16: - return Evoral::MusicalTime(1.0/16.0); + return Evoral::Beats(1.0/16.0); break; case SnapToBeatDiv14: - return Evoral::MusicalTime(1.0/14.0); + return Evoral::Beats(1.0/14.0); break; case SnapToBeatDiv12: - return Evoral::MusicalTime(1.0/12.0); + return Evoral::Beats(1.0/12.0); break; case SnapToBeatDiv10: - return Evoral::MusicalTime(1.0/10.0); + return Evoral::Beats(1.0/10.0); break; case SnapToBeatDiv8: - return Evoral::MusicalTime(1.0/8.0); + return Evoral::Beats(1.0/8.0); break; case SnapToBeatDiv7: - return Evoral::MusicalTime(1.0/7.0); + return Evoral::Beats(1.0/7.0); break; case SnapToBeatDiv6: - return Evoral::MusicalTime(1.0/6.0); + return Evoral::Beats(1.0/6.0); break; case SnapToBeatDiv5: - return Evoral::MusicalTime(1.0/5.0); + return Evoral::Beats(1.0/5.0); break; case SnapToBeatDiv4: - return Evoral::MusicalTime(1.0/4.0); + return Evoral::Beats(1.0/4.0); break; case SnapToBeatDiv3: - return Evoral::MusicalTime(1.0/3.0); + return Evoral::Beats(1.0/3.0); break; case SnapToBeatDiv2: - return Evoral::MusicalTime(1.0/2.0); + return Evoral::Beats(1.0/2.0); break; case SnapToBar: if (_session) { - return Evoral::MusicalTime(_session->tempo_map().meter_at (position).divisions_per_bar()); + return Evoral::Beats(_session->tempo_map().meter_at (position).divisions_per_bar()); } break; @@ -4084,7 +4084,7 @@ Editor::get_grid_type_as_beats (bool& success, framepos_t position) break; } - return Evoral::MusicalTime(); + return Evoral::Beats(); } framecnt_t diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 655782e269..83b1a074e2 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -315,7 +315,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next); framecnt_t get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration); - Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position); + Evoral::Beats get_grid_type_as_beats (bool& success, framepos_t position); void nudge_forward (bool next, bool force_playhead); void nudge_backward (bool next, bool force_playhead); @@ -1172,7 +1172,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void cut_copy (Editing::CutCopyOp); bool can_cut_copy () const; - void cut_copy_points (Editing::CutCopyOp, Evoral::MusicalTime earliest=Evoral::MusicalTime(), bool midi=false); + void cut_copy_points (Editing::CutCopyOp, Evoral::Beats earliest=Evoral::Beats(), bool midi=false); void cut_copy_regions (Editing::CutCopyOp, RegionSelection&); void cut_copy_ranges (Editing::CutCopyOp); void cut_copy_midi (Editing::CutCopyOp); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 965092e65f..9cf0f05b60 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -5229,9 +5229,9 @@ framecnt_t NoteCreateDrag::grid_frames (framepos_t t) const { bool success; - Evoral::MusicalTime grid_beats = _editor->get_grid_type_as_beats (success, t); + Evoral::Beats grid_beats = _editor->get_grid_type_as_beats (success, t); if (!success) { - grid_beats = Evoral::MusicalTime(1); + grid_beats = Evoral::Beats(1); } return _region_view->region_beats_to_region_frames (grid_beats); @@ -5288,13 +5288,13 @@ NoteCreateDrag::finished (GdkEvent*, bool had_movement) framecnt_t length = (framecnt_t) fabs ((double)(_note[0] - _note[1])); framecnt_t const g = grid_frames (start); - Evoral::MusicalTime const one_tick = Evoral::MusicalTime::ticks(1); + Evoral::Beats const one_tick = Evoral::Beats::ticks(1); if (_editor->snap_mode() == SnapNormal && length < g) { length = g; } - Evoral::MusicalTime length_beats = max ( + Evoral::Beats length_beats = max ( one_tick, _region_view->region_frames_to_region_beats (length) - one_tick); _region_view->create_note_at (start, _drag_rect->y0(), length_beats, false); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 7c8d3efb73..529a524d8c 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3968,7 +3968,7 @@ struct AutomationRecord { * @param op Operation (Cut, Copy or Clear) */ void -Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::MusicalTime earliest, bool midi) +Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::Beats earliest, bool midi) { if (selection->points.empty ()) { return; @@ -4010,7 +4010,7 @@ Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::MusicalTime earliest, bo lists[al].copy->fast_simple_add ((*j)->when, (*j)->value); if (midi) { /* Update earliest MIDI start time in beats */ - earliest = std::min(earliest, Evoral::MusicalTime((*j)->when)); + earliest = std::min(earliest, Evoral::Beats((*j)->when)); } else { /* Update earliest session start time in frames */ start = std::min(start, (*i)->line().session_position(j)); @@ -4019,8 +4019,8 @@ Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::MusicalTime earliest, bo /* Snap start time backwards, so copy/paste is snap aligned. */ if (midi) { - if (earliest == Evoral::MusicalTime::max()) { - earliest = Evoral::MusicalTime(); // Weird... don't offset + if (earliest == Evoral::Beats::max()) { + earliest = Evoral::Beats(); // Weird... don't offset } earliest.round_down_to_beat(); } else { @@ -4073,7 +4073,7 @@ Editor::cut_copy_points (Editing::CutCopyOp op, Evoral::MusicalTime earliest, bo void Editor::cut_copy_midi (CutCopyOp op) { - Evoral::MusicalTime earliest = Evoral::MusicalTime::max(); + Evoral::Beats earliest = Evoral::Beats::max(); for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) { MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i); if (mrv) { @@ -4919,14 +4919,14 @@ Editor::strip_region_silence () Command* Editor::apply_midi_note_edit_op_to_region (MidiOperator& op, MidiRegionView& mrv) { - Evoral::Sequence<Evoral::MusicalTime>::Notes selected; + Evoral::Sequence<Evoral::Beats>::Notes selected; mrv.selection_as_notelist (selected, true); - vector<Evoral::Sequence<Evoral::MusicalTime>::Notes> v; + vector<Evoral::Sequence<Evoral::Beats>::Notes> v; v.push_back (selected); - framepos_t pos_frames = mrv.midi_region()->position() - mrv.midi_region()->start(); - Evoral::MusicalTime pos_beats = _session->tempo_map().framewalk_to_beats(0, pos_frames); + framepos_t pos_frames = mrv.midi_region()->position() - mrv.midi_region()->start(); + Evoral::Beats pos_beats = _session->tempo_map().framewalk_to_beats(0, pos_frames); return op (mrv.midi_region()->model(), pos_beats, v); } @@ -5093,7 +5093,7 @@ Editor::insert_patch_change (bool from_context) */ MidiRegionView* first = dynamic_cast<MidiRegionView*> (rs.front ()); - Evoral::PatchChange<Evoral::MusicalTime> empty (Evoral::MusicalTime(), 0, 0, 0); + Evoral::PatchChange<Evoral::Beats> empty (Evoral::Beats(), 0, 0, 0); PatchChangeDialog d (0, _session, empty, first->instrument_info(), Gtk::Stock::ADD); if (d.run() == RESPONSE_CANCEL) { diff --git a/gtk2_ardour/hit.h b/gtk2_ardour/hit.h index c19bd49c37..ea3e91bf2d 100644 --- a/gtk2_ardour/hit.h +++ b/gtk2_ardour/hit.h @@ -30,7 +30,7 @@ namespace ArdourCanvas { class Hit : public NoteBase { public: - typedef Evoral::Note<Evoral::MusicalTime> NoteType; + typedef Evoral::Note<Evoral::Beats> NoteType; Hit (MidiRegionView& region, ArdourCanvas::Item* parent, diff --git a/gtk2_ardour/midi_cut_buffer.cc b/gtk2_ardour/midi_cut_buffer.cc index 94a21ed830..171eea823e 100644 --- a/gtk2_ardour/midi_cut_buffer.cc +++ b/gtk2_ardour/midi_cut_buffer.cc @@ -21,7 +21,7 @@ using namespace ARDOUR; MidiCutBuffer::MidiCutBuffer (Session* s) - : AutomatableSequence<Evoral::MusicalTime> (*s) + : AutomatableSequence<Evoral::Beats> (*s) , _origin (0) { diff --git a/gtk2_ardour/midi_cut_buffer.h b/gtk2_ardour/midi_cut_buffer.h index bfd31fb270..8c92b9a442 100644 --- a/gtk2_ardour/midi_cut_buffer.h +++ b/gtk2_ardour/midi_cut_buffer.h @@ -27,10 +27,10 @@ namespace ARDOUR { class Session; } -class MidiCutBuffer : public ARDOUR::AutomatableSequence<Evoral::MusicalTime> +class MidiCutBuffer : public ARDOUR::AutomatableSequence<Evoral::Beats> { public: - typedef Evoral::MusicalTime TimeType; + typedef Evoral::Beats TimeType; MidiCutBuffer (ARDOUR::Session*); ~MidiCutBuffer(); diff --git a/gtk2_ardour/midi_list_editor.cc b/gtk2_ardour/midi_list_editor.cc index ab282f2a23..4c7a30cdd9 100644 --- a/gtk2_ardour/midi_list_editor.cc +++ b/gtk2_ardour/midi_list_editor.cc @@ -292,7 +292,7 @@ MidiListEditor::scroll_event (GdkEventScroll* ev) if (note->time() + fdelta >= 0) { cmd->change (note, prop, note->time() + fdelta); } else { - cmd->change (note, prop, Evoral::MusicalTime()); + cmd->change (note, prop, Evoral::Beats()); } break; case MidiModel::NoteDiffCommand::Velocity: @@ -300,10 +300,10 @@ MidiListEditor::scroll_event (GdkEventScroll* ev) break; case MidiModel::NoteDiffCommand::Length: if (note->length().to_double() + fdelta >= - Evoral::MusicalTime::tick().to_double()) { + Evoral::Beats::tick().to_double()) { cmd->change (note, prop, note->length() + fdelta); } else { - cmd->change (note, prop, Evoral::MusicalTime::tick()); + cmd->change (note, prop, Evoral::Beats::tick()); } break; case MidiModel::NoteDiffCommand::Channel: @@ -335,7 +335,7 @@ MidiListEditor::scroll_event (GdkEventScroll* ev) if (note->time() + fdelta >= 0) { cmd->change (note, prop, note->time() + fdelta); } else { - cmd->change (note, prop, Evoral::MusicalTime()); + cmd->change (note, prop, Evoral::Beats()); } break; case MidiModel::NoteDiffCommand::Velocity: @@ -343,10 +343,10 @@ MidiListEditor::scroll_event (GdkEventScroll* ev) break; case MidiModel::NoteDiffCommand::Length: if (note->length() + fdelta >= - Evoral::MusicalTime::tick().to_double()) { + Evoral::Beats::tick().to_double()) { cmd->change (note, prop, note->length() + fdelta); } else { - cmd->change (note, prop, Evoral::MusicalTime::tick()); + cmd->change (note, prop, Evoral::Beats::tick()); } break; case MidiModel::NoteDiffCommand::Channel: @@ -773,7 +773,7 @@ MidiListEditor::redisplay_model () row[columns.start] = ss.str(); bbt.bars = 0; - const Evoral::MusicalTime dur = (*i)->end_time() - (*i)->time(); + const Evoral::Beats dur = (*i)->end_time() - (*i)->time(); bbt.beats = dur.get_beats (); bbt.ticks = dur.get_ticks (); diff --git a/gtk2_ardour/midi_list_editor.h b/gtk2_ardour/midi_list_editor.h index f8d2ce9432..9ff413946c 100644 --- a/gtk2_ardour/midi_list_editor.h +++ b/gtk2_ardour/midi_list_editor.h @@ -45,7 +45,7 @@ namespace ARDOUR { class MidiListEditor : public ArdourWindow { public: - typedef Evoral::Note<Evoral::MusicalTime> NoteType; + typedef Evoral::Note<Evoral::Beats> NoteType; MidiListEditor(ARDOUR::Session*, boost::shared_ptr<ARDOUR::MidiRegion>, boost::shared_ptr<ARDOUR::MidiTrack>); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 95f572072e..eedf67836e 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -547,12 +547,12 @@ MidiRegionView::button_release (GdkEventButton* ev) event_y = ev->y; group->canvas_to_item (event_x, event_y); - Evoral::MusicalTime beats = get_grid_beats(editor.pixel_to_sample(event_x)); + Evoral::Beats beats = get_grid_beats(editor.pixel_to_sample(event_x)); /* Shorten the length by 1 tick so that we can add a new note at the next grid snap without it overlapping this one. */ - beats -= Evoral::MusicalTime::tick(); + beats -= Evoral::Beats::tick(); create_note_at (editor.pixel_to_sample (event_x), event_y, beats, true); } @@ -561,12 +561,12 @@ MidiRegionView::button_release (GdkEventButton* ev) } case MouseDraw: { - Evoral::MusicalTime beats = get_grid_beats(editor.pixel_to_sample(event_x)); + Evoral::Beats beats = get_grid_beats(editor.pixel_to_sample(event_x)); /* Shorten the length by 1 tick so that we can add a new note at the next grid snap without it overlapping this one. */ - beats -= Evoral::MusicalTime::tick(); + beats -= Evoral::Beats::tick(); create_note_at (editor.pixel_to_sample (event_x), event_y, beats, true); @@ -732,7 +732,7 @@ MidiRegionView::key_press (GdkEventKey* ev) bool shorter = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier); bool fine = Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier); - change_note_lengths (fine, shorter, Evoral::MusicalTime(), start, end); + change_note_lengths (fine, shorter, Evoral::Beats(), start, end); return true; @@ -915,7 +915,7 @@ MidiRegionView::show_list_editor () * \param snap_t true to snap t to the grid, otherwise false. */ void -MidiRegionView::create_note_at (framepos_t t, double y, Evoral::MusicalTime length, bool snap_t) +MidiRegionView::create_note_at (framepos_t t, double y, Evoral::Beats length, bool snap_t) { if (length < 2 * DBL_EPSILON) { return; @@ -1033,7 +1033,7 @@ MidiRegionView::note_diff_add_change (NoteBase* ev, void MidiRegionView::note_diff_add_change (NoteBase* ev, MidiModel::NoteDiffCommand::Property property, - Evoral::MusicalTime val) + Evoral::Beats val) { if (_note_diff_command) { _note_diff_command->change (ev->note(), property, val); @@ -1101,7 +1101,7 @@ MidiRegionView::find_canvas_note (boost::shared_ptr<NoteType> note) } void -MidiRegionView::get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask) +MidiRegionView::get_events (Events& e, Evoral::Sequence<Evoral::Beats>::NoteOperator op, uint8_t val, int chan_mask) { MidiModel::Notes notes; _model->get_notes (notes, op, val, chan_mask); @@ -1259,8 +1259,8 @@ MidiRegionView::display_sysexes() if (!ARDOUR_UI::config()->get_never_display_periodic_midi()) { for (MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) { - const boost::shared_ptr<const Evoral::MIDIEvent<Evoral::MusicalTime> > mev = - boost::static_pointer_cast<const Evoral::MIDIEvent<Evoral::MusicalTime> > (*i); + const boost::shared_ptr<const Evoral::MIDIEvent<Evoral::Beats> > mev = + boost::static_pointer_cast<const Evoral::MIDIEvent<Evoral::Beats> > (*i); if (mev) { if (mev->is_spp() || mev->is_mtc_quarter() || mev->is_mtc_full()) { @@ -1292,10 +1292,10 @@ MidiRegionView::display_sysexes() for (MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) { - const boost::shared_ptr<const Evoral::MIDIEvent<Evoral::MusicalTime> > mev = - boost::static_pointer_cast<const Evoral::MIDIEvent<Evoral::MusicalTime> > (*i); + const boost::shared_ptr<const Evoral::MIDIEvent<Evoral::Beats> > mev = + boost::static_pointer_cast<const Evoral::MIDIEvent<Evoral::Beats> > (*i); - Evoral::MusicalTime time = (*i)->time(); + Evoral::Beats time = (*i)->time(); if (mev) { if (mev->is_spp() || mev->is_mtc_quarter() || mev->is_mtc_full()) { @@ -1529,7 +1529,7 @@ MidiRegionView::end_write() /** Resolve an active MIDI note (while recording). */ void -MidiRegionView::resolve_note(uint8_t note, Evoral::MusicalTime end_time) +MidiRegionView::resolve_note(uint8_t note, Evoral::Beats end_time) { if (midi_view()->note_mode() != Sustained) { return; @@ -1797,7 +1797,7 @@ MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible) void MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity, - Evoral::MusicalTime pos, Evoral::MusicalTime len) + Evoral::Beats pos, Evoral::Beats len) { boost::shared_ptr<NoteType> new_note (new NoteType (channel, pos, len, number, velocity)); @@ -1826,7 +1826,7 @@ MidiRegionView::step_add_note (uint8_t channel, uint8_t number, uint8_t velocity } void -MidiRegionView::step_sustain (Evoral::MusicalTime beats) +MidiRegionView::step_sustain (Evoral::Beats beats) { change_note_lengths (false, false, beats, false, true); } @@ -1879,13 +1879,13 @@ MidiRegionView::patch_change_to_patch_key (MidiModel::PatchChangePtr p) /// Return true iff @p pc applies to the given time on the given channel. static bool -patch_applies (const ARDOUR::MidiModel::constPatchChangePtr pc, Evoral::MusicalTime time, uint8_t channel) +patch_applies (const ARDOUR::MidiModel::constPatchChangePtr pc, Evoral::Beats time, uint8_t channel) { return pc->time() <= time && pc->channel() == channel; } void -MidiRegionView::get_patch_key_at (Evoral::MusicalTime time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const +MidiRegionView::get_patch_key_at (Evoral::Beats time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const { // The earliest event not before time MidiModel::PatchChanges::iterator i = _model->patch_change_lower_bound (time); @@ -1927,7 +1927,7 @@ MidiRegionView::change_patch_change (PatchChange& pc, const MIDI::Name::PatchPri } void -MidiRegionView::change_patch_change (MidiModel::PatchChangePtr old_change, const Evoral::PatchChange<Evoral::MusicalTime> & new_change) +MidiRegionView::change_patch_change (MidiModel::PatchChangePtr old_change, const Evoral::PatchChange<Evoral::Beats> & new_change) { MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("alter patch change")); @@ -1959,13 +1959,13 @@ MidiRegionView::change_patch_change (MidiModel::PatchChangePtr old_change, const * MidiTimeAxisView::get_channel_for_add()) */ void -MidiRegionView::add_patch_change (framecnt_t t, Evoral::PatchChange<Evoral::MusicalTime> const & patch) +MidiRegionView::add_patch_change (framecnt_t t, Evoral::PatchChange<Evoral::Beats> const & patch) { MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview); MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("add patch change")); c->add (MidiModel::PatchChangePtr ( - new Evoral::PatchChange<Evoral::MusicalTime> ( + new Evoral::PatchChange<Evoral::Beats> ( absolute_frames_to_source_beats (_region->position() + t), mtv->get_channel_for_add(), patch.program(), patch.bank() ) @@ -1979,7 +1979,7 @@ MidiRegionView::add_patch_change (framecnt_t t, Evoral::PatchChange<Evoral::Musi } void -MidiRegionView::move_patch_change (PatchChange& pc, Evoral::MusicalTime t) +MidiRegionView::move_patch_change (PatchChange& pc, Evoral::Beats t) { MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("move patch change")); c->change_time (pc.patch (), t); @@ -2259,8 +2259,8 @@ MidiRegionView::note_selected (NoteBase* ev, bool add, bool extend) } else { /* find end of latest note selected, select all between that and the start of "ev" */ - Evoral::MusicalTime earliest = Evoral::MaxMusicalTime; - Evoral::MusicalTime latest = Evoral::MusicalTime(); + Evoral::Beats earliest = Evoral::MaxBeats; + Evoral::Beats latest = Evoral::Beats(); for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { if ((*i)->note()->end_time() > latest) { @@ -2418,7 +2418,7 @@ MidiRegionView::move_selection(double dx, double dy, double cumulative_dy) { typedef vector<boost::shared_ptr<NoteType> > PossibleChord; PossibleChord to_play; - Evoral::MusicalTime earliest = Evoral::MaxMusicalTime; + Evoral::Beats earliest = Evoral::MaxBeats; for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { if ((*i)->note()->time() < earliest) { @@ -2491,7 +2491,7 @@ MidiRegionView::note_dropped(NoteBase *, frameoffset_t dt, int8_t dnote) for (Selection::iterator i = _selection.begin(); i != _selection.end() ; ++i) { framepos_t new_frames = source_beats_to_absolute_frames ((*i)->note()->time()) + dt; - Evoral::MusicalTime new_time = absolute_frames_to_source_beats (new_frames); + Evoral::Beats new_time = absolute_frames_to_source_beats (new_frames); if (new_time < 0) { continue; @@ -2554,7 +2554,7 @@ MidiRegionView::get_end_position_pixels() } framepos_t -MidiRegionView::source_beats_to_absolute_frames(Evoral::MusicalTime beats) const +MidiRegionView::source_beats_to_absolute_frames(Evoral::Beats beats) const { /* the time converter will return the frame corresponding to `beats' relative to the start of the source. The start of the source @@ -2564,7 +2564,7 @@ MidiRegionView::source_beats_to_absolute_frames(Evoral::MusicalTime beats) const return source_start + _source_relative_time_converter.to (beats); } -Evoral::MusicalTime +Evoral::Beats MidiRegionView::absolute_frames_to_source_beats(framepos_t frames) const { /* the `frames' argument needs to be converted into a frame count @@ -2576,12 +2576,12 @@ MidiRegionView::absolute_frames_to_source_beats(framepos_t frames) const } framepos_t -MidiRegionView::region_beats_to_region_frames(Evoral::MusicalTime beats) const +MidiRegionView::region_beats_to_region_frames(Evoral::Beats beats) const { return _region_relative_time_converter.to(beats); } -Evoral::MusicalTime +Evoral::Beats MidiRegionView::region_frames_to_region_beats(framepos_t frames) const { return _region_relative_time_converter.from(frames); @@ -2678,9 +2678,9 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_ } if (!cursor_set) { - const double snapped_x = snap_pixel_to_sample (current_x); - Evoral::MusicalTime beats = region_frames_to_region_beats (snapped_x); - Evoral::MusicalTime len = Evoral::MusicalTime(); + const double snapped_x = snap_pixel_to_sample (current_x); + Evoral::Beats beats = region_frames_to_region_beats (snapped_x); + Evoral::Beats len = Evoral::Beats(); if (at_front) { if (beats < canvas_note->note()->end_time()) { @@ -2747,12 +2747,12 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_ current_x = snap_pixel_to_sample (current_x) + _region->start (); /* and then to beats */ - const Evoral::MusicalTime x_beats = region_frames_to_region_beats (current_x); + const Evoral::Beats x_beats = region_frames_to_region_beats (current_x); if (at_front && x_beats < canvas_note->note()->end_time()) { note_diff_add_change (canvas_note, MidiModel::NoteDiffCommand::StartTime, x_beats); - Evoral::MusicalTime len = canvas_note->note()->time() - x_beats; + Evoral::Beats len = canvas_note->note()->time() - x_beats; len += canvas_note->note()->length(); if (!!len) { @@ -2761,7 +2761,7 @@ MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_ } if (!at_front) { - const Evoral::MusicalTime len = x_beats - canvas_note->note()->time(); + const Evoral::Beats len = x_beats - canvas_note->note()->time(); if (!!len) { /* XXX convert to beats */ @@ -2821,12 +2821,12 @@ MidiRegionView::change_note_note (NoteBase* event, int8_t note, bool relative) } void -MidiRegionView::trim_note (NoteBase* event, Evoral::MusicalTime front_delta, Evoral::MusicalTime end_delta) +MidiRegionView::trim_note (NoteBase* event, Evoral::Beats front_delta, Evoral::Beats end_delta) { bool change_start = false; bool change_length = false; - Evoral::MusicalTime new_start; - Evoral::MusicalTime new_length; + Evoral::Beats new_start; + Evoral::Beats new_length; /* NOTE: the semantics of the two delta arguments are slightly subtle: @@ -2841,7 +2841,7 @@ MidiRegionView::trim_note (NoteBase* event, Evoral::MusicalTime front_delta, Evo if (front_delta < 0) { if (event->note()->time() < -front_delta) { - new_start = Evoral::MusicalTime(); + new_start = Evoral::Beats(); } else { new_start = event->note()->time() + front_delta; // moves earlier } @@ -2856,7 +2856,7 @@ MidiRegionView::trim_note (NoteBase* event, Evoral::MusicalTime front_delta, Evo } else { - Evoral::MusicalTime new_pos = event->note()->time() + front_delta; + Evoral::Beats new_pos = event->note()->time() + front_delta; if (new_pos < event->note()->end_time()) { new_start = event->note()->time() + front_delta; @@ -2915,14 +2915,14 @@ MidiRegionView::change_note_channel (NoteBase* event, int8_t chn, bool relative) } void -MidiRegionView::change_note_time (NoteBase* event, Evoral::MusicalTime delta, bool relative) +MidiRegionView::change_note_time (NoteBase* event, Evoral::Beats delta, bool relative) { - Evoral::MusicalTime new_time; + Evoral::Beats new_time; if (relative) { if (delta < 0.0) { if (event->note()->time() < -delta) { - new_time = Evoral::MusicalTime(); + new_time = Evoral::Beats(); } else { new_time = event->note()->time() + delta; } @@ -2937,7 +2937,7 @@ MidiRegionView::change_note_time (NoteBase* event, Evoral::MusicalTime delta, bo } void -MidiRegionView::change_note_length (NoteBase* event, Evoral::MusicalTime t) +MidiRegionView::change_note_length (NoteBase* event, Evoral::Beats t) { note_diff_add_change (event, MidiModel::NoteDiffCommand::Length, t); } @@ -3049,11 +3049,11 @@ MidiRegionView::transpose (bool up, bool fine, bool allow_smush) } void -MidiRegionView::change_note_lengths (bool fine, bool shorter, Evoral::MusicalTime delta, bool start, bool end) +MidiRegionView::change_note_lengths (bool fine, bool shorter, Evoral::Beats delta, bool start, bool end) { if (!delta) { if (fine) { - delta = Evoral::MusicalTime(1.0/128.0); + delta = Evoral::Beats(1.0/128.0); } else { /* grab the current grid distance */ delta = get_grid_beats(_region->position()); @@ -3073,8 +3073,8 @@ MidiRegionView::change_note_lengths (bool fine, bool shorter, Evoral::MusicalTim /* note the negation of the delta for start */ trim_note (*i, - (start ? -delta : Evoral::MusicalTime()), - (end ? delta : Evoral::MusicalTime())); + (start ? -delta : Evoral::Beats()), + (end ? delta : Evoral::Beats())); i = next; } @@ -3094,13 +3094,13 @@ MidiRegionView::nudge_notes (bool forward, bool fine) into a vector and sort before using the first one. */ - const framepos_t ref_point = source_beats_to_absolute_frames ((*(_selection.begin()))->note()->time()); - Evoral::MusicalTime delta; + const framepos_t ref_point = source_beats_to_absolute_frames ((*(_selection.begin()))->note()->time()); + Evoral::Beats delta; if (!fine) { /* non-fine, move by 1 bar regardless of snap */ - delta = Evoral::MusicalTime(trackview.session()->tempo_map().meter_at(ref_point).divisions_per_bar()); + delta = Evoral::Beats(trackview.session()->tempo_map().meter_at(ref_point).divisions_per_bar()); } else if (trackview.editor().snap_mode() == Editing::SnapOff) { @@ -3378,14 +3378,14 @@ MidiRegionView::paste_internal (framepos_t pos, unsigned paste_count, float time start_note_diff_command (_("paste")); - const Evoral::MusicalTime snap_beats = get_grid_beats(pos); - const Evoral::MusicalTime first_time = (*mcb.notes().begin())->time(); - const Evoral::MusicalTime last_time = (*mcb.notes().rbegin())->end_time(); - const Evoral::MusicalTime duration = last_time - first_time; - const Evoral::MusicalTime snap_duration = duration.snap_to(snap_beats); - const Evoral::MusicalTime paste_offset = snap_duration * paste_count; - const Evoral::MusicalTime pos_beats = absolute_frames_to_source_beats(pos) + paste_offset; - Evoral::MusicalTime end_point = Evoral::MusicalTime(); + const Evoral::Beats snap_beats = get_grid_beats(pos); + const Evoral::Beats first_time = (*mcb.notes().begin())->time(); + const Evoral::Beats last_time = (*mcb.notes().rbegin())->end_time(); + const Evoral::Beats duration = last_time - first_time; + const Evoral::Beats snap_duration = duration.snap_to(snap_beats); + const Evoral::Beats paste_offset = snap_duration * paste_count; + const Evoral::Beats pos_beats = absolute_frames_to_source_beats(pos) + paste_offset; + Evoral::Beats end_point = Evoral::Beats(); DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("Paste data spans from %1 to %2 (%3) ; paste pos beats = %4 (based on %5 - %6)\n", first_time, @@ -3559,9 +3559,9 @@ MidiRegionView::update_ghost_note (double x, double y) framepos_t const f = snap_frame_to_grid_underneath (unsnapped_frame, grid_frames); /* calculate time in beats relative to start of source */ - const Evoral::MusicalTime length = get_grid_beats(unsnapped_frame); - const Evoral::MusicalTime time = std::max( - Evoral::MusicalTime(), + const Evoral::Beats length = get_grid_beats(unsnapped_frame); + const Evoral::Beats time = std::max( + Evoral::Beats(), absolute_frames_to_source_beats (f + _region->position ())); _ghost_note->note()->set_time (time); @@ -3630,9 +3630,9 @@ MidiRegionView::maybe_select_by_position (GdkEventButton* ev, double /*x*/, doub uint16_t chn_mask = mtv->midi_track()->get_playback_channel_mask(); if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { - get_events (e, Evoral::Sequence<Evoral::MusicalTime>::PitchGreaterThanOrEqual, (uint8_t) floor (note), chn_mask); + get_events (e, Evoral::Sequence<Evoral::Beats>::PitchGreaterThanOrEqual, (uint8_t) floor (note), chn_mask); } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { - get_events (e, Evoral::Sequence<Evoral::MusicalTime>::PitchLessThanOrEqual, (uint8_t) floor (note), chn_mask); + get_events (e, Evoral::Sequence<Evoral::Beats>::PitchLessThanOrEqual, (uint8_t) floor (note), chn_mask); } else { return; } @@ -3677,7 +3677,7 @@ MidiRegionView::enable_display (bool yn) } void -MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos) +MidiRegionView::show_step_edit_cursor (Evoral::Beats pos) { if (_step_edit_cursor == 0) { ArdourCanvas::Item* const group = get_canvas_group(); @@ -3694,7 +3694,7 @@ MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos) } void -MidiRegionView::move_step_edit_cursor (Evoral::MusicalTime pos) +MidiRegionView::move_step_edit_cursor (Evoral::Beats pos) { _step_edit_cursor_position = pos; @@ -3714,7 +3714,7 @@ MidiRegionView::hide_step_edit_cursor () } void -MidiRegionView::set_step_edit_cursor_width (Evoral::MusicalTime beats) +MidiRegionView::set_step_edit_cursor_width (Evoral::Beats beats) { _step_edit_cursor_width = beats; @@ -3758,12 +3758,12 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w) } /* convert from session frames to source beats */ - Evoral::MusicalTime const time_beats = _source_relative_time_converter.from( + Evoral::Beats const time_beats = _source_relative_time_converter.from( ev.time() - src->timeline_position() + _region->start()); if (ev.type() == MIDI_CMD_NOTE_ON) { boost::shared_ptr<NoteType> note ( - new NoteType (ev.channel(), time_beats, Evoral::MusicalTime(), ev.note(), ev.velocity())); + new NoteType (ev.channel(), time_beats, Evoral::Beats(), ev.note(), ev.velocity())); add_note (note, true); @@ -3916,7 +3916,7 @@ MidiRegionView::snap_frame_to_grid_underneath (framepos_t p, framecnt_t& grid_fr { PublicEditor& editor = trackview.editor (); - const Evoral::MusicalTime grid_beats = get_grid_beats(p); + const Evoral::Beats grid_beats = get_grid_beats(p); grid_frames = region_beats_to_region_frames (grid_beats); @@ -3965,14 +3965,14 @@ MidiRegionView::get_selected_channels () const } -Evoral::MusicalTime +Evoral::Beats MidiRegionView::get_grid_beats(framepos_t pos) const { - PublicEditor& editor = trackview.editor(); - bool success = false; - Evoral::MusicalTime beats = editor.get_grid_type_as_beats(success, pos); + PublicEditor& editor = trackview.editor(); + bool success = false; + Evoral::Beats beats = editor.get_grid_type_as_beats(success, pos); if (!success) { - beats = Evoral::MusicalTime(1); + beats = Evoral::Beats(1); } return beats; } diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 02d67e6d64..4f64e4410f 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -66,8 +66,8 @@ class CursorContext; class MidiRegionView : public RegionView { public: - typedef Evoral::Note<Evoral::MusicalTime> NoteType; - typedef Evoral::Sequence<Evoral::MusicalTime>::Notes Notes; + typedef Evoral::Note<Evoral::Beats> NoteType; + typedef Evoral::Sequence<Evoral::Beats>::Notes Notes; MidiRegionView (ArdourCanvas::Container* parent, RouteTimeAxisView& tv, @@ -100,8 +100,8 @@ public: { return midi_view()->midi_view(); } void step_add_note (uint8_t channel, uint8_t number, uint8_t velocity, - Evoral::MusicalTime pos, Evoral::MusicalTime len); - void step_sustain (Evoral::MusicalTime beats); + Evoral::Beats pos, Evoral::Beats len); + void step_sustain (Evoral::Beats beats); void set_height (double); void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false); @@ -110,17 +110,17 @@ public: uint32_t get_fill_color() const; void color_handler (); - void show_step_edit_cursor (Evoral::MusicalTime pos); - void move_step_edit_cursor (Evoral::MusicalTime pos); + void show_step_edit_cursor (Evoral::Beats pos); + void move_step_edit_cursor (Evoral::Beats pos); void hide_step_edit_cursor (); - void set_step_edit_cursor_width (Evoral::MusicalTime beats); + void set_step_edit_cursor_width (Evoral::Beats beats); void redisplay_model(); GhostRegion* add_ghost (TimeAxisView&); void add_note(const boost::shared_ptr<NoteType> note, bool visible); - void resolve_note(uint8_t note_num, Evoral::MusicalTime end_time); + void resolve_note(uint8_t note_num, Evoral::Beats end_time); void cut_copy_clear (Editing::CutCopyOp); bool paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx); @@ -134,7 +134,7 @@ public: * @key a reference to an instance of MIDI::Name::PatchPrimaryKey whose fields will * will be set according to the result of the lookup */ - void get_patch_key_at (Evoral::MusicalTime time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const; + void get_patch_key_at (Evoral::Beats time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const; /** Convert a given PatchChange into a PatchPrimaryKey */ @@ -145,10 +145,10 @@ public: * @param new_patch new patch */ void change_patch_change (PatchChange& old_patch, const MIDI::Name::PatchPrimaryKey& new_patch); - void change_patch_change (ARDOUR::MidiModel::PatchChangePtr, Evoral::PatchChange<Evoral::MusicalTime> const &); + void change_patch_change (ARDOUR::MidiModel::PatchChangePtr, Evoral::PatchChange<Evoral::Beats> const &); - void add_patch_change (framecnt_t, Evoral::PatchChange<Evoral::MusicalTime> const &); - void move_patch_change (PatchChange &, Evoral::MusicalTime); + void add_patch_change (framecnt_t, Evoral::PatchChange<Evoral::Beats> const &); + void move_patch_change (PatchChange &, Evoral::Beats); void delete_patch_change (PatchChange *); void edit_patch_change (PatchChange *); @@ -176,7 +176,7 @@ public: void start_note_diff_command (std::string name = "midi edit"); void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val); - void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Evoral::MusicalTime val); + void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Evoral::Beats val); void note_diff_add_note (const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity = false); void note_diff_remove_note (NoteBase* ev); @@ -263,22 +263,22 @@ public: framepos_t snap_pixel_to_sample(double x); /** Convert a timestamp in beats into frames (both relative to region position) */ - framepos_t region_beats_to_region_frames(Evoral::MusicalTime beats) const; + framepos_t region_beats_to_region_frames(Evoral::Beats beats) const; /** Convert a timestamp in beats into absolute frames */ - framepos_t region_beats_to_absolute_frames(Evoral::MusicalTime beats) const { + framepos_t region_beats_to_absolute_frames(Evoral::Beats beats) const { return _region->position() + region_beats_to_region_frames (beats); } /** Convert a timestamp in frames to beats (both relative to region position) */ - Evoral::MusicalTime region_frames_to_region_beats(framepos_t) const; + Evoral::Beats region_frames_to_region_beats(framepos_t) const; /** Convert a timestamp in beats measured from source start into absolute frames */ - framepos_t source_beats_to_absolute_frames(Evoral::MusicalTime beats) const; + framepos_t source_beats_to_absolute_frames(Evoral::Beats beats) const; /** Convert a timestamp in beats measured from source start into region-relative frames */ - framepos_t source_beats_to_region_frames(Evoral::MusicalTime beats) const { + framepos_t source_beats_to_region_frames(Evoral::Beats beats) const { return source_beats_to_absolute_frames (beats) - _region->position(); } /** Convert a timestamp in absolute frames to beats measured from source start*/ - Evoral::MusicalTime absolute_frames_to_source_beats(framepos_t) const; + Evoral::Beats absolute_frames_to_source_beats(framepos_t) const; ARDOUR::BeatsFramesConverter const & region_relative_time_converter () const { return _region_relative_time_converter; @@ -290,7 +290,7 @@ public: void goto_previous_note (bool add_to_selection); void goto_next_note (bool add_to_selection); - void change_note_lengths (bool, bool, Evoral::MusicalTime beats, bool start, bool end); + void change_note_lengths (bool, bool, Evoral::Beats beats, bool start, bool end); void change_velocities (bool up, bool fine, bool allow_smush, bool all_together); void transpose (bool up, bool fine, bool allow_smush); void nudge_notes (bool forward, bool fine); @@ -320,7 +320,7 @@ public: * \param length duration of the note in beats * \param snap_t true to snap t to the grid, otherwise false. */ - void create_note_at (framepos_t t, double y, Evoral::MusicalTime length, bool snap_t); + void create_note_at (framepos_t t, double y, Evoral::Beats length, bool snap_t); void clear_selection (bool signal = true) { clear_selection_except (0, signal); } @@ -414,8 +414,8 @@ private: double _last_ghost_x; double _last_ghost_y; ArdourCanvas::Rectangle* _step_edit_cursor; - Evoral::MusicalTime _step_edit_cursor_width; - Evoral::MusicalTime _step_edit_cursor_position; + Evoral::Beats _step_edit_cursor_width; + Evoral::Beats _step_edit_cursor_position; NoteBase* _channel_selection_scoped_note; /** A group used to temporarily reparent _note_group to during start trims, so @@ -477,7 +477,7 @@ private: void drop_down_keys (); void maybe_select_by_position (GdkEventButton* ev, double x, double y); - void get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask = 0); + void get_events (Events& e, Evoral::Sequence<Evoral::Beats>::NoteOperator op, uint8_t val, int chan_mask = 0); void display_patch_changes_on_channel (uint8_t, bool); @@ -485,7 +485,7 @@ private: void data_recorded (boost::weak_ptr<ARDOUR::MidiSource>); /** Get grid type as beats, or default to 1 if not snapped to beats. */ - Evoral::MusicalTime get_grid_beats(framepos_t pos) const; + Evoral::Beats get_grid_beats(framepos_t pos) const; void remove_ghost_note (); void mouse_mode_changed (); diff --git a/gtk2_ardour/note.h b/gtk2_ardour/note.h index 71faeb53fb..e763ea95f8 100644 --- a/gtk2_ardour/note.h +++ b/gtk2_ardour/note.h @@ -32,7 +32,7 @@ namespace ArdourCanvas { class Note : public NoteBase { public: - typedef Evoral::Note<Evoral::MusicalTime> NoteType; + typedef Evoral::Note<Evoral::Beats> NoteType; Note (MidiRegionView& region, ArdourCanvas::Item* parent, diff --git a/gtk2_ardour/note_base.h b/gtk2_ardour/note_base.h index 150837e193..9a135e4d9c 100644 --- a/gtk2_ardour/note_base.h +++ b/gtk2_ardour/note_base.h @@ -54,7 +54,7 @@ namespace ArdourCanvas { class NoteBase : public sigc::trackable { public: - typedef Evoral::Note<Evoral::MusicalTime> NoteType; + typedef Evoral::Note<Evoral::Beats> NoteType; NoteBase (MidiRegionView& region, bool, const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>()); virtual ~NoteBase (); diff --git a/gtk2_ardour/note_player.h b/gtk2_ardour/note_player.h index 4a1df8c319..9127842732 100644 --- a/gtk2_ardour/note_player.h +++ b/gtk2_ardour/note_player.h @@ -31,7 +31,7 @@ namespace ARDOUR { class NotePlayer : public sigc::trackable { public: - typedef Evoral::Note<Evoral::MusicalTime> NoteType; + typedef Evoral::Note<Evoral::Beats> NoteType; NotePlayer (boost::shared_ptr<ARDOUR::MidiTrack>); ~NotePlayer (); diff --git a/gtk2_ardour/patch_change_dialog.cc b/gtk2_ardour/patch_change_dialog.cc index 9072801c83..05cbaab459 100644 --- a/gtk2_ardour/patch_change_dialog.cc +++ b/gtk2_ardour/patch_change_dialog.cc @@ -41,12 +41,12 @@ using namespace Gtkmm2ext; /** @param tc If non-0, a time converter for this patch change. If 0, time control will be desensitized */ PatchChangeDialog::PatchChangeDialog ( - const ARDOUR::BeatsFramesConverter* tc, - ARDOUR::Session* session, - Evoral::PatchChange<Evoral::MusicalTime> const & patch, - ARDOUR::InstrumentInfo& info, - const Gtk::BuiltinStockID& ok, - bool allow_delete) + const ARDOUR::BeatsFramesConverter* tc, + ARDOUR::Session* session, + Evoral::PatchChange<Evoral::Beats> const & patch, + ARDOUR::InstrumentInfo& info, + const Gtk::BuiltinStockID& ok, + bool allow_delete) : ArdourDialog (_("Patch Change"), true) , _time_converter (tc) , _info (info) @@ -139,16 +139,16 @@ PatchChangeDialog::instrument_info_changed () fill_patch_combo (); } -Evoral::PatchChange<Evoral::MusicalTime> +Evoral::PatchChange<Evoral::Beats> PatchChangeDialog::patch () const { - Evoral::MusicalTime t = Evoral::MusicalTime(); + Evoral::Beats t = Evoral::Beats(); if (_time_converter) { t = _time_converter->from (_time.current_time ()); } - return Evoral::PatchChange<Evoral::MusicalTime> ( + return Evoral::PatchChange<Evoral::Beats> ( t, _channel.get_value_as_int() - 1, _program.get_value_as_int() - 1, diff --git a/gtk2_ardour/patch_change_dialog.h b/gtk2_ardour/patch_change_dialog.h index ed0f49df34..d19234d2c4 100644 --- a/gtk2_ardour/patch_change_dialog.h +++ b/gtk2_ardour/patch_change_dialog.h @@ -43,13 +43,13 @@ public: PatchChangeDialog ( const ARDOUR::BeatsFramesConverter *, ARDOUR::Session *, - Evoral::PatchChange<Evoral::MusicalTime> const &, + Evoral::PatchChange<Evoral::Beats> const &, ARDOUR::InstrumentInfo&, const Gtk::BuiltinStockID &, bool allow_delete = false ); - Evoral::PatchChange<Evoral::MusicalTime> patch () const; + Evoral::PatchChange<Evoral::Beats> patch () const; private: void fill_bank_combo (); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index c126c1bab9..974799c8c0 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -289,7 +289,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0; virtual framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next) = 0; virtual framecnt_t get_paste_offset (framepos_t pos, unsigned paste_count, framecnt_t duration) = 0; - virtual Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position) = 0; + virtual Evoral::Beats get_grid_type_as_beats (bool& success, framepos_t position) = 0; virtual void edit_notes (MidiRegionView*) = 0; virtual void queue_visual_videotimeline_update () = 0; diff --git a/gtk2_ardour/quantize_dialog.cc b/gtk2_ardour/quantize_dialog.cc index 45a96e1fc3..82e3a1abd5 100644 --- a/gtk2_ardour/quantize_dialog.cc +++ b/gtk2_ardour/quantize_dialog.cc @@ -131,7 +131,7 @@ QuantizeDialog::grid_size_to_musical_time (const string& txt) const if (txt == "main grid") { bool success; - Evoral::MusicalTime b = editor.get_grid_type_as_beats (success, 0); + Evoral::Beats b = editor.get_grid_type_as_beats (success, 0); if (!success) { return 1.0; } diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index ec525b84ed..db34dcbf84 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -41,7 +41,7 @@ StepEditor::StepEditor (PublicEditor& e, boost::shared_ptr<MidiTrack> t, MidiTim step_edit_insert_position = 0; _step_edit_triplet_countdown = 0; _step_edit_within_chord = 0; - _step_edit_chord_duration = Evoral::MusicalTime(); + _step_edit_chord_duration = Evoral::Beats(); step_edit_region_view = 0; _track->PlaylistChanged.connect (*this, invalidator (*this), @@ -60,11 +60,11 @@ StepEditor::start_step_editing () { _step_edit_triplet_countdown = 0; _step_edit_within_chord = 0; - _step_edit_chord_duration = Evoral::MusicalTime(); + _step_edit_chord_duration = Evoral::Beats(); step_edit_region.reset (); step_edit_region_view = 0; last_added_pitch = -1; - last_added_end = Evoral::MusicalTime(); + last_added_end = Evoral::Beats(); resync_step_edit_position (); prepare_step_edit_region (); @@ -198,7 +198,7 @@ StepEditor::check_step_edit () incoming.read_contents (size, buf); if ((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON) { - step_add_note (buf[0] & 0xf, buf[1], buf[2], Evoral::MusicalTime()); + step_add_note (buf[0] & 0xf, buf[1], buf[2], Evoral::Beats()); } } } @@ -216,7 +216,7 @@ StepEditor::step_add_program_change (uint8_t /*channel*/, uint8_t /*program*/) } void -StepEditor::step_edit_sustain (Evoral::MusicalTime beats) +StepEditor::step_edit_sustain (Evoral::Beats beats) { if (step_edit_region_view) { step_edit_region_view->step_sustain (beats); @@ -224,7 +224,7 @@ StepEditor::step_edit_sustain (Evoral::MusicalTime beats) } void -StepEditor::move_step_edit_beat_pos (Evoral::MusicalTime beats) +StepEditor::move_step_edit_beat_pos (Evoral::Beats beats) { if (beats > 0.0) { step_edit_beat_pos = min (step_edit_beat_pos + beats, @@ -233,14 +233,14 @@ StepEditor::move_step_edit_beat_pos (Evoral::MusicalTime beats) if (-beats < step_edit_beat_pos) { step_edit_beat_pos += beats; // its negative, remember } else { - step_edit_beat_pos = Evoral::MusicalTime(); + step_edit_beat_pos = Evoral::Beats(); } } step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos); } int -StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration) +StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::Beats beat_duration) { /* do these things in case undo removed the step edit region */ @@ -283,8 +283,8 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo _editor.reset_x_origin (fpos - (_editor.current_page_samples()/4)); } - Evoral::MusicalTime at = step_edit_beat_pos; - Evoral::MusicalTime len = beat_duration; + Evoral::Beats at = step_edit_beat_pos; + Evoral::Beats len = beat_duration; if ((last_added_pitch >= 0) && (pitch == last_added_pitch) && (last_added_end == step_edit_beat_pos)) { @@ -292,8 +292,8 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo up by 1 tick from where the last note ended */ - at += Evoral::MusicalTime::ticks(1); - len -= Evoral::MusicalTime::ticks(1); + at += Evoral::Beats::ticks(1); + len -= Evoral::Beats::ticks(1); } step_edit_region_view->step_add_note (channel, pitch, velocity, at, len); @@ -313,7 +313,7 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo step_edit_beat_pos += beat_duration; step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos); } else { - step_edit_beat_pos += Evoral::MusicalTime::ticks(1); // tiny, but no longer overlapping + step_edit_beat_pos += Evoral::Beats::ticks(1); // tiny, but no longer overlapping _step_edit_chord_duration = max (_step_edit_chord_duration, beat_duration); } @@ -321,7 +321,7 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo } void -StepEditor::set_step_edit_cursor_width (Evoral::MusicalTime beats) +StepEditor::set_step_edit_cursor_width (Evoral::Beats beats) { if (step_edit_region_view) { step_edit_region_view->set_step_edit_cursor_width (beats); @@ -365,7 +365,7 @@ StepEditor::step_edit_toggle_chord () } void -StepEditor::step_edit_rest (Evoral::MusicalTime beats) +StepEditor::step_edit_rest (Evoral::Beats beats) { bool success; @@ -425,7 +425,7 @@ StepEditor::region_removed (boost::weak_ptr<Region> wr) step_edit_region.reset(); step_edit_region_view = 0; // force a recompute of the insert position - step_edit_beat_pos = Evoral::MusicalTime(-1); + step_edit_beat_pos = Evoral::Beats(-1); } } diff --git a/gtk2_ardour/step_editor.h b/gtk2_ardour/step_editor.h index 82df743017..299025d292 100644 --- a/gtk2_ardour/step_editor.h +++ b/gtk2_ardour/step_editor.h @@ -45,22 +45,22 @@ class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable virtual ~StepEditor (); void check_step_edit (); - void step_edit_rest (Evoral::MusicalTime beats); + void step_edit_rest (Evoral::Beats beats); void step_edit_beat_sync (); void step_edit_bar_sync (); int step_add_bank_change (uint8_t channel, uint8_t bank); int step_add_program_change (uint8_t channel, uint8_t program); int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, - Evoral::MusicalTime beat_duration); - void step_edit_sustain (Evoral::MusicalTime beats); + Evoral::Beats beat_duration); + void step_edit_sustain (Evoral::Beats beats); bool step_edit_within_triplet () const; void step_edit_toggle_triplet (); bool step_edit_within_chord () const; void step_edit_toggle_chord (); void reset_step_edit_beat_pos (); void resync_step_edit_to_edit_point (); - void move_step_edit_beat_pos (Evoral::MusicalTime beats); - void set_step_edit_cursor_width (Evoral::MusicalTime beats); + void move_step_edit_beat_pos (Evoral::Beats beats); + void set_step_edit_cursor_width (Evoral::Beats beats); std::string name() const; @@ -69,19 +69,19 @@ class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable private: ARDOUR::framepos_t step_edit_insert_position; - Evoral::MusicalTime step_edit_beat_pos; + Evoral::Beats step_edit_beat_pos; boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region; MidiRegionView* step_edit_region_view; uint8_t _step_edit_triplet_countdown; bool _step_edit_within_chord; - Evoral::MusicalTime _step_edit_chord_duration; + Evoral::Beats _step_edit_chord_duration; PBD::ScopedConnection step_edit_region_connection; PublicEditor& _editor; boost::shared_ptr<ARDOUR::MidiTrack> _track; StepEntry* step_editor; MidiTimeAxisView& _mtv; int8_t last_added_pitch; - Evoral::MusicalTime last_added_end; + Evoral::Beats last_added_end; void region_removed (boost::weak_ptr<ARDOUR::Region>); void playlist_changed (); diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index d7b177949f..ace02c0c68 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -526,10 +526,10 @@ StepEntry::on_key_release_event (GdkEventKey* ev) void StepEntry::rest_event_handler () { - se->step_edit_rest (Evoral::MusicalTime()); + se->step_edit_rest (Evoral::Beats()); } -Evoral::MusicalTime +Evoral::Beats StepEntry::note_length () { double base_time = 4.0 / (double) length_divisor_adjustment.get_value(); @@ -549,7 +549,7 @@ StepEntry::note_length () base_time *= 1 + ((dots - 1.0)/dots); } - return Evoral::MusicalTime(base_time); + return Evoral::Beats(base_time); } uint8_t @@ -795,7 +795,7 @@ StepEntry::insert_rest () void StepEntry::insert_grid_rest () { - se->step_edit_rest (Evoral::MusicalTime()); + se->step_edit_rest (Evoral::Beats()); } void diff --git a/gtk2_ardour/step_entry.h b/gtk2_ardour/step_entry.h index 364be67114..bd354f3f66 100644 --- a/gtk2_ardour/step_entry.h +++ b/gtk2_ardour/step_entry.h @@ -41,14 +41,14 @@ class StepEntry : public ArdourWindow void note_off_event_handler (int note); void rest_event_handler (); - Evoral::MusicalTime note_length(); + Evoral::Beats note_length(); uint8_t note_velocity() const; uint8_t note_channel() const; int current_octave () const { return (int) floor (octave_adjustment.get_value()); } private: - Evoral::MusicalTime _current_note_length; + Evoral::Beats _current_note_length; uint8_t _current_note_velocity; Gtk::VBox packer; |