45 PBD::Signal0<void> Location::scene_changed;
46 PBD::Signal1<void,Location*> Location::name_changed;
47 PBD::Signal1<void,Location*> Location::end_changed;
48 PBD::Signal1<void,Location*> Location::start_changed;
49 PBD::Signal1<void,Location*> Location::flags_changed;
50 PBD::Signal1<void,Location*> Location::lock_changed;
51 PBD::Signal1<void,Location*> Location::position_lock_style_changed;
52 PBD::Signal1<void,Location*> Location::changed;
70 , _start (sample_start)
74 , _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ?
MusicTime :
AudioTime)
86 , _start (other._start)
87 , _bbt_start (other._bbt_start)
89 , _bbt_end (other._bbt_end)
90 , _flags (other._flags)
91 , _position_lock_style (other._position_lock_style)
137 if (
this == &other) {
201 if (allow_bbt_recompute) {
225 if (
_end - s < Config->get_range_location_minimum()) {
235 if (allow_bbt_recompute) {
278 if (allow_bbt_recompute) {
293 if (e - _start < Config->get_range_location_minimum()) {
303 if (allow_bbt_recompute) {
323 if (s < 0 || e < 0) {
332 bool start_change =
false;
333 bool end_change =
false;
341 if (allow_bbt_recompute) {
355 if (e - s < Config->get_range_location_minimum()) {
364 if (allow_bbt_recompute) {
382 if (allow_bbt_recompute) {
406 if (start_change && end_change) {
456 error <<
_(
"You cannot put a CD marker at this position") <<
endmsg;
571 typedef map<string, string>::const_iterator CI;
577 id().
print (buf,
sizeof (buf));
580 snprintf (buf,
sizeof (buf),
"%" PRId64,
start());
582 snprintf (buf,
sizeof (buf),
"%" PRId64,
end());
607 if (node.
name() !=
"Location") {
608 error <<
_(
"incorrect XML node passed to Location::set_state") <<
endmsg;
613 warning <<
_(
"XML node for Location has no ID information") <<
endmsg;
616 if ((prop = node.
property (
"name")) == 0) {
617 error <<
_(
"XML node for Location has no name information") <<
endmsg;
623 if ((prop = node.
property (
"start")) == 0) {
624 error <<
_(
"XML node for Location has no start information") <<
endmsg;
632 sscanf (prop->
value().c_str(),
"%" PRId64, &
_start);
634 if ((prop = node.
property (
"end")) == 0) {
635 error <<
_(
"XML node for Location has no end information") <<
endmsg;
639 sscanf (prop->
value().c_str(),
"%" PRId64, &
_end);
641 if ((prop = node.
property (
"flags")) == 0) {
642 error <<
_(
"XML node for Location has no flags information") <<
endmsg;
648 if ((prop = node.
property (
"locked")) != 0) {
654 for (cd_iter = cd_list.begin(); cd_iter != cd_list.end(); ++cd_iter) {
658 if (cd_node->
name() !=
"CD-Info") {
662 if ((prop = cd_node->
property (
"name")) != 0) {
663 cd_name = prop->
value();
668 if ((prop = cd_node->
property (
"value")) != 0) {
669 cd_value = prop->
value();
678 if ((prop = node.
property (
"position-lock-style")) != 0) {
771 LocationList::iterator tmp = i;
799 LocationList::iterator i;
803 std::map<uint32_t,bool> taken;
817 const string& temp ((*i)->name());
819 if (!temp.find (base,0)) {
821 if ((suffix =
atoi (temp.substr(l,3))) != 0) {
822 taken.insert (make_pair (suffix,
true));
840 while (n < UINT32_MAX) {
841 if (taken.find (n) == taken.end()) {
842 snprintf (buf,
sizeof(buf),
"%d", n);
856 error <<
_(
"Locations: attempt to use unknown location as selected location") <<
endmsg;
872 LocationList::iterator tmp = i;
875 if (!(*i)->is_session_range()) {
895 LocationList::iterator tmp;
901 if ((*i)->is_mark() && !(*i)->is_session_range()) {
918 LocationList::iterator tmp;
929 if ((*i)->is_auto_punch() ||
930 (*i)->is_auto_loop() ||
931 (*i)->is_session_range()) {
936 if (!(*i)->is_mark()) {
981 bool was_removed =
false;
982 bool was_current =
false;
983 LocationList::iterator i;
1020 LocationList::iterator iter;
1033 if (node.
name() !=
"Locations") {
1034 error <<
_(
"incorrect XML mode passed to Locations::set_state") <<
endmsg;
1046 if (version < 3000) {
1048 new_locations.push_back (session_range_location);
1055 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
1059 XMLProperty const * prop_id = (*niter)->property (
"id");
1063 LocationList::const_iterator i =
locations.begin();
1064 while (i !=
locations.end () && (*i)->id() !=
id) {
1079 if (version < 3000) {
1083 XMLProperty const * prop = (*niter)->property (
"flags");
1085 string v = prop->
value ();
1087 string::size_type
const c = v.find_first_of (
',');
1088 string const s = v.substr (0, c);
1089 if (s ==
X_(
"IsStart")) {
1092 }
else if (s ==
X_(
"IsEnd")) {
1097 if (c == string::npos) {
1101 v = v.substr (c + 1);
1107 new_locations.push_back (loc);
1112 error <<
_(
"could not load location from session file - ignored") <<
endmsg;
1118 LocationList::iterator tmp = i;
1121 LocationList::iterator n = new_locations.begin();
1124 while (n != new_locations.end ()) {
1125 if ((*i)->id() == (*n)->id()) {
1160 return a.first < b.first;
1167 return a.first > b.first;
1175 vector<LocationPair> locs;
1178 locs.push_back (make_pair ((*i)->start(), (*i)));
1179 if (!(*i)->is_mark()) {
1180 locs.push_back (make_pair ((*i)->end(), (*i)));
1185 sort (locs.begin(), locs.end(), cmp);
1189 for (vector<LocationPair>::iterator i = locs.begin(); i != locs.end(); ++i) {
1190 if ((*i).second->is_hidden()) {
1193 if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) {
1196 if ((*i).first < frame) {
1216 for (LocationList::const_iterator i =
locations.begin(); i !=
locations.end(); ++i) {
1218 if ((*i)->is_mark()) {
1219 if (pos > (*i)->start()) {
1220 delta = pos - (*i)->start();
1222 delta = (*i)->start() - pos;
1225 if (slop == 0 && delta == 0) {
1230 if (delta <= slop) {
1231 if (delta < mindelta) {
1246 vector<LocationPair> locs;
1249 locs.push_back (make_pair ((*i)->start(), (*i)));
1250 if (!(*i)->is_mark()) {
1251 locs.push_back (make_pair ((*i)->end(), (*i)));
1256 sort (locs.begin(), locs.end(), cmp);
1260 for (vector<LocationPair>::iterator i = locs.begin(); i != locs.end(); ++i) {
1261 if ((*i).second->is_hidden()) {
1264 if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) {
1267 if ((*i).first > frame) {
1296 std::list<framepos_t> positions;
1298 for (LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) {
1299 if (((*i)->is_auto_loop() || (*i)->is_auto_punch())) {
1303 if (!(*i)->is_hidden()) {
1304 if ((*i)->is_mark ()) {
1305 if ((*i)->start() != frame) {
1306 positions.push_back ((*i)->start ());
1309 if ((*i)->start() != frame) {
1310 positions.push_back ((*i)->start ());
1312 if ((*i)->end() != frame) {
1313 positions.push_back ((*i)->end ());
1319 if (positions.empty ()) {
1325 std::list<framepos_t>::iterator i = positions.begin ();
1326 while (i != positions.end () && *i < frame) {
1330 if (i == positions.end ()) {
1332 before = positions.back ();
1338 if (i == positions.begin ()) {
1350 for (LocationList::const_iterator i =
locations.begin(); i !=
locations.end(); ++i) {
1351 if ((*i)->is_session_range()) {
1361 for (LocationList::const_iterator i =
locations.begin(); i !=
locations.end(); ++i) {
1362 if ((*i)->is_auto_loop()) {
1372 for (LocationList::const_iterator i =
locations.begin(); i !=
locations.end(); ++i) {
1373 if ((*i)->is_auto_punch()) {
1385 for (LocationList::const_iterator i =
locations.begin(); i !=
locations.end(); ++i) {
1386 if ((*i)->is_range_marker()) {
1396 LocationList::iterator it;
1398 if (
id == (*it)->id())
1409 for (LocationList::const_iterator i =
locations.begin(); i !=
locations.end(); ++i) {
1410 if ((flags == 0 || (*i)->matches (flags)) &&
1411 ((*i)->start() >= start && (*i)->end() < end)) {
static PBD::Signal1< void, Location * > start_changed
int next_available_name(std::string &result, std::string base)
framepos_t first_mark_after(framepos_t, bool include_special_ranges=false)
Location * current_location
std::pair< framepos_t, Location * > LocationPair
ARDOUR::Session & _session
bool operator==(const Location &other)
Location * mark_at(framepos_t, framecnt_t slop=0) const
static PBD::Signal0< void > scene_changed
int atoi(const string &s)
PBD::Signal1< void, Location * > current_changed
static PBD::Signal1< void, Location * > end_changed
Location * auto_loop_location() const
const std::string & value() const
std::list< Location * > LocationList
PBD::Signal1< void, Location * > added
boost::shared_ptr< SceneChange > _scene_change
static PBD::Signal1< void, framepos_t > EndTimeChanged
void set_name(const std::string &str)
void recompute_bbt_from_frames()
const std::string & name() const
PBD::Signal0< void > LockChanged
void set_auto_punch(bool yn, void *src)
PositionLockStyle _position_lock_style
static std::string xml_node_name
framepos_t first_mark_before(framepos_t, bool include_special_ranges=false)
Timecode::BBT_Time _bbt_end
LIBPBD_API Transmitter error
LIBPBD_API Transmitter warning
const XMLNodeList & children(const std::string &str=std::string()) const
std::ostream & endmsg(std::ostream &ostr)
static PBD::Signal1< void, Location * > position_lock_style_changed
int set_state(const XMLNode &, int version)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
void marks_either_side(framepos_t const, framepos_t &, framepos_t &) const
void set_skipping(bool yn)
int move_to(framepos_t pos)
bool is_session_range() const
Location * session_range_location() const
std::list< XMLNode * > XMLNodeList
static PBD::Signal1< void, framepos_t > StartTimeChanged
Timecode::BBT_Time _bbt_start
XMLProperty * property(const char *)
PBD::Signal0< void > PositionLockStyleChanged
int set(framepos_t start, framepos_t end, bool allow_bbt_recompute=true)
#define string_2_enum(str, e)
int set_current_unlocked(Location *)
Location * get_location_by_id(PBD::ID)
std::map< std::string, std::string > cd_info
bool is_auto_punch() const
PBD::Signal1< void, Location * > removed
void set_is_range_marker(bool yn, void *src)
bool string_is_affirmative(const std::string &str)
PBD::Signal0< void > FlagsChanged
const PBD::ID & id() const
static boost::shared_ptr< SceneChange > factory(const XMLNode &, int version)
XMLNode & cd_info_node(const std::string &, const std::string &)
void print(char *buf, uint32_t bufsize) const
bool set_id(const XMLNode &)
void set_auto_loop(bool yn, void *src)
XMLNode & get_state(void)
Location * operator=(const Location &other)
LIBARDOUR_API XMLNode * find_named_node(const XMLNode &node, std::string name)
PBD::Signal0< void > NameChanged
static int loading_state_version
uint32_t num_range_markers() const
void find_all_between(framepos_t start, framepos_t, LocationList &, Location::Flags)
bool set_flag_internal(bool yn, Flags flag)
int set_start(framepos_t s, bool force=false, bool allow_bbt_recompute=true)
XMLProperty * add_property(const char *name, const std::string &value)
void add(Location *, bool make_current=false)
void add_child_nocopy(XMLNode &)
XMLNode & get_state(void)
static void set_header_position_offset(framecnt_t offset)
const std::string & name() const
void set_cd(bool yn, void *src)
static PBD::Signal1< void, Location * > flags_changed
void set_scene_change(boost::shared_ptr< SceneChange >)
int set_state(const XMLNode &, int version)
framecnt_t length() const
PBD::Signal0< void > EndChanged
static PBD::Signal1< void, Location * > lock_changed
PBD::Signal0< void > StartChanged
static const framepos_t max_framepos
bool is_range_marker() const
static PBD::Signal1< void, Location * > name_changed
bool is_auto_loop() const
Glib::Threads::Mutex lock
XMLNodeList::const_iterator XMLNodeConstIterator
void recompute_frames_from_bbt()
void bbt_time(framepos_t when, Timecode::BBT_Time &)
void set_hidden(bool yn, void *src)
int set_end(framepos_t e, bool force=false, bool allow_bbt_recompute=true)
PBD::Signal0< void > Changed
int set_current(Location *, bool want_lock=true)
void set_position_lock_style(PositionLockStyle ps)
Location * auto_punch_location() const