From ec01a25ec1dfefbd6918801a354fde024a94a586 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 13 May 2010 18:51:59 +0000 Subject: add 8 more beat subdivisions, as per #3126 git-svn-id: svn://localhost/ardour2/branches/3.0@7099 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editing_syms.h | 18 ++++-- gtk2_ardour/editor.cc | 126 ++++++++++++++++++++++++++++++++-------- gtk2_ardour/editor_actions.cc | 99 ++++++++++++++++++++++++------- gtk2_ardour/editor_rulers.cc | 42 ++++++++++++-- gtk2_ardour/midi_region_view.cc | 5 ++ 5 files changed, 236 insertions(+), 54 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h index 7cabe999e1..b16a192b40 100644 --- a/gtk2_ardour/editing_syms.h +++ b/gtk2_ardour/editing_syms.h @@ -24,11 +24,19 @@ SNAPTYPE(SnapToTimecodeSeconds) SNAPTYPE(SnapToTimecodeMinutes) SNAPTYPE(SnapToSeconds) SNAPTYPE(SnapToMinutes) -SNAPTYPE(SnapToAThirtysecondBeat) -SNAPTYPE(SnapToASixteenthBeat) -SNAPTYPE(SnapToAEighthBeat) -SNAPTYPE(SnapToAQuarterBeat) -SNAPTYPE(SnapToAThirdBeat) +SNAPTYPE(SnapToBeatDiv32) +SNAPTYPE(SnapToBeatDiv28) +SNAPTYPE(SnapToBeatDiv24) +SNAPTYPE(SnapToBeatDiv16) +SNAPTYPE(SnapToBeatDiv14) +SNAPTYPE(SnapToBeatDiv12) +SNAPTYPE(SnapToBeatDiv10) +SNAPTYPE(SnapToBeatDiv8) +SNAPTYPE(SnapToBeatDiv7) +SNAPTYPE(SnapToBeatDiv6) +SNAPTYPE(SnapToBeatDiv5) +SNAPTYPE(SnapToBeatDiv4) +SNAPTYPE(SnapToBeatDiv3) SNAPTYPE(SnapToBeat) SNAPTYPE(SnapToBar) SNAPTYPE(SnapToMark) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 085767e50b..9b71086cc6 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -145,8 +145,16 @@ static const gchar *_snap_type_strings[] = { N_("Seconds"), N_("Minutes"), N_("Beats/32"), + N_("Beats/28"), + N_("Beats/24"), N_("Beats/16"), + N_("Beats/14"), + N_("Beats/12"), + N_("Beats/10"), N_("Beats/8"), + N_("Beats/7"), + N_("Beats/6"), + N_("Beats/5"), N_("Beats/4"), N_("Beats/3"), N_("Beats"), @@ -2090,11 +2098,19 @@ Editor::set_snap_to (SnapType st) instant_save (); switch (_snap_type) { - case SnapToAThirtysecondBeat: - case SnapToASixteenthBeat: - case SnapToAEighthBeat: - case SnapToAQuarterBeat: - case SnapToAThirdBeat: + case SnapToBeatDiv32: + case SnapToBeatDiv28: + case SnapToBeatDiv24: + case SnapToBeatDiv16: + case SnapToBeatDiv14: + case SnapToBeatDiv12: + case SnapToBeatDiv10: + case SnapToBeatDiv8: + case SnapToBeatDiv7: + case SnapToBeatDiv6: + case SnapToBeatDiv5: + case SnapToBeatDiv4: + case SnapToBeatDiv3: compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames()); update_tempo_based_rulers (); break; @@ -2642,23 +2658,44 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start = _session->tempo_map().round_to_beat (start, direction); break; - case SnapToAThirtysecondBeat: - start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction); + case SnapToBeatDiv28: + start = _session->tempo_map().round_to_beat_subdivision (start, 28, direction); break; - case SnapToASixteenthBeat: + case SnapToBeatDiv24: + start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction); + break; + case SnapToBeatDiv14: + start = _session->tempo_map().round_to_beat_subdivision (start, 14, direction); + break; + case SnapToBeatDiv12: + start = _session->tempo_map().round_to_beat_subdivision (start, 12, direction); + break; + case SnapToBeatDiv10: + start = _session->tempo_map().round_to_beat_subdivision (start, 10, direction); + break; + case SnapToBeatDiv7: + start = _session->tempo_map().round_to_beat_subdivision (start, 7, direction); + break; + case SnapToBeatDiv6: + start = _session->tempo_map().round_to_beat_subdivision (start, 6, direction); + break; + case SnapToBeatDiv5: + start = _session->tempo_map().round_to_beat_subdivision (start, 5, direction); + break; + case SnapToBeatDiv32: + start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction); + break; + case SnapToBeatDiv16: start = _session->tempo_map().round_to_beat_subdivision (start, 16, direction); break; - - case SnapToAEighthBeat: + case SnapToBeatDiv8: start = _session->tempo_map().round_to_beat_subdivision (start, 8, direction); break; - - case SnapToAQuarterBeat: + case SnapToBeatDiv4: start = _session->tempo_map().round_to_beat_subdivision (start, 4, direction); break; - - case SnapToAThirdBeat: + case SnapToBeatDiv3: start = _session->tempo_map().round_to_beat_subdivision (start, 3, direction); break; @@ -3420,15 +3457,31 @@ Editor::snap_type_selection_done () SnapType snaptype = SnapToBeat; if (choice == _("Beats/3")) { - snaptype = SnapToAThirdBeat; + snaptype = SnapToBeatDiv3; } else if (choice == _("Beats/4")) { - snaptype = SnapToAQuarterBeat; + snaptype = SnapToBeatDiv4; } else if (choice == _("Beats/8")) { - snaptype = SnapToAEighthBeat; + snaptype = SnapToBeatDiv8; } else if (choice == _("Beats/16")) { - snaptype = SnapToASixteenthBeat; + snaptype = SnapToBeatDiv16; } else if (choice == _("Beats/32")) { - snaptype = SnapToAThirtysecondBeat; + snaptype = SnapToBeatDiv32; + } else if (choice == _("Beats/5")) { + snaptype = SnapToBeatDiv5; + } else if (choice == _("Beats/6")) { + snaptype = SnapToBeatDiv6; + } else if (choice == _("Beats/7")) { + snaptype = SnapToBeatDiv7; + } else if (choice == _("Beats/10")) { + snaptype = SnapToBeatDiv10; + } else if (choice == _("Beats/12")) { + snaptype = SnapToBeatDiv12; + } else if (choice == _("Beats/14")) { + snaptype = SnapToBeatDiv14; + } else if (choice == _("Beats/24")) { + snaptype = SnapToBeatDiv24; + } else if (choice == _("Beats/28")) { + snaptype = SnapToBeatDiv28; } else if (choice == _("Beats")) { snaptype = SnapToBeat; } else if (choice == _("Bars")) { @@ -3789,23 +3842,48 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position) return 1.0; break; - case SnapToAThirtysecondBeat: + case SnapToBeatDiv28: + return 1.0/28.0; + break; + case SnapToBeatDiv24: + return 1.0/24.0; + break; + case SnapToBeatDiv14: + return 1.0/14.0; + break; + case SnapToBeatDiv12: + return 1.0/12.0; + break; + case SnapToBeatDiv10: + return 1.0/10.0; + break; + case SnapToBeatDiv7: + return 1.0/7.0; + break; + case SnapToBeatDiv6: + return 1.0/6.0; + break; + case SnapToBeatDiv5: + return 1.0/5.0; + break; + + case SnapToBeatDiv32: return 1.0/32.0; break; - case SnapToASixteenthBeat: + case SnapToBeatDiv16: return 1.0/16.0; break; - case SnapToAEighthBeat: + case SnapToBeatDiv8: return 1.0/8.0; break; - case SnapToAQuarterBeat: + case SnapToBeatDiv4: return 1.0/4.0; break; - case SnapToAThirdBeat: + case SnapToBeatDiv3: return 1.0/3.0; break; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index e1133bc93e..56919e0399 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -713,11 +713,22 @@ Editor::register_actions () ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-timecode-minutes"), _("Snap to Timecode Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToTimecodeMinutes))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-seconds"), _("Snap to Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToSeconds))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-minutes"), _("Snap to Minutes"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMinutes))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAThirtysecondBeat))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to A Sixteenth Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToASixteenthBeat))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAEighthBeat))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to Quarters"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAQuarterBeat))); - ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to Thirds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToAThirdBeat))); + + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twelfths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv14))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fourteenths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv12))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-tenths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv10))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sevenths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv7))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv6))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-fifths"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv5))); + + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirtyseconds"), _("Snap to Thirty Seconds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv32))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-asixteenthbeat"), _("Snap to A Sixteenth Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv16))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-eighths"), _("Snap to Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv8))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-quarters"), _("Snap to Quarters"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv4))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-thirds"), _("Snap to Thirds"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv3))); + ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-beat"), _("Snap to Beat"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeat))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-bar"), _("Snap to Bar"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBar))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-mark"), _("Snap to Mark"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToMark))); @@ -970,19 +981,43 @@ Editor::snap_type_action (SnapType type) case Editing::SnapToMinutes: action = "snap-to-minutes"; break; - case Editing::SnapToAThirtysecondBeat: + case Editing::SnapToBeatDiv28: + action = "snap-to-twentyeighths"; + break; + case Editing::SnapToBeatDiv24: + action = "snap-to-twentyfourths"; + break; + case Editing::SnapToBeatDiv14: + action = "snap-to-fourteenths"; + break; + case Editing::SnapToBeatDiv12: + action = "snap-to-twelfths"; + break; + case Editing::SnapToBeatDiv10: + action = "snap-to-tenths"; + break; + case Editing::SnapToBeatDiv7: + action = "snap-to-sevenths"; + break; + case Editing::SnapToBeatDiv6: + action = "snap-to-sixths"; + break; + case Editing::SnapToBeatDiv5: + action = "snap-to-fifths"; + break; + case Editing::SnapToBeatDiv32: action = "snap-to-thirtyseconds"; break; - case Editing::SnapToASixteenthBeat: + case Editing::SnapToBeatDiv16: action = "snap-to-asixteenthbeat"; break; - case Editing::SnapToAEighthBeat: + case Editing::SnapToBeatDiv8: action = "snap-to-eighths"; break; - case Editing::SnapToAQuarterBeat: + case Editing::SnapToBeatDiv4: action = "snap-to-quarters"; break; - case Editing::SnapToAThirdBeat: + case Editing::SnapToBeatDiv3: action = "snap-to-thirds"; break; case Editing::SnapToBeat: @@ -1043,21 +1078,45 @@ Editor::cycle_snap_choice() set_snap_to (Editing::SnapToMinutes); break; case Editing::SnapToMinutes: - set_snap_to (Editing::SnapToAThirtysecondBeat); + set_snap_to (Editing::SnapToBeatDiv32); break; - case Editing::SnapToAThirtysecondBeat: - set_snap_to (Editing::SnapToASixteenthBeat); + case Editing::SnapToBeatDiv32: + set_snap_to (Editing::SnapToBeatDiv28); break; - case Editing::SnapToASixteenthBeat: - set_snap_to (Editing::SnapToAEighthBeat); + case Editing::SnapToBeatDiv28: + set_snap_to (Editing::SnapToBeatDiv24); + break; + case Editing::SnapToBeatDiv24: + set_snap_to (Editing::SnapToBeatDiv16); + break; + case Editing::SnapToBeatDiv16: + set_snap_to (Editing::SnapToBeatDiv14); break; - case Editing::SnapToAEighthBeat: - set_snap_to (Editing::SnapToAQuarterBeat); + case Editing::SnapToBeatDiv14: + set_snap_to (Editing::SnapToBeatDiv12); + break; + case Editing::SnapToBeatDiv12: + set_snap_to (Editing::SnapToBeatDiv10); + break; + case Editing::SnapToBeatDiv10: + set_snap_to (Editing::SnapToBeatDiv8); + break; + case Editing::SnapToBeatDiv8: + set_snap_to (Editing::SnapToBeatDiv7); break; - case Editing::SnapToAQuarterBeat: - set_snap_to (Editing::SnapToAThirdBeat); + case Editing::SnapToBeatDiv7: + set_snap_to (Editing::SnapToBeatDiv6); + break; + case Editing::SnapToBeatDiv6: + set_snap_to (Editing::SnapToBeatDiv5); + break; + case Editing::SnapToBeatDiv5: + set_snap_to (Editing::SnapToBeatDiv4); + break; + case Editing::SnapToBeatDiv4: + set_snap_to (Editing::SnapToBeatDiv3); break; - case Editing::SnapToAThirdBeat: + case Editing::SnapToBeatDiv3: set_snap_to (Editing::SnapToBeat); break; case Editing::SnapToBeat: diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 73ffcb4467..79ea23815d 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -1153,24 +1153,56 @@ Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper) bbt_ruler_scale = bbt_over; switch (_snap_type) { - case SnapToAThirdBeat: + case SnapToBeatDiv3: bbt_beat_subdivision = 3; break; - case SnapToAQuarterBeat: + case SnapToBeatDiv4: bbt_beat_subdivision = 4; break; - case SnapToAEighthBeat: + case SnapToBeatDiv8: bbt_beat_subdivision = 8; bbt_accent_modulo = 2; break; - case SnapToASixteenthBeat: + case SnapToBeatDiv16: bbt_beat_subdivision = 16; bbt_accent_modulo = 4; break; - case SnapToAThirtysecondBeat: + case SnapToBeatDiv32: bbt_beat_subdivision = 32; bbt_accent_modulo = 8; break; + case SnapToBeatDiv28: + bbt_beat_subdivision = 28; + bbt_accent_modulo = 7; + break; + case SnapToBeatDiv24: + bbt_beat_subdivision = 24; + bbt_accent_modulo = 6; + break; + case SnapToBeatDiv14: + bbt_beat_subdivision = 14; + bbt_accent_modulo = 3; // XXX YIKES! + break; + case SnapToBeatDiv12: + bbt_beat_subdivision = 12; + bbt_accent_modulo = 3; + break; + case SnapToBeatDiv10: + bbt_beat_subdivision = 10; + bbt_accent_modulo = 2; // XXX YIKES + break; + case SnapToBeatDiv7: + bbt_beat_subdivision = 7; + bbt_accent_modulo = 2; // XXX YIKES + break; + case SnapToBeatDiv6: + bbt_beat_subdivision = 6; + bbt_accent_modulo = 2; // XXX YIKES + break; + case SnapToBeatDiv5: + bbt_beat_subdivision = 5; + bbt_accent_modulo = 2; // XXX YIKES + break; default: bbt_beat_subdivision = 4; break; diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index f33c15079d..a0ccd7b9ad 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2531,6 +2531,8 @@ MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb) for (int n = 0; n < (int) times; ++n) { + cerr << "Pasting " << mcb.notes().size() << " for the " << n+1 << "th time\n"; + for (Notes::const_iterator i = mcb.notes().begin(); i != mcb.notes().end(); ++i) { boost::shared_ptr copied_note (new NoteType (*((*i).get()))); @@ -2552,6 +2554,8 @@ MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb) if (end_frame > region_end) { + cerr << "region end is now " << end_frame << " to extend from " << region_end << endl; + trackview.session()->begin_reversible_command (_("paste")); _region->clear_history (); @@ -2559,6 +2563,7 @@ MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb) trackview.session()->add_command (new StatefulDiffCommand (_region)); } + cerr << "region end finally at " << _region->position() + _region->length() - 1; apply_delta (); } -- cgit v1.2.3