mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
allow all types of range location (loop, start, end etc.) to be glued to bars and beats.
This commit is contained in:
parent
0869aa0f6c
commit
d0580ecfbc
12 changed files with 166 additions and 123 deletions
|
|
@ -4773,7 +4773,7 @@ void
|
||||||
ARDOUR_UI::create_xrun_marker (framepos_t where)
|
ARDOUR_UI::create_xrun_marker (framepos_t where)
|
||||||
{
|
{
|
||||||
if (_session) {
|
if (_session) {
|
||||||
Location *location = new Location (*_session, where, where, _("xrun"), Location::IsMark);
|
Location *location = new Location (*_session, where, where, _("xrun"), Location::IsMark, 0);
|
||||||
_session->locations()->add (location);
|
_session->locations()->add (location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4756,7 +4756,7 @@ Editor::set_loop_range (framepos_t start, framepos_t end, string cmd)
|
||||||
Location* tll;
|
Location* tll;
|
||||||
|
|
||||||
if ((tll = transport_loop_location()) == 0) {
|
if ((tll = transport_loop_location()) == 0) {
|
||||||
Location* loc = new Location (*_session, start, end, _("Loop"), Location::IsAutoLoop);
|
Location* loc = new Location (*_session, start, end, _("Loop"), Location::IsAutoLoop, get_grid_music_divisions(0));
|
||||||
XMLNode &before = _session->locations()->get_state();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
_session->locations()->add (loc, true);
|
_session->locations()->add (loc, true);
|
||||||
_session->set_auto_loop_location (loc);
|
_session->set_auto_loop_location (loc);
|
||||||
|
|
@ -4783,7 +4783,7 @@ Editor::set_punch_range (framepos_t start, framepos_t end, string cmd)
|
||||||
Location* tpl;
|
Location* tpl;
|
||||||
|
|
||||||
if ((tpl = transport_punch_location()) == 0) {
|
if ((tpl = transport_punch_location()) == 0) {
|
||||||
Location* loc = new Location (*_session, start, end, _("Punch"), Location::IsAutoPunch);
|
Location* loc = new Location (*_session, start, end, _("Punch"), Location::IsAutoPunch, get_grid_music_divisions(0));
|
||||||
XMLNode &before = _session->locations()->get_state();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
_session->locations()->add (loc, true);
|
_session->locations()->add (loc, true);
|
||||||
_session->set_auto_punch_location (loc);
|
_session->set_auto_punch_location (loc);
|
||||||
|
|
|
||||||
|
|
@ -1698,7 +1698,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
|
void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
|
||||||
void tempo_or_meter_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
|
void tempo_or_meter_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
|
||||||
void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
|
void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
|
||||||
void build_range_marker_menu (bool, bool);
|
void build_range_marker_menu (ARDOUR::Location *, bool, bool);
|
||||||
void build_marker_menu (ARDOUR::Location *);
|
void build_marker_menu (ARDOUR::Location *);
|
||||||
void build_tempo_marker_menu (TempoMarker *, bool);
|
void build_tempo_marker_menu (TempoMarker *, bool);
|
||||||
void build_meter_marker_menu (MeterMarker *, bool);
|
void build_meter_marker_menu (MeterMarker *, bool);
|
||||||
|
|
|
||||||
|
|
@ -4196,6 +4196,8 @@ MarkerDrag::motion (GdkEvent* event, bool)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
|
||||||
|
|
||||||
/* now move them all */
|
/* now move them all */
|
||||||
|
|
||||||
for (x = _copied_locations.begin(); x != _copied_locations.end(); ++x) {
|
for (x = _copied_locations.begin(); x != _copied_locations.end(); ++x) {
|
||||||
|
|
@ -4213,8 +4215,7 @@ MarkerDrag::motion (GdkEvent* event, bool)
|
||||||
if (copy_location->is_mark()) {
|
if (copy_location->is_mark()) {
|
||||||
|
|
||||||
/* now move it */
|
/* now move it */
|
||||||
|
copy_location->set_start (copy_location->start() + f_delta, false, true, divisions);
|
||||||
copy_location->set_start (copy_location->start() + f_delta);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
@ -4224,27 +4225,27 @@ MarkerDrag::motion (GdkEvent* event, bool)
|
||||||
if (is_start) { // start-of-range marker
|
if (is_start) { // start-of-range marker
|
||||||
|
|
||||||
if (move_both || (*x).move_both) {
|
if (move_both || (*x).move_both) {
|
||||||
copy_location->set_start (new_start);
|
copy_location->set_start (new_start, false, true, divisions);
|
||||||
copy_location->set_end (new_end);
|
copy_location->set_end (new_end, false, true, divisions);
|
||||||
} else if (new_start < copy_location->end()) {
|
} else if (new_start < copy_location->end()) {
|
||||||
copy_location->set_start (new_start);
|
copy_location->set_start (new_start, false, true, divisions);
|
||||||
} else if (newframe > 0) {
|
} else if (newframe > 0) {
|
||||||
//_editor->snap_to (next, RoundUpAlways, true);
|
//_editor->snap_to (next, RoundUpAlways, true);
|
||||||
copy_location->set_end (next);
|
copy_location->set_end (next, false, true, divisions);
|
||||||
copy_location->set_start (newframe);
|
copy_location->set_start (newframe, false, true, divisions);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // end marker
|
} else { // end marker
|
||||||
|
|
||||||
if (move_both || (*x).move_both) {
|
if (move_both || (*x).move_both) {
|
||||||
copy_location->set_end (new_end);
|
copy_location->set_end (new_end, divisions);
|
||||||
copy_location->set_start (new_start);
|
copy_location->set_start (new_start, false, true, divisions);
|
||||||
} else if (new_end > copy_location->start()) {
|
} else if (new_end > copy_location->start()) {
|
||||||
copy_location->set_end (new_end);
|
copy_location->set_end (new_end, false, true, divisions);
|
||||||
} else if (newframe > 0) {
|
} else if (newframe > 0) {
|
||||||
//_editor->snap_to (next, RoundDownAlways, true);
|
//_editor->snap_to (next, RoundDownAlways, true);
|
||||||
copy_location->set_start (next);
|
copy_location->set_start (next, false, true, divisions);
|
||||||
copy_location->set_end (newframe);
|
copy_location->set_end (newframe, false, true, divisions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4321,6 +4322,7 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
|
|
||||||
MarkerSelection::iterator i;
|
MarkerSelection::iterator i;
|
||||||
CopiedLocationInfo::iterator x;
|
CopiedLocationInfo::iterator x;
|
||||||
|
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
|
||||||
bool is_start;
|
bool is_start;
|
||||||
|
|
||||||
for (i = _editor->selection->markers.begin(), x = _copied_locations.begin();
|
for (i = _editor->selection->markers.begin(), x = _copied_locations.begin();
|
||||||
|
|
@ -4339,9 +4341,9 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
in_command = true;
|
in_command = true;
|
||||||
}
|
}
|
||||||
if (location->is_mark()) {
|
if (location->is_mark()) {
|
||||||
location->set_start (((*x).location)->start());
|
location->set_start (((*x).location)->start(), false, true, divisions);
|
||||||
} else {
|
} else {
|
||||||
location->set (((*x).location)->start(), ((*x).location)->end());
|
location->set (((*x).location)->start(), ((*x).location)->end(), true, divisions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location->is_session_range()) {
|
if (location->is_session_range()) {
|
||||||
|
|
@ -5536,7 +5538,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
}
|
}
|
||||||
newloc = new Location (
|
newloc = new Location (
|
||||||
*_editor->session(), _editor->temp_location->start(), _editor->temp_location->end(), rangename, (Location::Flags) flags
|
*_editor->session(), _editor->temp_location->start(), _editor->temp_location->end(), rangename, (Location::Flags) flags
|
||||||
);
|
, _editor->get_grid_music_divisions (event->button.state));
|
||||||
|
|
||||||
_editor->session()->locations()->add (newloc, true);
|
_editor->session()->locations()->add (newloc, true);
|
||||||
XMLNode &after = _editor->session()->locations()->get_state();
|
XMLNode &after = _editor->session()->locations()->get_state();
|
||||||
|
|
|
||||||
|
|
@ -646,7 +646,7 @@ Editor::mouse_add_new_marker (framepos_t where, bool is_cd)
|
||||||
if (!choose_new_marker_name(markername)) {
|
if (!choose_new_marker_name(markername)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location *location = new Location (*_session, where, where, markername, (Location::Flags) flags);
|
Location *location = new Location (*_session, where, where, markername, (Location::Flags) flags, get_grid_music_divisions (0));
|
||||||
begin_reversible_command (_("add marker"));
|
begin_reversible_command (_("add marker"));
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
|
|
@ -838,9 +838,8 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
||||||
|
|
||||||
if (loc == transport_loop_location() || loc == transport_punch_location() || loc->is_session_range ()) {
|
if (loc == transport_loop_location() || loc == transport_punch_location() || loc->is_session_range ()) {
|
||||||
|
|
||||||
if (transport_marker_menu == 0) {
|
delete transport_marker_menu;
|
||||||
build_range_marker_menu (loc == transport_loop_location() || loc == transport_punch_location(), loc->is_session_range());
|
build_range_marker_menu (loc, loc == transport_loop_location() || loc == transport_punch_location(), loc->is_session_range());
|
||||||
}
|
|
||||||
|
|
||||||
marker_menu_item = item;
|
marker_menu_item = item;
|
||||||
transport_marker_menu->popup (1, ev->time);
|
transport_marker_menu->popup (1, ev->time);
|
||||||
|
|
@ -868,9 +867,9 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
|
||||||
marker_menu->popup (1, ev->time);
|
marker_menu->popup (1, ev->time);
|
||||||
|
|
||||||
} else if (loc->is_range_marker()) {
|
} else if (loc->is_range_marker()) {
|
||||||
if (range_marker_menu == 0) {
|
delete range_marker_menu;
|
||||||
build_range_marker_menu (false, false);
|
build_range_marker_menu (loc, false, false);
|
||||||
}
|
|
||||||
marker_menu_item = item;
|
marker_menu_item = item;
|
||||||
range_marker_menu->popup (1, ev->time);
|
range_marker_menu->popup (1, ev->time);
|
||||||
}
|
}
|
||||||
|
|
@ -916,9 +915,8 @@ Editor::build_marker_menu (Location* loc)
|
||||||
|
|
||||||
items.push_back (CheckMenuElem (_("Glue to Bars and Beats")));
|
items.push_back (CheckMenuElem (_("Glue to Bars and Beats")));
|
||||||
Gtk::CheckMenuItem* glue_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
|
Gtk::CheckMenuItem* glue_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
|
||||||
if (loc->position_lock_style() == MusicTime) {
|
glue_item->set_active (loc->position_lock_style() == MusicTime);
|
||||||
glue_item->set_active ();
|
|
||||||
}
|
|
||||||
glue_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_menu_glue));
|
glue_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_menu_glue));
|
||||||
|
|
||||||
items.push_back (SeparatorElem());
|
items.push_back (SeparatorElem());
|
||||||
|
|
@ -927,11 +925,11 @@ Editor::build_marker_menu (Location* loc)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::build_range_marker_menu (bool loop_or_punch, bool session)
|
Editor::build_range_marker_menu (Location* loc, bool loop_or_punch, bool session)
|
||||||
{
|
{
|
||||||
using namespace Menu_Helpers;
|
using namespace Menu_Helpers;
|
||||||
|
|
||||||
bool const loop_or_punch_or_session = loop_or_punch | session;
|
bool const loop_or_punch_or_session = loop_or_punch || session;
|
||||||
|
|
||||||
Menu *markerMenu = new Menu;
|
Menu *markerMenu = new Menu;
|
||||||
if (loop_or_punch_or_session) {
|
if (loop_or_punch_or_session) {
|
||||||
|
|
@ -952,6 +950,13 @@ Editor::build_range_marker_menu (bool loop_or_punch, bool session)
|
||||||
|
|
||||||
items.push_back (MenuElem (_("Zoom to Range"), sigc::mem_fun (*this, &Editor::marker_menu_zoom_to_range)));
|
items.push_back (MenuElem (_("Zoom to Range"), sigc::mem_fun (*this, &Editor::marker_menu_zoom_to_range)));
|
||||||
|
|
||||||
|
items.push_back (SeparatorElem());
|
||||||
|
items.push_back (CheckMenuElem (_("Glue to Bars and Beats")));
|
||||||
|
|
||||||
|
Gtk::CheckMenuItem* glue_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
|
||||||
|
glue_item->set_active (loc->position_lock_style() == MusicTime);
|
||||||
|
glue_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_menu_glue));
|
||||||
|
|
||||||
items.push_back (SeparatorElem());
|
items.push_back (SeparatorElem());
|
||||||
items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_range)));
|
items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_range)));
|
||||||
items.push_back (SeparatorElem());
|
items.push_back (SeparatorElem());
|
||||||
|
|
@ -1213,17 +1218,18 @@ Editor::marker_menu_set_from_playhead ()
|
||||||
|
|
||||||
Location* l;
|
Location* l;
|
||||||
bool is_start;
|
bool is_start;
|
||||||
|
const int32_t divisions = get_grid_music_divisions (0);
|
||||||
|
|
||||||
if ((l = find_location_from_marker (marker, is_start)) != 0) {
|
if ((l = find_location_from_marker (marker, is_start)) != 0) {
|
||||||
|
|
||||||
if (l->is_mark()) {
|
if (l->is_mark()) {
|
||||||
l->set_start (_session->audible_frame ());
|
l->set_start (_session->audible_frame (), false, true, divisions);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (is_start) {
|
if (is_start) {
|
||||||
l->set_start (_session->audible_frame ());
|
l->set_start (_session->audible_frame (), false, true, divisions);
|
||||||
} else {
|
} else {
|
||||||
l->set_end (_session->audible_frame ());
|
l->set_end (_session->audible_frame (), false, true, divisions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1692,7 +1698,6 @@ Editor::toggle_marker_menu_glue ()
|
||||||
} else {
|
} else {
|
||||||
loc->set_position_lock_style (MusicTime);
|
loc->set_position_lock_style (MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -420,6 +420,7 @@ Editor::nudge_forward (bool next, bool force_playhead)
|
||||||
|
|
||||||
bool is_start;
|
bool is_start;
|
||||||
bool in_command = false;
|
bool in_command = false;
|
||||||
|
const int32_t divisions = get_grid_music_divisions (0);
|
||||||
|
|
||||||
for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) {
|
for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) {
|
||||||
|
|
||||||
|
|
@ -435,9 +436,9 @@ Editor::nudge_forward (bool next, bool force_playhead)
|
||||||
distance = next_distance;
|
distance = next_distance;
|
||||||
}
|
}
|
||||||
if (max_framepos - distance > loc->start() + loc->length()) {
|
if (max_framepos - distance > loc->start() + loc->length()) {
|
||||||
loc->set_start (loc->start() + distance);
|
loc->set_start (loc->start() + distance, false, true, divisions);
|
||||||
} else {
|
} else {
|
||||||
loc->set_start (max_framepos - loc->length());
|
loc->set_start (max_framepos - loc->length(), false, true, divisions);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
distance = get_nudge_distance (loc->end(), next_distance);
|
distance = get_nudge_distance (loc->end(), next_distance);
|
||||||
|
|
@ -445,9 +446,9 @@ Editor::nudge_forward (bool next, bool force_playhead)
|
||||||
distance = next_distance;
|
distance = next_distance;
|
||||||
}
|
}
|
||||||
if (max_framepos - distance > loc->end()) {
|
if (max_framepos - distance > loc->end()) {
|
||||||
loc->set_end (loc->end() + distance);
|
loc->set_end (loc->end() + distance, false, true, divisions);
|
||||||
} else {
|
} else {
|
||||||
loc->set_end (max_framepos);
|
loc->set_end (max_framepos, false, true, divisions);
|
||||||
}
|
}
|
||||||
if (loc->is_session_range()) {
|
if (loc->is_session_range()) {
|
||||||
_session->set_end_is_free (false);
|
_session->set_end_is_free (false);
|
||||||
|
|
@ -527,9 +528,9 @@ Editor::nudge_backward (bool next, bool force_playhead)
|
||||||
distance = next_distance;
|
distance = next_distance;
|
||||||
}
|
}
|
||||||
if (distance < loc->start()) {
|
if (distance < loc->start()) {
|
||||||
loc->set_start (loc->start() - distance);
|
loc->set_start (loc->start() - distance, false, true, get_grid_music_divisions(0));
|
||||||
} else {
|
} else {
|
||||||
loc->set_start (0);
|
loc->set_start (0, false, true, get_grid_music_divisions(0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
distance = get_nudge_distance (loc->end(), next_distance);
|
distance = get_nudge_distance (loc->end(), next_distance);
|
||||||
|
|
@ -539,9 +540,9 @@ Editor::nudge_backward (bool next, bool force_playhead)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distance < loc->end() - loc->length()) {
|
if (distance < loc->end() - loc->length()) {
|
||||||
loc->set_end (loc->end() - distance);
|
loc->set_end (loc->end() - distance, false, true, get_grid_music_divisions(0));
|
||||||
} else {
|
} else {
|
||||||
loc->set_end (loc->length());
|
loc->set_end (loc->length(), false, true, get_grid_music_divisions(0));
|
||||||
}
|
}
|
||||||
if (loc->is_session_range()) {
|
if (loc->is_session_range()) {
|
||||||
_session->set_end_is_free (false);
|
_session->set_end_is_free (false);
|
||||||
|
|
@ -1155,7 +1156,7 @@ Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loc->move_to (target);
|
loc->move_to (target, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1232,7 +1233,7 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir)
|
||||||
|
|
||||||
pos = track_frame_to_session_frame(pos, speed);
|
pos = track_frame_to_session_frame(pos, speed);
|
||||||
|
|
||||||
loc->move_to (pos);
|
loc->move_to (pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1279,7 +1280,7 @@ Editor::selected_marker_to_selection_start ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loc->move_to (pos);
|
loc->move_to (pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1314,7 +1315,7 @@ Editor::selected_marker_to_selection_end ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loc->move_to (pos);
|
loc->move_to (pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1366,6 +1367,7 @@ Editor::cursor_align (bool playhead_to_edit)
|
||||||
_session->request_locate (selection->markers.front()->position(), _session->transport_rolling());
|
_session->request_locate (selection->markers.front()->position(), _session->transport_rolling());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
const int32_t divisions = get_grid_music_divisions (0);
|
||||||
/* move selected markers to playhead */
|
/* move selected markers to playhead */
|
||||||
|
|
||||||
for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) {
|
for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) {
|
||||||
|
|
@ -1374,10 +1376,10 @@ Editor::cursor_align (bool playhead_to_edit)
|
||||||
Location* loc = find_location_from_marker (*i, ignored);
|
Location* loc = find_location_from_marker (*i, ignored);
|
||||||
|
|
||||||
if (loc->is_mark()) {
|
if (loc->is_mark()) {
|
||||||
loc->set_start (playhead_cursor->current_frame ());
|
loc->set_start (playhead_cursor->current_frame (), false, true, divisions);
|
||||||
} else {
|
} else {
|
||||||
loc->set (playhead_cursor->current_frame (),
|
loc->set (playhead_cursor->current_frame (),
|
||||||
playhead_cursor->current_frame () + loc->length());
|
playhead_cursor->current_frame () + loc->length(), true, divisions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2145,7 +2147,7 @@ Editor::add_location_from_selection ()
|
||||||
framepos_t end = selection->time[clicked_selection].end;
|
framepos_t end = selection->time[clicked_selection].end;
|
||||||
|
|
||||||
_session->locations()->next_available_name(rangename,"selection");
|
_session->locations()->next_available_name(rangename,"selection");
|
||||||
Location *location = new Location (*_session, start, end, rangename, Location::IsRangeMarker);
|
Location *location = new Location (*_session, start, end, rangename, Location::IsRangeMarker, get_grid_music_divisions(0));
|
||||||
|
|
||||||
begin_reversible_command (_("add marker"));
|
begin_reversible_command (_("add marker"));
|
||||||
|
|
||||||
|
|
@ -2168,7 +2170,7 @@ Editor::add_location_mark (framepos_t where)
|
||||||
if (!choose_new_marker_name(markername)) {
|
if (!choose_new_marker_name(markername)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location *location = new Location (*_session, where, where, markername, Location::IsMark);
|
Location *location = new Location (*_session, where, where, markername, Location::IsMark, get_grid_music_divisions (0));
|
||||||
begin_reversible_command (_("add marker"));
|
begin_reversible_command (_("add marker"));
|
||||||
|
|
||||||
XMLNode &before = _session->locations()->get_state();
|
XMLNode &before = _session->locations()->get_state();
|
||||||
|
|
@ -2297,7 +2299,7 @@ Editor::add_locations_from_region ()
|
||||||
|
|
||||||
boost::shared_ptr<Region> region = (*i)->region ();
|
boost::shared_ptr<Region> region = (*i)->region ();
|
||||||
|
|
||||||
Location *location = new Location (*_session, region->position(), region->last_frame(), region->name(), Location::IsRangeMarker);
|
Location *location = new Location (*_session, region->position(), region->last_frame(), region->name(), Location::IsRangeMarker, 0);
|
||||||
|
|
||||||
_session->locations()->add (location, true);
|
_session->locations()->add (location, true);
|
||||||
commit = true;
|
commit = true;
|
||||||
|
|
@ -2338,7 +2340,7 @@ Editor::add_location_from_region ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// single range spanning all selected
|
// single range spanning all selected
|
||||||
Location *location = new Location (*_session, selection->regions.start(), selection->regions.end_frame(), markername, Location::IsRangeMarker);
|
Location *location = new Location (*_session, selection->regions.start(), selection->regions.end_frame(), markername, Location::IsRangeMarker, 0);
|
||||||
_session->locations()->add (location, true);
|
_session->locations()->add (location, true);
|
||||||
|
|
||||||
begin_reversible_command (_("add marker"));
|
begin_reversible_command (_("add marker"));
|
||||||
|
|
@ -2393,7 +2395,7 @@ Editor::set_mark ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_session->locations()->add (new Location (*_session, pos, 0, markername, Location::IsMark), true);
|
_session->locations()->add (new Location (*_session, pos, 0, markername, Location::IsMark, 0), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -6173,7 +6175,7 @@ Editor::set_edit_point ()
|
||||||
Location* loc = find_location_from_marker (selection->markers.front(), ignored);
|
Location* loc = find_location_from_marker (selection->markers.front(), ignored);
|
||||||
|
|
||||||
if (loc) {
|
if (loc) {
|
||||||
loc->move_to (where);
|
loc->move_to (where, get_grid_music_divisions(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7486,6 +7488,7 @@ Editor::insert_time (
|
||||||
/* markers */
|
/* markers */
|
||||||
if (markers_too) {
|
if (markers_too) {
|
||||||
bool moved = false;
|
bool moved = false;
|
||||||
|
const int32_t divisions = get_grid_music_divisions (0);
|
||||||
XMLNode& before (_session->locations()->get_state());
|
XMLNode& before (_session->locations()->get_state());
|
||||||
Locations::LocationList copy (_session->locations()->list());
|
Locations::LocationList copy (_session->locations()->list());
|
||||||
|
|
||||||
|
|
@ -7502,9 +7505,9 @@ Editor::insert_time (
|
||||||
if ((*i)->start() >= pos) {
|
if ((*i)->start() >= pos) {
|
||||||
// move end first, in case we're moving by more than the length of the range
|
// move end first, in case we're moving by more than the length of the range
|
||||||
if (!(*i)->is_mark()) {
|
if (!(*i)->is_mark()) {
|
||||||
(*i)->set_end ((*i)->end() + frames);
|
(*i)->set_end ((*i)->end() + frames, false, true, divisions);
|
||||||
}
|
}
|
||||||
(*i)->set_start ((*i)->start() + frames);
|
(*i)->set_start ((*i)->start() + frames, false, true, divisions);
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7617,6 +7620,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int32_t divisions = get_grid_music_divisions (0);
|
||||||
std::list<Location*> loc_kill_list;
|
std::list<Location*> loc_kill_list;
|
||||||
|
|
||||||
/* markers */
|
/* markers */
|
||||||
|
|
@ -7645,20 +7649,20 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
|
||||||
// if we're removing more time than the length of the range
|
// if we're removing more time than the length of the range
|
||||||
if ((*i)->start() >= pos && (*i)->start() < pos+frames) {
|
if ((*i)->start() >= pos && (*i)->start() < pos+frames) {
|
||||||
// start is within cut
|
// start is within cut
|
||||||
(*i)->set_start (pos); // bring the start marker to the beginning of the cut
|
(*i)->set_start (pos, false, true,divisions); // bring the start marker to the beginning of the cut
|
||||||
moved = true;
|
moved = true;
|
||||||
} else if ((*i)->start() >= pos+frames) {
|
} else if ((*i)->start() >= pos+frames) {
|
||||||
// start (and thus entire range) lies beyond end of cut
|
// start (and thus entire range) lies beyond end of cut
|
||||||
(*i)->set_start ((*i)->start() - frames); // slip the start marker back
|
(*i)->set_start ((*i)->start() - frames, false, true, divisions); // slip the start marker back
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
if ((*i)->end() >= pos && (*i)->end() < pos+frames) {
|
if ((*i)->end() >= pos && (*i)->end() < pos+frames) {
|
||||||
// end is inside cut
|
// end is inside cut
|
||||||
(*i)->set_end (pos); // bring the end to the cut
|
(*i)->set_end (pos, false, true, divisions); // bring the end to the cut
|
||||||
moved = true;
|
moved = true;
|
||||||
} else if ((*i)->end() >= pos+frames) {
|
} else if ((*i)->end() >= pos+frames) {
|
||||||
// end is beyond end of cut
|
// end is beyond end of cut
|
||||||
(*i)->set_end ((*i)->end() - frames); // slip the end marker back
|
(*i)->set_end ((*i)->end() - frames, false, true, divisions); // slip the end marker back
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7667,7 +7671,7 @@ Editor::remove_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
|
||||||
loc_kill_list.push_back(*i);
|
loc_kill_list.push_back(*i);
|
||||||
moved = true;
|
moved = true;
|
||||||
} else if ((*i)->start() >= pos) {
|
} else if ((*i)->start() >= pos) {
|
||||||
(*i)->set_start ((*i)->start() -frames);
|
(*i)->set_start ((*i)->start() -frames, false, true, divisions);
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -414,12 +414,14 @@ LocationEditRow::to_playhead_button_pressed (LocationPart part)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int32_t divisions = PublicEditor::instance().get_grid_music_divisions (0);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case LocStart:
|
case LocStart:
|
||||||
location->set_start (_session->transport_frame ());
|
location->set_start (_session->transport_frame (), false, true, divisions);
|
||||||
break;
|
break;
|
||||||
case LocEnd:
|
case LocEnd:
|
||||||
location->set_end (_session->transport_frame ());
|
location->set_end (_session->transport_frame (), false, true,divisions);
|
||||||
if (location->is_session_range()) {
|
if (location->is_session_range()) {
|
||||||
_session->set_end_is_free (false);
|
_session->set_end_is_free (false);
|
||||||
}
|
}
|
||||||
|
|
@ -461,18 +463,20 @@ LocationEditRow::clock_changed (LocationPart part)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int32_t divisions = PublicEditor::instance().get_grid_music_divisions (0);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case LocStart:
|
case LocStart:
|
||||||
location->set_start (start_clock.current_time());
|
location->set_start (start_clock.current_time(), false, true, divisions);
|
||||||
break;
|
break;
|
||||||
case LocEnd:
|
case LocEnd:
|
||||||
location->set_end (end_clock.current_time());
|
location->set_end (end_clock.current_time(), false, true, divisions);
|
||||||
if (location->is_session_range()) {
|
if (location->is_session_range()) {
|
||||||
_session->set_end_is_free (false);
|
_session->set_end_is_free (false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LocLength:
|
case LocLength:
|
||||||
location->set_end (location->start() + length_clock.current_duration());
|
location->set_end (location->start() + length_clock.current_duration(), false, true, divisions);
|
||||||
if (location->is_session_range()) {
|
if (location->is_session_range()) {
|
||||||
_session->set_end_is_free (false);
|
_session->set_end_is_free (false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
|
||||||
};
|
};
|
||||||
|
|
||||||
Location (Session &);
|
Location (Session &);
|
||||||
Location (Session &, framepos_t, framepos_t, const std::string &, Flags bits = Flags(0));
|
Location (Session &, framepos_t, framepos_t, const std::string &, Flags bits = Flags(0), const uint32_t sub_num = 0);
|
||||||
Location (const Location& other);
|
Location (const Location& other);
|
||||||
Location (Session &, const XMLNode&);
|
Location (Session &, const XMLNode&);
|
||||||
Location* operator= (const Location& other);
|
Location* operator= (const Location& other);
|
||||||
|
|
@ -73,11 +73,11 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
|
||||||
framepos_t end() const { return _end; }
|
framepos_t end() const { return _end; }
|
||||||
framecnt_t length() const { return _end - _start; }
|
framecnt_t length() const { return _end - _start; }
|
||||||
|
|
||||||
int set_start (framepos_t s, bool force = false, bool allow_bbt_recompute = true);
|
int set_start (framepos_t s, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
|
||||||
int set_end (framepos_t e, bool force = false, bool allow_bbt_recompute = true);
|
int set_end (framepos_t e, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
|
||||||
int set (framepos_t start, framepos_t end, bool allow_bbt_recompute = true);
|
int set (framepos_t start, framepos_t end, bool allow_beat_recompute = true, const uint32_t sub_num = 0);
|
||||||
|
|
||||||
int move_to (framepos_t pos);
|
int move_to (framepos_t pos, const uint32_t sub_num);
|
||||||
|
|
||||||
const std::string& name() const { return _name; }
|
const std::string& name() const { return _name; }
|
||||||
void set_name (const std::string &str);
|
void set_name (const std::string &str);
|
||||||
|
|
@ -143,7 +143,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
|
||||||
|
|
||||||
PositionLockStyle position_lock_style() const { return _position_lock_style; }
|
PositionLockStyle position_lock_style() const { return _position_lock_style; }
|
||||||
void set_position_lock_style (PositionLockStyle ps);
|
void set_position_lock_style (PositionLockStyle ps);
|
||||||
void recompute_frames_from_bbt ();
|
void recompute_frames_from_beat ();
|
||||||
|
|
||||||
static PBD::Signal0<void> scene_changed; /* for use by backend scene change management, class level */
|
static PBD::Signal0<void> scene_changed; /* for use by backend scene change management, class level */
|
||||||
PBD::Signal0<void> SceneChangeChanged; /* for use by objects interested in this object */
|
PBD::Signal0<void> SceneChangeChanged; /* for use by objects interested in this object */
|
||||||
|
|
@ -151,9 +151,9 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
|
||||||
private:
|
private:
|
||||||
std::string _name;
|
std::string _name;
|
||||||
framepos_t _start;
|
framepos_t _start;
|
||||||
double _bbt_start;
|
double _start_beat;
|
||||||
framepos_t _end;
|
framepos_t _end;
|
||||||
double _bbt_end;
|
double _end_beat;
|
||||||
Flags _flags;
|
Flags _flags;
|
||||||
bool _locked;
|
bool _locked;
|
||||||
PositionLockStyle _position_lock_style;
|
PositionLockStyle _position_lock_style;
|
||||||
|
|
@ -161,7 +161,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
|
||||||
|
|
||||||
void set_mark (bool yn);
|
void set_mark (bool yn);
|
||||||
bool set_flag_internal (bool yn, Flags flag);
|
bool set_flag_internal (bool yn, Flags flag);
|
||||||
void recompute_bbt_from_frames ();
|
void recompute_beat_from_frames (const uint32_t sub_num);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A collection of session locations including unique dedicated locations (loop, punch, etc) */
|
/** A collection of session locations including unique dedicated locations (loop, punch, etc) */
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,9 @@ PBD::Signal1<void,Location*> Location::changed;
|
||||||
Location::Location (Session& s)
|
Location::Location (Session& s)
|
||||||
: SessionHandleRef (s)
|
: SessionHandleRef (s)
|
||||||
, _start (0)
|
, _start (0)
|
||||||
|
, _start_beat (0.0)
|
||||||
, _end (0)
|
, _end (0)
|
||||||
|
, _end_beat (0.0)
|
||||||
, _flags (Flags (0))
|
, _flags (Flags (0))
|
||||||
, _locked (false)
|
, _locked (false)
|
||||||
, _position_lock_style (AudioTime)
|
, _position_lock_style (AudioTime)
|
||||||
|
|
@ -64,7 +66,7 @@ Location::Location (Session& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct a new Location, giving it the position lock style determined by glue-new-markers-to-bars-and-beats */
|
/** Construct a new Location, giving it the position lock style determined by glue-new-markers-to-bars-and-beats */
|
||||||
Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end, const std::string &name, Flags bits)
|
Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end, const std::string &name, Flags bits, const uint32_t sub_num)
|
||||||
: SessionHandleRef (s)
|
: SessionHandleRef (s)
|
||||||
, _name (name)
|
, _name (name)
|
||||||
, _start (sample_start)
|
, _start (sample_start)
|
||||||
|
|
@ -74,7 +76,7 @@ Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end,
|
||||||
, _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime)
|
, _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime)
|
||||||
|
|
||||||
{
|
{
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
|
|
||||||
assert (_start >= 0);
|
assert (_start >= 0);
|
||||||
assert (_end >= 0);
|
assert (_end >= 0);
|
||||||
|
|
@ -85,9 +87,9 @@ Location::Location (const Location& other)
|
||||||
, StatefulDestructible()
|
, StatefulDestructible()
|
||||||
, _name (other._name)
|
, _name (other._name)
|
||||||
, _start (other._start)
|
, _start (other._start)
|
||||||
, _bbt_start (other._bbt_start)
|
, _start_beat (other._start_beat)
|
||||||
, _end (other._end)
|
, _end (other._end)
|
||||||
, _bbt_end (other._bbt_end)
|
, _end_beat (other._end_beat)
|
||||||
, _flags (other._flags)
|
, _flags (other._flags)
|
||||||
, _position_lock_style (other._position_lock_style)
|
, _position_lock_style (other._position_lock_style)
|
||||||
|
|
||||||
|
|
@ -125,8 +127,8 @@ Location::operator== (const Location& other)
|
||||||
if (_name != other._name ||
|
if (_name != other._name ||
|
||||||
_start != other._start ||
|
_start != other._start ||
|
||||||
_end != other._end ||
|
_end != other._end ||
|
||||||
_bbt_start != other._bbt_start ||
|
_start_beat != other._start_beat ||
|
||||||
_bbt_end != other._bbt_end ||
|
_end_beat != other._end_beat ||
|
||||||
_flags != other._flags ||
|
_flags != other._flags ||
|
||||||
_position_lock_style != other._position_lock_style) {
|
_position_lock_style != other._position_lock_style) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -143,9 +145,9 @@ Location::operator= (const Location& other)
|
||||||
|
|
||||||
_name = other._name;
|
_name = other._name;
|
||||||
_start = other._start;
|
_start = other._start;
|
||||||
_bbt_start = other._bbt_start;
|
_start_beat = other._start_beat;
|
||||||
_end = other._end;
|
_end = other._end;
|
||||||
_bbt_end = other._bbt_end;
|
_end_beat = other._end_beat;
|
||||||
_flags = other._flags;
|
_flags = other._flags;
|
||||||
_position_lock_style = other._position_lock_style;
|
_position_lock_style = other._position_lock_style;
|
||||||
|
|
||||||
|
|
@ -178,10 +180,10 @@ Location::set_name (const std::string& str)
|
||||||
/** Set start position.
|
/** Set start position.
|
||||||
* @param s New start.
|
* @param s New start.
|
||||||
* @param force true to force setting, even if the given new start is after the current end.
|
* @param force true to force setting, even if the given new start is after the current end.
|
||||||
* @param allow_bbt_recompute True to recompute BBT start time from the new given start time.
|
* @param allow_beat_recompute True to recompute BEAT start time from the new given start time.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
|
Location::set_start (framepos_t s, bool force, bool allow_beat_recompute, const uint32_t sub_num)
|
||||||
{
|
{
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -201,8 +203,8 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
|
||||||
if (_start != s) {
|
if (_start != s) {
|
||||||
_start = s;
|
_start = s;
|
||||||
_end = s;
|
_end = s;
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
start_changed (this); /* EMIT SIGNAL */
|
start_changed (this); /* EMIT SIGNAL */
|
||||||
|
|
@ -235,8 +237,8 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
|
||||||
framepos_t const old = _start;
|
framepos_t const old = _start;
|
||||||
|
|
||||||
_start = s;
|
_start = s;
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
start_changed (this); /* EMIT SIGNAL */
|
start_changed (this); /* EMIT SIGNAL */
|
||||||
StartChanged (); /* EMIT SIGNAL */
|
StartChanged (); /* EMIT SIGNAL */
|
||||||
|
|
@ -255,10 +257,10 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
|
||||||
/** Set end position.
|
/** Set end position.
|
||||||
* @param s New end.
|
* @param s New end.
|
||||||
* @param force true to force setting, even if the given new end is before the current start.
|
* @param force true to force setting, even if the given new end is before the current start.
|
||||||
* @param allow_bbt_recompute True to recompute BBT end time from the new given end time.
|
* @param allow_beat_recompute True to recompute BEAT end time from the new given end time.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
|
Location::set_end (framepos_t e, bool force, bool allow_beat_recompute, const uint32_t sub_num)
|
||||||
{
|
{
|
||||||
if (e < 0) {
|
if (e < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -278,8 +280,8 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
|
||||||
if (_start != e) {
|
if (_start != e) {
|
||||||
_start = e;
|
_start = e;
|
||||||
_end = e;
|
_end = e;
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
//start_changed (this); /* EMIT SIGNAL */
|
//start_changed (this); /* EMIT SIGNAL */
|
||||||
//StartChanged (); /* EMIT SIGNAL */
|
//StartChanged (); /* EMIT SIGNAL */
|
||||||
|
|
@ -303,8 +305,8 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
|
||||||
framepos_t const old = _end;
|
framepos_t const old = _end;
|
||||||
|
|
||||||
_end = e;
|
_end = e;
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
end_changed(this); /* EMIT SIGNAL */
|
end_changed(this); /* EMIT SIGNAL */
|
||||||
|
|
@ -321,7 +323,7 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Location::set (framepos_t s, framepos_t e, bool allow_bbt_recompute)
|
Location::set (framepos_t s, framepos_t e, bool allow_beat_recompute, const uint32_t sub_num)
|
||||||
{
|
{
|
||||||
if (s < 0 || e < 0) {
|
if (s < 0 || e < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -341,8 +343,8 @@ Location::set (framepos_t s, framepos_t e, bool allow_bbt_recompute)
|
||||||
_start = s;
|
_start = s;
|
||||||
_end = s;
|
_end = s;
|
||||||
|
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
start_change = true;
|
start_change = true;
|
||||||
|
|
@ -364,8 +366,8 @@ Location::set (framepos_t s, framepos_t e, bool allow_bbt_recompute)
|
||||||
framepos_t const old = _start;
|
framepos_t const old = _start;
|
||||||
_start = s;
|
_start = s;
|
||||||
|
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
start_change = true;
|
start_change = true;
|
||||||
|
|
@ -382,8 +384,8 @@ Location::set (framepos_t s, framepos_t e, bool allow_bbt_recompute)
|
||||||
framepos_t const old = _end;
|
framepos_t const old = _end;
|
||||||
_end = e;
|
_end = e;
|
||||||
|
|
||||||
if (allow_bbt_recompute) {
|
if (allow_beat_recompute) {
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
end_change = true;
|
end_change = true;
|
||||||
|
|
@ -411,7 +413,7 @@ Location::set (framepos_t s, framepos_t e, bool allow_bbt_recompute)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Location::move_to (framepos_t pos)
|
Location::move_to (framepos_t pos, const uint32_t sub_num)
|
||||||
{
|
{
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -424,7 +426,7 @@ Location::move_to (framepos_t pos)
|
||||||
if (_start != pos) {
|
if (_start != pos) {
|
||||||
_start = pos;
|
_start = pos;
|
||||||
_end = _start + length();
|
_end = _start + length();
|
||||||
recompute_bbt_from_frames ();
|
recompute_beat_from_frames (sub_num);
|
||||||
|
|
||||||
changed (this); /* EMIT SIGNAL */
|
changed (this); /* EMIT SIGNAL */
|
||||||
Changed (); /* EMIT SIGNAL */
|
Changed (); /* EMIT SIGNAL */
|
||||||
|
|
@ -580,6 +582,14 @@ Location::get_state ()
|
||||||
node->add_property ("start", buf);
|
node->add_property ("start", buf);
|
||||||
snprintf (buf, sizeof (buf), "%" PRId64, end());
|
snprintf (buf, sizeof (buf), "%" PRId64, end());
|
||||||
node->add_property ("end", buf);
|
node->add_property ("end", buf);
|
||||||
|
|
||||||
|
if (position_lock_style() == MusicTime) {
|
||||||
|
snprintf (buf, sizeof (buf), "%lf", _start_beat);
|
||||||
|
node->add_property ("start-beat", buf);
|
||||||
|
snprintf (buf, sizeof (buf), "%lf", _end_beat);
|
||||||
|
node->add_property ("end-beat", buf);
|
||||||
|
}
|
||||||
|
|
||||||
node->add_property ("flags", enum_2_string (_flags));
|
node->add_property ("flags", enum_2_string (_flags));
|
||||||
node->add_property ("locked", (_locked ? "yes" : "no"));
|
node->add_property ("locked", (_locked ? "yes" : "no"));
|
||||||
node->add_property ("position-lock-style", enum_2_string (_position_lock_style));
|
node->add_property ("position-lock-style", enum_2_string (_position_lock_style));
|
||||||
|
|
@ -689,7 +699,27 @@ Location::set_state (const XMLNode& node, int version)
|
||||||
_scene_change = SceneChange::factory (*scene_child, version);
|
_scene_change = SceneChange::factory (*scene_child, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
recompute_bbt_from_frames ();
|
if (position_lock_style() == AudioTime) {
|
||||||
|
recompute_beat_from_frames (0);
|
||||||
|
} else{
|
||||||
|
/* music */
|
||||||
|
bool has_beat = false;
|
||||||
|
|
||||||
|
if ((prop = node.property ("start-beat")) != 0) {
|
||||||
|
sscanf (prop->value().c_str(), "%lf", &_start_beat);
|
||||||
|
has_beat = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((prop = node.property ("end-beat")) != 0) {
|
||||||
|
sscanf (prop->value().c_str(), "%lf", &_end_beat);
|
||||||
|
has_beat = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_beat) {
|
||||||
|
recompute_beat_from_frames (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
changed (this); /* EMIT SIGNAL */
|
changed (this); /* EMIT SIGNAL */
|
||||||
Changed (); /* EMIT SIGNAL */
|
Changed (); /* EMIT SIGNAL */
|
||||||
|
|
@ -709,32 +739,30 @@ Location::set_position_lock_style (PositionLockStyle ps)
|
||||||
|
|
||||||
_position_lock_style = ps;
|
_position_lock_style = ps;
|
||||||
|
|
||||||
recompute_bbt_from_frames ();
|
if (ps == MusicTime) {
|
||||||
|
recompute_beat_from_frames (0);
|
||||||
|
}
|
||||||
|
|
||||||
position_lock_style_changed (this); /* EMIT SIGNAL */
|
position_lock_style_changed (this); /* EMIT SIGNAL */
|
||||||
PositionLockStyleChanged (); /* EMIT SIGNAL */
|
PositionLockStyleChanged (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Location::recompute_bbt_from_frames ()
|
Location::recompute_beat_from_frames (const uint32_t sub_num)
|
||||||
{
|
{
|
||||||
if (_position_lock_style != MusicTime) {
|
_start_beat = _session.tempo_map().exact_beat_at_frame (_start, sub_num);
|
||||||
return;
|
_end_beat = _session.tempo_map().exact_beat_at_frame (_end, sub_num);
|
||||||
}
|
|
||||||
|
|
||||||
_bbt_start = _session.tempo_map().beat_at_frame (_start);
|
|
||||||
_bbt_end = _session.tempo_map().beat_at_frame (_end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Location::recompute_frames_from_bbt ()
|
Location::recompute_frames_from_beat ()
|
||||||
{
|
{
|
||||||
if (_position_lock_style != MusicTime) {
|
if (_position_lock_style != MusicTime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TempoMap& map (_session.tempo_map());
|
TempoMap& map (_session.tempo_map());
|
||||||
set (map.frame_at_beat (_bbt_start), map.frame_at_beat (_bbt_end), false);
|
set (map.frame_at_beat (_start_beat), map.frame_at_beat (_end_beat), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1060,7 +1088,7 @@ Locations::set_state (const XMLNode& node, int version)
|
||||||
|
|
||||||
Location* session_range_location = 0;
|
Location* session_range_location = 0;
|
||||||
if (version < 3000) {
|
if (version < 3000) {
|
||||||
session_range_location = new Location (_session, 0, 0, _("session"), Location::IsSessionRange);
|
session_range_location = new Location (_session, 0, 0, _("session"), Location::IsSessionRange, 0);
|
||||||
new_locations.push_back (session_range_location);
|
new_locations.push_back (session_range_location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ MIDISceneChanger::program_change_input (MIDI::Parser& parser, MIDI::byte program
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loc = new Location (_session, time, time, new_name, Location::IsMark);
|
loc = new Location (_session, time, time, new_name, Location::IsMark, 0);
|
||||||
new_mark = true;
|
new_mark = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1682,7 +1682,7 @@ Session::set_session_extents (framepos_t start, framepos_t end)
|
||||||
Location* existing;
|
Location* existing;
|
||||||
if ((existing = _locations->session_range_location()) == 0) {
|
if ((existing = _locations->session_range_location()) == 0) {
|
||||||
//if there is no existing session, we need to make a new session location (should never happen)
|
//if there is no existing session, we need to make a new session location (should never happen)
|
||||||
existing = new Location (*this, 0, 0, _("session"), Location::IsSessionRange);
|
existing = new Location (*this, 0, 0, _("session"), Location::IsSessionRange, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end <= start) {
|
if (end <= start) {
|
||||||
|
|
@ -5582,7 +5582,7 @@ void
|
||||||
Session::update_locations_after_tempo_map_change (const Locations::LocationList& loc)
|
Session::update_locations_after_tempo_map_change (const Locations::LocationList& loc)
|
||||||
{
|
{
|
||||||
for (Locations::LocationList::const_iterator i = loc.begin(); i != loc.end(); ++i) {
|
for (Locations::LocationList::const_iterator i = loc.begin(); i != loc.end(); ++i) {
|
||||||
(*i)->recompute_frames_from_bbt ();
|
(*i)->recompute_frames_from_beat ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6340,7 +6340,7 @@ Session::current_end_frame () const
|
||||||
void
|
void
|
||||||
Session::set_session_range_location (framepos_t start, framepos_t end)
|
Session::set_session_range_location (framepos_t start, framepos_t end)
|
||||||
{
|
{
|
||||||
_session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange);
|
_session_range_location = new Location (*this, start, end, _("session"), Location::IsSessionRange, 0);
|
||||||
_locations->add (_session_range_location);
|
_locations->add (_session_range_location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -634,7 +634,7 @@ Session::create (const string& session_template, BusProfile* bus_profile)
|
||||||
|
|
||||||
/* Initial loop location, from absolute zero, length 10 seconds */
|
/* Initial loop location, from absolute zero, length 10 seconds */
|
||||||
|
|
||||||
Location* loc = new Location (*this, 0, 10.0 * _engine.sample_rate(), _("Loop"), Location::IsAutoLoop);
|
Location* loc = new Location (*this, 0, 10.0 * _engine.sample_rate(), _("Loop"), Location::IsAutoLoop, 0);
|
||||||
_locations->add (loc, true);
|
_locations->add (loc, true);
|
||||||
set_auto_loop_location (loc);
|
set_auto_loop_location (loc);
|
||||||
}
|
}
|
||||||
|
|
@ -1220,7 +1220,7 @@ Session::state (bool full_state)
|
||||||
Locations loc (*this);
|
Locations loc (*this);
|
||||||
// for a template, just create a new Locations, populate it
|
// for a template, just create a new Locations, populate it
|
||||||
// with the default start and end, and get the state for that.
|
// with the default start and end, and get the state for that.
|
||||||
Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange);
|
Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange, 0);
|
||||||
range->set (max_framepos, 0);
|
range->set (max_framepos, 0);
|
||||||
loc.add (range);
|
loc.add (range);
|
||||||
XMLNode& locations_state = loc.get_state();
|
XMLNode& locations_state = loc.get_state();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue