Make the session start/end location a single location (with start and end) rather than two separate ones. Fixes #1298.

git-svn-id: svn://localhost/ardour2/branches/3.0@6929 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-04-18 21:29:48 +00:00
parent d9cac66b5d
commit 895bad1dcd
15 changed files with 94 additions and 134 deletions

View file

@ -344,7 +344,7 @@ Editor::Editor ()
editor_ruler_menu = 0; editor_ruler_menu = 0;
no_ruler_shown_update = false; no_ruler_shown_update = false;
marker_menu = 0; marker_menu = 0;
start_end_marker_menu = 0; session_range_marker_menu = 0;
range_marker_menu = 0; range_marker_menu = 0;
marker_menu_item = 0; marker_menu_item = 0;
tm_marker_menu = 0; tm_marker_menu = 0;
@ -1105,7 +1105,7 @@ Editor::set_session (Session *t)
_session->locations()->removed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::location_gone, this, _1), gui_context()); _session->locations()->removed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::location_gone, this, _1), gui_context());
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context()); _session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context());
_session->locations()->StateChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::refresh_location_display_s, this, _1), gui_context()); _session->locations()->StateChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::refresh_location_display_s, this, _1), gui_context());
_session->locations()->end_location()->changed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::end_location_changed, this, _1), gui_context()); _session->locations()->session_range_location()->changed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::session_range_location_changed, this, _1), gui_context());
_session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context()); _session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
if (Profile->get_sae()) { if (Profile->get_sae()) {
@ -3886,11 +3886,11 @@ Editor::get_nudge_distance (nframes64_t pos, nframes64_t& next)
} }
void void
Editor::end_location_changed (Location* location) Editor::session_range_location_changed (Location* location)
{ {
ENSURE_GUI_THREAD (*this, &Editor::end_location_changed, location) ENSURE_GUI_THREAD (*this, &Editor::session_range_location_changed, location)
//reset_scrolling_region (); //reset_scrolling_region ();
nframes64_t session_span = location->start() + (nframes64_t) floorf (current_page_frames() * 0.10f); nframes64_t const session_span = location->end() + (nframes64_t) floorf (current_page_frames() * 0.10f);
horizontal_adjustment.set_upper (session_span / frames_per_unit); horizontal_adjustment.set_upper (session_span / frames_per_unit);
} }

View file

@ -977,7 +977,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void queue_visual_change_y (double); void queue_visual_change_y (double);
void ensure_visual_change_idle_handler (); void ensure_visual_change_idle_handler ();
void end_location_changed (ARDOUR::Location*); void session_range_location_changed (ARDOUR::Location*);
/* track views */ /* track views */
TrackViewList track_views; TrackViewList track_views;
@ -1468,13 +1468,13 @@ public:
void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*); void transport_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 loop_or_punch); void build_range_marker_menu (bool loop_or_punch);
void build_marker_menu (bool start_or_end); void build_marker_menu (bool);
void build_tm_marker_menu (); void build_tm_marker_menu ();
void build_new_transport_marker_menu (); void build_new_transport_marker_menu ();
Gtk::Menu* tm_marker_menu; Gtk::Menu* tm_marker_menu;
Gtk::Menu* marker_menu; Gtk::Menu* marker_menu;
Gtk::Menu* start_end_marker_menu; Gtk::Menu* session_range_marker_menu;
Gtk::Menu* range_marker_menu; Gtk::Menu* range_marker_menu;
Gtk::Menu* transport_marker_menu; Gtk::Menu* transport_marker_menu;
Gtk::Menu* new_transport_marker_menu; Gtk::Menu* new_transport_marker_menu;

View file

@ -2491,10 +2491,10 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
break; break;
} }
/* set up copies for us to manipulate during the drag */ /* Set up copies for us to manipulate during the drag */
for (MarkerSelection::iterator i = _editor->selection->markers.begin(); i != _editor->selection->markers.end(); ++i) { for (MarkerSelection::iterator i = _editor->selection->markers.begin(); i != _editor->selection->markers.end(); ++i) {
Location *l = _editor->find_location_from_marker (*i, is_start); Location* l = _editor->find_location_from_marker (*i, is_start);
_copied_locations.push_back (new Location (*l)); _copied_locations.push_back (new Location (*l));
} }
} }
@ -2506,7 +2506,7 @@ MarkerDrag::motion (GdkEvent* event, bool)
bool is_start; bool is_start;
bool move_both = false; bool move_both = false;
Marker* marker; Marker* marker;
Location *real_location; Location *real_location;
Location *copy_location = 0; Location *copy_location = 0;
nframes64_t const newframe = adjusted_current_frame (event); nframes64_t const newframe = adjusted_current_frame (event);
@ -2592,7 +2592,7 @@ MarkerDrag::motion (GdkEvent* event, bool)
if (copy_location->is_mark()) { if (copy_location->is_mark()) {
/* just move it */ /* now move it */
copy_location->set_start (copy_location->start() + f_delta); copy_location->set_start (copy_location->start() + f_delta);

View file

@ -101,6 +101,11 @@ Editor::add_new_location (Location *location)
lam->end = new Marker (*this, *transport_marker_group, color, lam->end = new Marker (*this, *transport_marker_group, color,
location->name(), Marker::PunchOut, location->end()); location->name(), Marker::PunchOut, location->end());
} else if (location->is_session_range()) {
// session range
lam->start = new Marker (*this, *marker_group, color, _("start"), Marker::Start, location->start());
lam->end = new Marker (*this, *marker_group, color, _("end"), Marker::End, location->end());
} else { } else {
// range marker // range marker
if (location->is_cd_marker() && ruler_cd_marker_action->get_active()) { if (location->is_cd_marker() && ruler_cd_marker_action->get_active()) {
@ -110,7 +115,6 @@ Editor::add_new_location (Location *location)
location->name(), Marker::End, location->end()); location->name(), Marker::End, location->end());
} }
else { else {
lam->start = new Marker (*this, *range_marker_group, color, lam->start = new Marker (*this, *range_marker_group, color,
location->name(), Marker::Start, location->start()); location->name(), Marker::Start, location->start());
lam->end = new Marker (*this, *range_marker_group, color, lam->end = new Marker (*this, *range_marker_group, color,
@ -155,7 +159,7 @@ Editor::location_changed (Location *location)
return; return;
} }
lam->set_name (location->name()); lam->set_name (location->name ());
lam->set_position (location->start(), location->end()); lam->set_position (location->start(), location->end());
if (location->is_auto_loop()) { if (location->is_auto_loop()) {
@ -365,8 +369,15 @@ Editor::LocationMarkers::show()
void void
Editor::LocationMarkers::set_name (const string& str) Editor::LocationMarkers::set_name (const string& str)
{ {
start->set_name (str); /* XXX: hack: don't change names of session start/end markers */
if (end) { end->set_name (str); }
if (start->type() != Marker::Start) {
start->set_name (str);
}
if (end && end->type() != Marker::End) {
end->set_name (str);
}
} }
void void
@ -510,12 +521,12 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
} else { } else {
if (loc->is_mark()) { if (loc->is_mark()) {
bool start_or_end = loc->is_start() || loc->is_end();
Menu *markerMenu; Menu *markerMenu;
if (start_or_end) { if (loc->is_session_range ()) {
if (start_end_marker_menu == 0) if (session_range_marker_menu == 0) {
build_marker_menu (true); build_marker_menu (true);
markerMenu = start_end_marker_menu; }
markerMenu = session_range_marker_menu;
} else { } else {
if (marker_menu == 0) if (marker_menu == 0)
build_marker_menu (false); build_marker_menu (false);
@ -573,13 +584,13 @@ Editor::transport_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item*)
} }
void void
Editor::build_marker_menu (bool start_or_end) Editor::build_marker_menu (bool session_range)
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
Menu *markerMenu = new Menu; Menu *markerMenu = new Menu;
if (start_or_end) { if (session_range) {
start_end_marker_menu = markerMenu; session_range_marker_menu = markerMenu;
} else { } else {
marker_menu = markerMenu; marker_menu = markerMenu;
} }
@ -595,7 +606,9 @@ Editor::build_marker_menu (bool start_or_end)
items.push_back (MenuElem (_("Create range to next marker"), sigc::mem_fun(*this, &Editor::marker_menu_range_to_next))); items.push_back (MenuElem (_("Create range to next marker"), sigc::mem_fun(*this, &Editor::marker_menu_range_to_next)));
items.push_back (MenuElem (_("Hide"), sigc::mem_fun(*this, &Editor::marker_menu_hide))); items.push_back (MenuElem (_("Hide"), sigc::mem_fun(*this, &Editor::marker_menu_hide)));
if (start_or_end) return; if (session_range) {
return;
}
items.push_back (MenuElem (_("Rename"), sigc::mem_fun(*this, &Editor::marker_menu_rename))); items.push_back (MenuElem (_("Rename"), sigc::mem_fun(*this, &Editor::marker_menu_rename)));
items.push_back (MenuElem (_("Lock"), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_lock), true))); items.push_back (MenuElem (_("Lock"), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_lock), true)));
items.push_back (MenuElem (_("Unlock"), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_lock), false))); items.push_back (MenuElem (_("Unlock"), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_lock), false)));
@ -1203,7 +1216,7 @@ Editor::goto_nth_marker (int n)
ordered.sort (cmp); ordered.sort (cmp);
for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) { for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) {
if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_start()) { if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_session_range()) {
if (n == 0) { if (n == 0) {
_session->request_locate ((*i)->start(), _session->transport_rolling()); _session->request_locate ((*i)->start(), _session->transport_rolling());
break; break;

View file

@ -226,7 +226,7 @@ LocationEditRow::set_location (Location *loc)
item_table.attach (remove_button, 6, 7, 0, 1, FILL, FILL, 4, 0); item_table.attach (remove_button, 6, 7, 0, 1, FILL, FILL, 4, 0);
} }
if (location->is_end() || location->is_start()) { if (location->is_session_range()) {
remove_button.set_sensitive (false); remove_button.set_sensitive (false);
} }
@ -671,7 +671,7 @@ LocationUI::do_location_remove (ARDOUR::Location *loc)
cannot be removed. cannot be removed.
*/ */
if (loc->is_end()) { if (loc->is_session_range()) {
return FALSE; return FALSE;
} }

View file

@ -45,8 +45,8 @@ class Marker : public sigc::trackable
Mark, Mark,
Tempo, Tempo,
Meter, Meter,
Start, Start, ///< session start
End, End, ///< session end
LoopStart, LoopStart,
LoopEnd, LoopEnd,
PunchIn, PunchIn,

View file

@ -48,7 +48,7 @@ sigc::signal<void> ColorsChanged;
sigc::signal<void,uint32_t> ColorChanged; sigc::signal<void,uint32_t> ColorChanged;
ThemeManager::ThemeManager() ThemeManager::ThemeManager()
: ArdourDialog (_("ThemeManager")), : ArdourDialog (_("Theme Manager")),
dark_button (_("Dark Theme")), dark_button (_("Dark Theme")),
light_button (_("Light Theme")), light_button (_("Light Theme")),
reset_button (_("Restore Defaults")) reset_button (_("Restore Defaults"))

View file

@ -46,9 +46,8 @@ class Location : public PBD::StatefulDestructible
IsAutoLoop = 0x4, IsAutoLoop = 0x4,
IsHidden = 0x8, IsHidden = 0x8,
IsCDMarker = 0x10, IsCDMarker = 0x10,
IsEnd = 0x20, IsRangeMarker = 0x20,
IsRangeMarker = 0x40, IsSessionRange = 0x40
IsStart = 0x80
}; };
Location (nframes64_t sample_start, Location (nframes64_t sample_start,
@ -94,8 +93,7 @@ class Location : public PBD::StatefulDestructible
void set_auto_loop (bool yn, void *src); void set_auto_loop (bool yn, void *src);
void set_hidden (bool yn, void *src); void set_hidden (bool yn, void *src);
void set_cd (bool yn, void *src); void set_cd (bool yn, void *src);
void set_is_end (bool yn, void* src); void set_is_session_range (bool yn, void* src);
void set_is_start (bool yn, void* src);
void set_is_range_marker (bool yn, void* src); void set_is_range_marker (bool yn, void* src);
bool is_auto_punch () const { return _flags & IsAutoPunch; } bool is_auto_punch () const { return _flags & IsAutoPunch; }
@ -103,8 +101,7 @@ class Location : public PBD::StatefulDestructible
bool is_mark () const { return _flags & IsMark; } bool is_mark () const { return _flags & IsMark; }
bool is_hidden () const { return _flags & IsHidden; } bool is_hidden () const { return _flags & IsHidden; }
bool is_cd_marker () const { return _flags & IsCDMarker; } bool is_cd_marker () const { return _flags & IsCDMarker; }
bool is_end() const { return _flags & IsEnd; } bool is_session_range () const { return _flags & IsSessionRange; }
bool is_start() const { return _flags & IsStart; }
bool is_range_marker() const { return _flags & IsRangeMarker; } bool is_range_marker() const { return _flags & IsRangeMarker; }
bool matches (Flags f) const { return _flags & f; } bool matches (Flags f) const { return _flags & f; }
@ -159,8 +156,7 @@ class Locations : public PBD::StatefulDestructible
Location* auto_loop_location () const; Location* auto_loop_location () const;
Location* auto_punch_location () const; Location* auto_punch_location () const;
Location* end_location() const; Location* session_range_location() const;
Location* start_location() const;
int next_available_name(std::string& result,std::string base); int next_available_name(std::string& result,std::string base);
uint32_t num_range_markers() const; uint32_t num_range_markers() const;

View file

@ -299,10 +299,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
bool get_play_loop () const { return play_loop; } bool get_play_loop () const { return play_loop; }
nframes_t last_transport_start() const { return _last_roll_location; } nframes_t last_transport_start() const { return _last_roll_location; }
void goto_end () { request_locate (end_location->start(), false);} void goto_end () { request_locate (_session_range_location->end(), false);}
void goto_start () { request_locate (start_location->start(), false); } void goto_start () { request_locate (_session_range_location->start(), false); }
void set_session_start (nframes_t start) { start_location->set_start(start); } void set_session_start (nframes_t start) { _session_range_location->set_start(start); }
void set_session_end (nframes_t end) { end_location->set_start(end); config.set_end_marker_is_free (false); } void set_session_end (nframes_t end) { _session_range_location->set_end(end); config.set_end_marker_is_free (false); }
void use_rf_shuttle_speed (); void use_rf_shuttle_speed ();
void allow_auto_play (bool yn); void allow_auto_play (bool yn);
void request_transport_speed (double speed); void request_transport_speed (double speed);
@ -316,8 +316,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
int wipe (); int wipe ();
nframes_t get_maximum_extent () const; nframes_t get_maximum_extent () const;
nframes_t current_end_frame() const { return end_location->start(); } nframes_t current_end_frame() const { return _session_range_location->end(); }
nframes_t current_start_frame() const { return start_location->start(); } nframes_t current_start_frame() const { return _session_range_location->start(); }
/// "actual" sample rate of session, set by current audioengine rate, pullup/down etc. /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
nframes_t frame_rate() const { return _current_frame_rate; } nframes_t frame_rate() const { return _current_frame_rate; }
/// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc /// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
@ -845,8 +845,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
int transport_sub_state; int transport_sub_state;
mutable gint _record_status; mutable gint _record_status;
volatile nframes64_t _transport_frame; volatile nframes64_t _transport_frame;
Location* end_location; Location* _session_range_location;
Location* start_location;
Slave* _slave; Slave* _slave;
bool _silent; bool _silent;

View file

@ -400,9 +400,8 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Location, IsAutoLoop); REGISTER_CLASS_ENUM (Location, IsAutoLoop);
REGISTER_CLASS_ENUM (Location, IsHidden); REGISTER_CLASS_ENUM (Location, IsHidden);
REGISTER_CLASS_ENUM (Location, IsCDMarker); REGISTER_CLASS_ENUM (Location, IsCDMarker);
REGISTER_CLASS_ENUM (Location, IsEnd); REGISTER_CLASS_ENUM (Location, IsSessionRange);
REGISTER_CLASS_ENUM (Location, IsRangeMarker); REGISTER_CLASS_ENUM (Location, IsRangeMarker);
REGISTER_CLASS_ENUM (Location, IsStart);
REGISTER_BITS (_Location_Flags); REGISTER_BITS (_Location_Flags);
REGISTER_CLASS_ENUM (Panner, SameDirection); REGISTER_CLASS_ENUM (Panner, SameDirection);

View file

@ -290,7 +290,7 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma
Locations::LocationList temp; Locations::LocationList temp;
for (i = locations.begin(); i != locations.end(); ++i) { for (i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->start() >= timespan->get_start() && (*i)->end() <= timespan->get_end() && (*i)->is_cd_marker() && !(*i)->is_end()) { if ((*i)->start() >= timespan->get_start() && (*i)->end() <= timespan->get_end() && (*i)->is_cd_marker() && !(*i)->is_session_range()) {
temp.push_back (*i); temp.push_back (*i);
} }
} }

View file

@ -49,11 +49,6 @@ Location::Location (const Location& other)
_end (other._end), _end (other._end),
_flags (other._flags) _flags (other._flags)
{ {
/* start and end flags can never be copied, because there can only ever be one of each */
_flags = Flags (_flags & ~IsStart);
_flags = Flags (_flags & ~IsEnd);
/* copy is not locked even if original was */ /* copy is not locked even if original was */
_locked = false; _locked = false;
@ -103,18 +98,15 @@ Location::set_start (nframes64_t s)
start_changed(this); /* EMIT SIGNAL */ start_changed(this); /* EMIT SIGNAL */
end_changed(this); /* EMIT SIGNAL */ end_changed(this); /* EMIT SIGNAL */
if ( is_start() ) {
Session::StartTimeChanged (); /* EMIT SIGNAL */
AudioFileSource::set_header_position_offset ( s );
}
if ( is_end() ) {
Session::EndTimeChanged (); /* EMIT SIGNAL */
}
} }
return 0; return 0;
} }
if (is_session_range()) {
start_changed (this); /* EMIT SIGNAL */
Session::StartTimeChanged (); /* EMIT SIGNAL */
AudioFileSource::set_header_position_offset (s);
}
if (((is_auto_punch() || is_auto_loop()) && s >= _end) || s > _end) { if (((is_auto_punch() || is_auto_loop()) && s >= _end) || s > _end) {
return -1; return -1;
@ -141,19 +133,16 @@ Location::set_end (nframes64_t e)
_end = e; _end = e;
start_changed(this); /* EMIT SIGNAL */ start_changed(this); /* EMIT SIGNAL */
end_changed(this); /* EMIT SIGNAL */ end_changed(this); /* EMIT SIGNAL */
if ( is_start() ) {
Session::StartTimeChanged (); /* EMIT SIGNAL */
}
if ( is_end() ) {
Session::EndTimeChanged (); /* EMIT SIGNAL */
}
} }
return 0; return 0;
} }
if (is_session_range()) {
_end = e;
end_changed (this); /* EMIT SIGNAL */
Session::EndTimeChanged (); /* EMIT SIGNAL */
}
if (((is_auto_punch() || is_auto_loop()) && e <= _start) || e < _start) { if (((is_auto_punch() || is_auto_loop()) && e <= _start) || e < _start) {
return -1; return -1;
} }
@ -232,17 +221,9 @@ Location::set_cd (bool yn, void *src)
} }
void void
Location::set_is_end (bool yn, void *src) Location::set_is_session_range (bool yn, void *src)
{ {
if (set_flag_internal (yn, IsEnd)) { if (set_flag_internal (yn, IsSessionRange)) {
FlagsChanged (this, src); /* EMIT SIGNAL */
}
}
void
Location::set_is_start (bool yn, void *src)
{
if (set_flag_internal (yn, IsStart)) {
FlagsChanged (this, src); /* EMIT SIGNAL */ FlagsChanged (this, src); /* EMIT SIGNAL */
} }
} }
@ -531,7 +512,7 @@ Locations::clear ()
LocationList::iterator tmp = i; LocationList::iterator tmp = i;
++tmp; ++tmp;
if (!(*i)->is_end() && !(*i)->is_start()) { if (!(*i)->is_session_range()) {
locations.erase (i); locations.erase (i);
} }
@ -556,7 +537,7 @@ Locations::clear_markers ()
tmp = i; tmp = i;
++tmp; ++tmp;
if ((*i)->is_mark() && !(*i)->is_end() && !(*i)->is_start()) { if ((*i)->is_mark() && !(*i)->is_session_range()) {
locations.erase (i); locations.erase (i);
} }
@ -621,7 +602,7 @@ Locations::remove (Location *loc)
bool was_current = false; bool was_current = false;
LocationList::iterator i; LocationList::iterator i;
if (loc->is_end() || loc->is_start()) { if (loc->is_session_range()) {
return; return;
} }
@ -848,21 +829,10 @@ Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nfra
} }
Location* Location*
Locations::end_location () const Locations::session_range_location () const
{ {
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_end()) { if ((*i)->is_session_range()) {
return const_cast<Location*> (*i);
}
}
return 0;
}
Location*
Locations::start_location () const
{
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
if ((*i)->is_start()) {
return const_cast<Location*> (*i); return const_cast<Location*> (*i);
} }
} }

View file

@ -712,9 +712,9 @@ Session::hookup_io ()
void void
Session::playlist_length_changed () Session::playlist_length_changed ()
{ {
/* we can't just increase end_location->end() if pl->get_maximum_extent() /* we can't just increase session_range_location->end() if pl->get_maximum_extent()
if larger. if the playlist used to be the longest playlist, if larger. if the playlist used to be the longest playlist,
and its now shorter, we have to decrease end_location->end(). hence, and its now shorter, we have to decrease session_range_location->end(). hence,
we have to iterate over all diskstreams and check the we have to iterate over all diskstreams and check the
playlists currently in use. playlists currently in use.
*/ */
@ -954,11 +954,8 @@ Session::handle_locations_changed (Locations::LocationList& locations)
set_loop = true; set_loop = true;
} }
if (location->is_start()) { if (location->is_session_range()) {
start_location = location; _session_range_location = location;
}
if (location->is_end()) {
end_location = location;
} }
} }
@ -2376,8 +2373,8 @@ Session::find_current_end ()
nframes_t max = get_maximum_extent (); nframes_t max = get_maximum_extent ();
if (max > end_location->end()) { if (max > _session_range_location->end()) {
end_location->set_end (max); _session_range_location->set_end (max);
set_dirty(); set_dirty();
DurationChanged(); /* EMIT SIGNAL */ DurationChanged(); /* EMIT SIGNAL */
} }

View file

@ -178,8 +178,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
transport_sub_state = 0; transport_sub_state = 0;
_transport_frame = 0; _transport_frame = 0;
_requested_return_frame = -1; _requested_return_frame = -1;
end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd))); _session_range_location = new Location (0, 0, _("session"), Location::Flags (Location::IsSessionRange));
start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
g_atomic_int_set (&_record_status, Disabled); g_atomic_int_set (&_record_status, Disabled);
loop_changing = false; loop_changing = false;
play_loop = false; play_loop = false;
@ -538,11 +537,8 @@ Session::create (const string& mix_template, nframes_t initial_length, BusProfil
/* set initial start + end point */ /* set initial start + end point */
start_location->set_end (0); _session_range_location->set (0, initial_length);
_locations.add (start_location); _locations.add (_session_range_location);
end_location->set_end (initial_length);
_locations.add (end_location);
_state_of_the_state = Clean; _state_of_the_state = Clean;
@ -1094,12 +1090,9 @@ Session::state(bool full_state)
// 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.
Locations loc; Locations loc;
Location* start = new Location(0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart))); Location* range = new Location (0, 0, _("session"), Location::Flags (Location::IsSessionRange));
Location* end = new Location(0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd))); range->set (0, compute_initial_length ());
start->set_end(0); loc.add (range);
loc.add (start);
end->set_end(compute_initial_length());
loc.add (end);
node->add_child_nocopy (loc.get_state()); node->add_child_nocopy (loc.get_state());
} }
@ -1290,21 +1283,14 @@ Session::set_state (const XMLNode& node, int version)
set_auto_punch_location (location); set_auto_punch_location (location);
} }
if ((location = _locations.end_location()) == 0) { if ((location = _locations.session_range_location()) == 0) {
_locations.add (end_location); _locations.add (_session_range_location);
} else { } else {
delete end_location; delete _session_range_location;
end_location = location; _session_range_location = location;
} }
if ((location = _locations.start_location()) == 0) { AudioFileSource::set_header_position_offset (_session_range_location->start());
_locations.add (start_location);
} else {
delete start_location;
start_location = location;
}
AudioFileSource::set_header_position_offset (start_location->start());
if ((child = find_named_node (node, "Sources")) == 0) { if ((child = find_named_node (node, "Sources")) == 0) {
error << _("Session: XML state has no sources section") << endmsg; error << _("Session: XML state has no sources section") << endmsg;

View file

@ -400,7 +400,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
if (did_record) { if (did_record) {
begin_reversible_command ("capture"); begin_reversible_command ("capture");
Location* loc = _locations.end_location(); Location* loc = _locations.session_range_location();
bool change_end = false; bool change_end = false;
if (_transport_frame < loc->end()) { if (_transport_frame < loc->end()) {