summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-18 21:29:48 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-18 21:29:48 +0000
commit895bad1dcd817cb8ad32dc255a90271edd6659fb (patch)
tree1385c5880cd9958bb2c6d189b6ff13ae4c43be74 /libs
parentd9cac66b5d7f76a78b1ae1442a275516ef710bc9 (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/location.h14
-rw-r--r--libs/ardour/ardour/session.h15
-rw-r--r--libs/ardour/enums.cc3
-rw-r--r--libs/ardour/export_handler.cc2
-rw-r--r--libs/ardour/location.cc68
-rw-r--r--libs/ardour/session.cc15
-rw-r--r--libs/ardour/session_state.cc36
-rw-r--r--libs/ardour/session_transport.cc2
8 files changed, 51 insertions, 104 deletions
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index 938177b102..c0711e0c9b 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -46,9 +46,8 @@ class Location : public PBD::StatefulDestructible
IsAutoLoop = 0x4,
IsHidden = 0x8,
IsCDMarker = 0x10,
- IsEnd = 0x20,
- IsRangeMarker = 0x40,
- IsStart = 0x80
+ IsRangeMarker = 0x20,
+ IsSessionRange = 0x40
};
Location (nframes64_t sample_start,
@@ -94,8 +93,7 @@ class Location : public PBD::StatefulDestructible
void set_auto_loop (bool yn, void *src);
void set_hidden (bool yn, void *src);
void set_cd (bool yn, void *src);
- void set_is_end (bool yn, void* src);
- void set_is_start (bool yn, void* src);
+ void set_is_session_range (bool yn, void* src);
void set_is_range_marker (bool yn, void* src);
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_hidden () const { return _flags & IsHidden; }
bool is_cd_marker () const { return _flags & IsCDMarker; }
- bool is_end() const { return _flags & IsEnd; }
- bool is_start() const { return _flags & IsStart; }
+ bool is_session_range () const { return _flags & IsSessionRange; }
bool is_range_marker() const { return _flags & IsRangeMarker; }
bool matches (Flags f) const { return _flags & f; }
@@ -159,8 +156,7 @@ class Locations : public PBD::StatefulDestructible
Location* auto_loop_location () const;
Location* auto_punch_location () const;
- Location* end_location() const;
- Location* start_location() const;
+ Location* session_range_location() const;
int next_available_name(std::string& result,std::string base);
uint32_t num_range_markers() const;
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index b5c818e6a2..81536169a6 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -299,10 +299,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
bool get_play_loop () const { return play_loop; }
nframes_t last_transport_start() const { return _last_roll_location; }
- void goto_end () { request_locate (end_location->start(), false);}
- void goto_start () { request_locate (start_location->start(), false); }
- void set_session_start (nframes_t start) { start_location->set_start(start); }
- void set_session_end (nframes_t end) { end_location->set_start(end); config.set_end_marker_is_free (false); }
+ void goto_end () { request_locate (_session_range_location->end(), false);}
+ void goto_start () { request_locate (_session_range_location->start(), false); }
+ void set_session_start (nframes_t start) { _session_range_location->set_start(start); }
+ 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 allow_auto_play (bool yn);
void request_transport_speed (double speed);
@@ -316,8 +316,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
int wipe ();
nframes_t get_maximum_extent () const;
- nframes_t current_end_frame() const { return end_location->start(); }
- nframes_t current_start_frame() const { return start_location->start(); }
+ nframes_t current_end_frame() const { return _session_range_location->end(); }
+ nframes_t current_start_frame() const { return _session_range_location->start(); }
/// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
nframes_t frame_rate() const { return _current_frame_rate; }
/// "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;
mutable gint _record_status;
volatile nframes64_t _transport_frame;
- Location* end_location;
- Location* start_location;
+ Location* _session_range_location;
Slave* _slave;
bool _silent;
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index df6eb360d1..a758804564 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -400,9 +400,8 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Location, IsAutoLoop);
REGISTER_CLASS_ENUM (Location, IsHidden);
REGISTER_CLASS_ENUM (Location, IsCDMarker);
- REGISTER_CLASS_ENUM (Location, IsEnd);
+ REGISTER_CLASS_ENUM (Location, IsSessionRange);
REGISTER_CLASS_ENUM (Location, IsRangeMarker);
- REGISTER_CLASS_ENUM (Location, IsStart);
REGISTER_BITS (_Location_Flags);
REGISTER_CLASS_ENUM (Panner, SameDirection);
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc
index cf6fced74c..7893d8143c 100644
--- a/libs/ardour/export_handler.cc
+++ b/libs/ardour/export_handler.cc
@@ -290,7 +290,7 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma
Locations::LocationList temp;
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);
}
}
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 4861718d85..ec2059a41f 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -49,11 +49,6 @@ Location::Location (const Location& other)
_end (other._end),
_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 */
_locked = false;
@@ -103,18 +98,15 @@ Location::set_start (nframes64_t s)
start_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;
}
+
+ 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) {
return -1;
@@ -141,19 +133,16 @@ Location::set_end (nframes64_t e)
_end = e;
start_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;
}
+ 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) {
return -1;
}
@@ -232,17 +221,9 @@ Location::set_cd (bool yn, void *src)
}
void
-Location::set_is_end (bool yn, void *src)
+Location::set_is_session_range (bool yn, void *src)
{
- if (set_flag_internal (yn, IsEnd)) {
- FlagsChanged (this, src); /* EMIT SIGNAL */
- }
-}
-
-void
-Location::set_is_start (bool yn, void *src)
-{
- if (set_flag_internal (yn, IsStart)) {
+ if (set_flag_internal (yn, IsSessionRange)) {
FlagsChanged (this, src); /* EMIT SIGNAL */
}
}
@@ -531,7 +512,7 @@ Locations::clear ()
LocationList::iterator tmp = i;
++tmp;
- if (!(*i)->is_end() && !(*i)->is_start()) {
+ if (!(*i)->is_session_range()) {
locations.erase (i);
}
@@ -556,7 +537,7 @@ Locations::clear_markers ()
tmp = i;
++tmp;
- if ((*i)->is_mark() && !(*i)->is_end() && !(*i)->is_start()) {
+ if ((*i)->is_mark() && !(*i)->is_session_range()) {
locations.erase (i);
}
@@ -621,7 +602,7 @@ Locations::remove (Location *loc)
bool was_current = false;
LocationList::iterator i;
- if (loc->is_end() || loc->is_start()) {
+ if (loc->is_session_range()) {
return;
}
@@ -848,21 +829,10 @@ Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nfra
}
Location*
-Locations::end_location () const
-{
- for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
- if ((*i)->is_end()) {
- return const_cast<Location*> (*i);
- }
- }
- return 0;
-}
-
-Location*
-Locations::start_location () const
+Locations::session_range_location () const
{
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
- if ((*i)->is_start()) {
+ if ((*i)->is_session_range()) {
return const_cast<Location*> (*i);
}
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 11832646c8..9da481e7ce 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -712,9 +712,9 @@ Session::hookup_io ()
void
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,
- 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
playlists currently in use.
*/
@@ -954,11 +954,8 @@ Session::handle_locations_changed (Locations::LocationList& locations)
set_loop = true;
}
- if (location->is_start()) {
- start_location = location;
- }
- if (location->is_end()) {
- end_location = location;
+ if (location->is_session_range()) {
+ _session_range_location = location;
}
}
@@ -2376,8 +2373,8 @@ Session::find_current_end ()
nframes_t max = get_maximum_extent ();
- if (max > end_location->end()) {
- end_location->set_end (max);
+ if (max > _session_range_location->end()) {
+ _session_range_location->set_end (max);
set_dirty();
DurationChanged(); /* EMIT SIGNAL */
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 1f116d82bc..211660c1f7 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -178,8 +178,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
transport_sub_state = 0;
_transport_frame = 0;
_requested_return_frame = -1;
- end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
- start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
+ _session_range_location = new Location (0, 0, _("session"), Location::Flags (Location::IsSessionRange));
g_atomic_int_set (&_record_status, Disabled);
loop_changing = false;
play_loop = false;
@@ -538,11 +537,8 @@ Session::create (const string& mix_template, nframes_t initial_length, BusProfil
/* set initial start + end point */
- start_location->set_end (0);
- _locations.add (start_location);
-
- end_location->set_end (initial_length);
- _locations.add (end_location);
+ _session_range_location->set (0, initial_length);
+ _locations.add (_session_range_location);
_state_of_the_state = Clean;
@@ -1094,12 +1090,9 @@ Session::state(bool full_state)
// for a template, just create a new Locations, populate it
// with the default start and end, and get the state for that.
Locations loc;
- Location* start = new Location(0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
- Location* end = new Location(0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
- start->set_end(0);
- loc.add (start);
- end->set_end(compute_initial_length());
- loc.add (end);
+ Location* range = new Location (0, 0, _("session"), Location::Flags (Location::IsSessionRange));
+ range->set (0, compute_initial_length ());
+ loc.add (range);
node->add_child_nocopy (loc.get_state());
}
@@ -1290,21 +1283,14 @@ Session::set_state (const XMLNode& node, int version)
set_auto_punch_location (location);
}
- if ((location = _locations.end_location()) == 0) {
- _locations.add (end_location);
- } else {
- delete end_location;
- end_location = location;
- }
-
- if ((location = _locations.start_location()) == 0) {
- _locations.add (start_location);
+ if ((location = _locations.session_range_location()) == 0) {
+ _locations.add (_session_range_location);
} else {
- delete start_location;
- start_location = location;
+ delete _session_range_location;
+ _session_range_location = location;
}
- AudioFileSource::set_header_position_offset (start_location->start());
+ AudioFileSource::set_header_position_offset (_session_range_location->start());
if ((child = find_named_node (node, "Sources")) == 0) {
error << _("Session: XML state has no sources section") << endmsg;
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 12dc1c3d3d..9077ba7cac 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -400,7 +400,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
if (did_record) {
begin_reversible_command ("capture");
- Location* loc = _locations.end_location();
+ Location* loc = _locations.session_range_location();
bool change_end = false;
if (_transport_frame < loc->end()) {