13
0

support a grid of beats/64 and beats/128

git-svn-id: svn://localhost/ardour2/branches/3.0@11490 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-02-14 22:15:25 +00:00
parent 058715c525
commit ed62609e80
6 changed files with 68 additions and 2 deletions

View File

@ -385,6 +385,8 @@
<menuitem action='snap-to-timecode-minutes'/> <menuitem action='snap-to-timecode-minutes'/>
<menuitem action='snap-to-seconds'/> <menuitem action='snap-to-seconds'/>
<menuitem action='snap-to-minutes'/> <menuitem action='snap-to-minutes'/>
<menuitem action='snap-to-onetwentyeighths'/>
<menuitem action='snap-to-sixtyfourths'/>
<menuitem action='snap-to-thirtyseconds'/> <menuitem action='snap-to-thirtyseconds'/>
<menuitem action='snap-to-twentyeighths'/> <menuitem action='snap-to-twentyeighths'/>
<menuitem action='snap-to-twentyfourths'/> <menuitem action='snap-to-twentyfourths'/>

View File

@ -24,6 +24,8 @@ SNAPTYPE(SnapToTimecodeSeconds)
SNAPTYPE(SnapToTimecodeMinutes) SNAPTYPE(SnapToTimecodeMinutes)
SNAPTYPE(SnapToSeconds) SNAPTYPE(SnapToSeconds)
SNAPTYPE(SnapToMinutes) SNAPTYPE(SnapToMinutes)
SNAPTYPE(SnapToBeatDiv128)
SNAPTYPE(SnapToBeatDiv64)
SNAPTYPE(SnapToBeatDiv32) SNAPTYPE(SnapToBeatDiv32)
SNAPTYPE(SnapToBeatDiv28) SNAPTYPE(SnapToBeatDiv28)
SNAPTYPE(SnapToBeatDiv24) SNAPTYPE(SnapToBeatDiv24)

View File

@ -151,6 +151,8 @@ static const gchar *_snap_type_strings[] = {
N_("Timecode Minutes"), N_("Timecode Minutes"),
N_("Seconds"), N_("Seconds"),
N_("Minutes"), N_("Minutes"),
N_("Beats/128"),
N_("Beats/64"),
N_("Beats/32"), N_("Beats/32"),
N_("Beats/28"), N_("Beats/28"),
N_("Beats/24"), N_("Beats/24"),
@ -2068,6 +2070,8 @@ Editor::set_snap_to (SnapType st)
instant_save (); instant_save ();
switch (_snap_type) { switch (_snap_type) {
case SnapToBeatDiv128:
case SnapToBeatDiv64:
case SnapToBeatDiv32: case SnapToBeatDiv32:
case SnapToBeatDiv28: case SnapToBeatDiv28:
case SnapToBeatDiv24: case SnapToBeatDiv24:
@ -2655,6 +2659,12 @@ Editor::snap_to_internal (framepos_t& start, int32_t direction, bool for_mark)
start = _session->tempo_map().round_to_beat (start, direction); start = _session->tempo_map().round_to_beat (start, direction);
break; break;
case SnapToBeatDiv128:
start = _session->tempo_map().round_to_beat_subdivision (start, 128, direction);
break;
case SnapToBeatDiv64:
start = _session->tempo_map().round_to_beat_subdivision (start, 64, direction);
break;
case SnapToBeatDiv32: case SnapToBeatDiv32:
start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction); start = _session->tempo_map().round_to_beat_subdivision (start, 32, direction);
break; break;
@ -3371,6 +3381,10 @@ Editor::snap_type_selection_done ()
snaptype = SnapToBeatDiv28; snaptype = SnapToBeatDiv28;
} else if (choice == _("Beats/32")) { } else if (choice == _("Beats/32")) {
snaptype = SnapToBeatDiv32; snaptype = SnapToBeatDiv32;
} else if (choice == _("Beats/64")) {
snaptype = SnapToBeatDiv64;
} else if (choice == _("Beats/128")) {
snaptype = SnapToBeatDiv128;
} else if (choice == _("Beats")) { } else if (choice == _("Beats")) {
snaptype = SnapToBeat; snaptype = SnapToBeat;
} else if (choice == _("Bars")) { } else if (choice == _("Bars")) {
@ -3778,6 +3792,12 @@ Editor::get_grid_type_as_beats (bool& success, framepos_t position)
return 1.0; return 1.0;
break; break;
case SnapToBeatDiv128:
return 1.0/128.0;
break;
case SnapToBeatDiv64:
return 1.0/64.0;
break;
case SnapToBeatDiv32: case SnapToBeatDiv32:
return 1.0/32.0; return 1.0/32.0;
break; break;

View File

@ -488,6 +488,8 @@ Editor::register_actions ()
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-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-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-onetwentyeighths"), _("Snap to One Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv128)));
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-sixtyfourths"), _("Snap to Sixty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv64)));
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-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-twentyeighths"), _("Snap to Twenty Eighths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv28))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyeighths"), _("Snap to Twenty Eighths"), (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 Twenty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24))); ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-twentyfourths"), _("Snap to Twenty Fourths"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToBeatDiv24)));
@ -772,6 +774,12 @@ Editor::snap_type_action (SnapType type)
case Editing::SnapToMinutes: case Editing::SnapToMinutes:
action = "snap-to-minutes"; action = "snap-to-minutes";
break; break;
case Editing::SnapToBeatDiv128:
action = "snap-to-onetwentyeighths";
break;
case Editing::SnapToBeatDiv64:
action = "snap-to-sixtyfourths";
break;
case Editing::SnapToBeatDiv32: case Editing::SnapToBeatDiv32:
action = "snap-to-thirtyseconds"; action = "snap-to-thirtyseconds";
break; break;
@ -875,6 +883,12 @@ Editor::next_snap_choice ()
set_snap_to (Editing::SnapToMinutes); set_snap_to (Editing::SnapToMinutes);
break; break;
case Editing::SnapToMinutes: case Editing::SnapToMinutes:
set_snap_to (Editing::SnapToBeatDiv128);
break;
case Editing::SnapToBeatDiv128:
set_snap_to (Editing::SnapToBeatDiv64);
break;
case Editing::SnapToBeatDiv64:
set_snap_to (Editing::SnapToBeatDiv32); set_snap_to (Editing::SnapToBeatDiv32);
break; break;
case Editing::SnapToBeatDiv32: case Editing::SnapToBeatDiv32:
@ -966,6 +980,12 @@ Editor::prev_snap_choice ()
set_snap_to (Editing::SnapToMinutes); set_snap_to (Editing::SnapToMinutes);
break; break;
case Editing::SnapToMinutes: case Editing::SnapToMinutes:
set_snap_to (Editing::SnapToBeatDiv128);
break;
case Editing::SnapToBeatDiv128:
set_snap_to (Editing::SnapToBeatDiv64);
break;
case Editing::SnapToBeatDiv64:
set_snap_to (Editing::SnapToBeatDiv32); set_snap_to (Editing::SnapToBeatDiv32);
break; break;
case Editing::SnapToBeatDiv32: case Editing::SnapToBeatDiv32:
@ -1052,6 +1072,12 @@ Editor::next_snap_choice_music_only ()
case Editing::SnapToTimecodeMinutes: case Editing::SnapToTimecodeMinutes:
case Editing::SnapToSeconds: case Editing::SnapToSeconds:
case Editing::SnapToMinutes: case Editing::SnapToMinutes:
set_snap_to (Editing::SnapToBeatDiv128);
break;
case Editing::SnapToBeatDiv128:
set_snap_to (Editing::SnapToBeatDiv64);
break;
case Editing::SnapToBeatDiv64:
set_snap_to (Editing::SnapToBeatDiv32); set_snap_to (Editing::SnapToBeatDiv32);
break; break;
case Editing::SnapToBeatDiv32: case Editing::SnapToBeatDiv32:
@ -1103,7 +1129,7 @@ Editor::next_snap_choice_music_only ()
set_snap_to (Editing::SnapToBar); set_snap_to (Editing::SnapToBar);
break; break;
case Editing::SnapToBar: case Editing::SnapToBar:
set_snap_to (Editing::SnapToBeatDiv32); set_snap_to (Editing::SnapToBeatDiv128);
break; break;
} }
} }
@ -1125,9 +1151,15 @@ Editor::prev_snap_choice_music_only ()
case Editing::SnapToMinutes: case Editing::SnapToMinutes:
set_snap_to (Editing::SnapToBar); set_snap_to (Editing::SnapToBar);
break; break;
case Editing::SnapToBeatDiv32: case Editing::SnapToBeatDiv128:
set_snap_to (Editing::SnapToBeat); set_snap_to (Editing::SnapToBeat);
break; break;
case Editing::SnapToBeatDiv64:
set_snap_to (Editing::SnapToBeatDiv128);
break;
case Editing::SnapToBeatDiv32:
set_snap_to (Editing::SnapToBeatDiv64);
break;
case Editing::SnapToBeatDiv28: case Editing::SnapToBeatDiv28:
set_snap_to (Editing::SnapToBeatDiv32); set_snap_to (Editing::SnapToBeatDiv32);
break; break;

View File

@ -1221,6 +1221,14 @@ Editor::compute_bbt_ruler_scale (framepos_t lower, framepos_t upper)
bbt_beat_subdivision = 32; bbt_beat_subdivision = 32;
bbt_accent_modulo = 8; bbt_accent_modulo = 8;
break; break;
case SnapToBeatDiv64:
bbt_beat_subdivision = 64;
bbt_accent_modulo = 8;
break;
case SnapToBeatDiv128:
bbt_beat_subdivision = 128;
bbt_accent_modulo = 8;
break;
default: default:
bbt_beat_subdivision = 4; bbt_beat_subdivision = 4;
break; break;

View File

@ -93,6 +93,8 @@ setup_gtk_ardour_enums ()
REGISTER_ENUM (SnapToTimecodeMinutes); REGISTER_ENUM (SnapToTimecodeMinutes);
REGISTER_ENUM (SnapToSeconds); REGISTER_ENUM (SnapToSeconds);
REGISTER_ENUM (SnapToMinutes); REGISTER_ENUM (SnapToMinutes);
REGISTER_ENUM (SnapToBeatDiv128);
REGISTER_ENUM (SnapToBeatDiv64);
REGISTER_ENUM (SnapToBeatDiv32); REGISTER_ENUM (SnapToBeatDiv32);
REGISTER_ENUM (SnapToBeatDiv28); REGISTER_ENUM (SnapToBeatDiv28);
REGISTER_ENUM (SnapToBeatDiv24); REGISTER_ENUM (SnapToBeatDiv24);