diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-11-12 22:23:01 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-11-12 22:23:01 +0000 |
commit | b01bdb7e70f021da764e81a4b55722e746e4885d (patch) | |
tree | 3f22af0fc8399bedd6843f7a9a4383295ac7b3cb /libs | |
parent | 99d002dbdf2563bcad880628e7876aebe191ba0c (diff) |
merged with trunk revs 2605-2627
git-svn-id: svn://localhost/ardour2/trunk@2628 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/location.h | 23 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 2 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 11 | ||||
-rw-r--r-- | libs/ardour/io.cc | 5 | ||||
-rw-r--r-- | libs/ardour/location.cc | 44 | ||||
-rw-r--r-- | libs/ardour/session.cc | 5 |
6 files changed, 73 insertions, 17 deletions
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 6625b7dbf5..5ffb716598 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -62,26 +62,34 @@ class Location : public PBD::StatefulDestructible : _name (name), _start (sample_start), _end (sample_end), - _flags (bits) { } + _flags (bits), + _locked (false) { } Location () { _start = 0; _end = 0; _flags = Flags (0); + _locked = false; } Location (const Location& other); Location (const XMLNode&); Location* operator= (const Location& other); - nframes_t start() { return _start; } - nframes_t end() { return _end; } - nframes_t length() { return _end - _start; } + bool locked() const { return _locked; } + void lock() { _locked = true; changed (this); } + void unlock() { _locked = false; changed (this); } + + nframes_t start() const { return _start; } + nframes_t end() const { return _end; } + nframes_t length() const { return _end - _start; } int set_start (nframes_t s); int set_end (nframes_t e); int set (nframes_t start, nframes_t end); + int move_to (nframes_t pos); + const string& name() { return _name; } void set_name (const string &str) { _name = str; name_changed(this); } @@ -124,6 +132,7 @@ class Location : public PBD::StatefulDestructible nframes_t _start; nframes_t _end; Flags _flags; + bool _locked; void set_mark (bool yn); bool set_flag_internal (bool yn, Flags flag); @@ -136,7 +145,7 @@ class Locations : public PBD::StatefulDestructible Locations (); ~Locations (); - + void add (Location *, bool make_current = false); void remove (Location *); void clear (); @@ -182,8 +191,8 @@ class Locations : public PBD::StatefulDestructible private: - LocationList locations; - Location *current_location; + LocationList locations; + Location *current_location; mutable Glib::Mutex lock; int set_current_unlocked (Location *); diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index c77f1b9fd8..91ff8b8d35 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -566,6 +566,8 @@ AudioEngine::register_output_port (DataType type, const string& portname, bool p int AudioEngine::unregister_port (Port& port) { + /* caller must hold process lock */ + if (!_running) { /* probably happening when the engine has been halted by JACK, in which case, there is nothing we can do here. diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 91654643d9..8034f3ddac 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -812,6 +812,10 @@ AudioRegion::set_fade_out (FadeShape shape, nframes_t len) void AudioRegion::set_fade_in_length (nframes_t len) { + if (len > _length) { + len = _length - 1; + } + bool changed = _fade_in->extend_to (len); if (changed) { @@ -823,13 +827,16 @@ AudioRegion::set_fade_in_length (nframes_t len) void AudioRegion::set_fade_out_length (nframes_t len) { + if (len > _length) { + len = _length - 1; + } + bool changed = _fade_out->extend_to (len); if (changed) { _flags = Flag (_flags & ~DefaultFadeOut); + send_change (FadeOutChanged); } - - send_change (FadeOutChanged); } void diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index f64528aa52..fdb2e0f5cd 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -199,12 +199,11 @@ IO::IO (Session& s, const XMLNode& node, DataType dt) IO::~IO () { - cerr << "Deleting IO called " << _name << endl; - Glib::Mutex::Lock guard (m_meter_signal_lock); - Glib::Mutex::Lock lm (io_lock); + BLOCK_PROCESS_CALLBACK (); + for (PortSet::iterator i = _inputs.begin(); i != _inputs.end(); ++i) { _session.engine().unregister_port (*i); } diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 093c6cf8fc..0da75810ca 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -52,6 +52,10 @@ Location::Location (const Location& other) _flags = Flags (_flags & ~IsStart); _flags = Flags (_flags & ~IsEnd); + + /* copy is not locked even if original was */ + + _locked = false; } Location::Location (const XMLNode& node) @@ -73,6 +77,10 @@ Location::operator= (const Location& other) _end = other._end; _flags = other._flags; + /* copy is not locked even if original was */ + + _locked = false; + /* "changed" not emitted on purpose */ return this; @@ -81,6 +89,10 @@ Location::operator= (const Location& other) int Location::set_start (nframes_t s) { + if (_locked) { + return -1; + } + if (is_mark()) { if (_start != s) { @@ -117,6 +129,10 @@ Location::set_start (nframes_t s) int Location::set_end (nframes_t e) { + if (_locked) { + return -1; + } + if (is_mark()) { if (_start != e) { _start = e; @@ -140,6 +156,10 @@ Location::set_end (nframes_t e) int Location::set (nframes_t start, nframes_t end) { + if (_locked) { + return -1; + } + if (is_mark() && start != end) { return -1; } else if (((is_auto_punch() || is_auto_loop()) && start >= end) || (start > end)) { @@ -158,6 +178,23 @@ Location::set (nframes_t start, nframes_t end) return 0; } +int +Location::move_to (nframes_t pos) +{ + if (_locked) { + return -1; + } + + if (_start != pos) { + _start = pos; + _end = _start + length(); + + changed (this); /* EMIT SIGNAL */ + } + + return 0; +} + void Location::set_hidden (bool yn, void *src) { @@ -284,6 +321,7 @@ Location::get_state (void) snprintf (buf, sizeof (buf), "%u", end()); node->add_property ("end", buf); node->add_property ("flags", enum_2_string (_flags)); + node->add_property ("locked", (_locked ? "yes" : "no")); return *node; } @@ -343,6 +381,12 @@ Location::set_state (const XMLNode& node) _flags = Flags (string_2_enum (prop->value(), _flags)); + if ((prop = node.property ("locked")) != 0) { + _locked = (prop->value() == "yes"); + } else { + _locked = false; + } + for (cd_iter = cd_list.begin(); cd_iter != cd_list.end(); ++cd_iter) { cd_node = *cd_iter; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index a664ca44c7..e155800d23 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2113,13 +2113,8 @@ Session::remove_route (shared_ptr<Route> route) /* try to cause everyone to drop their references */ - cerr << "pre drop, Route now has " << route.use_count() << " refs\n"; - cerr << "sig has " << route->GoingAway.size() << endl; - route->drop_references (); - cerr << "route dangling refs = " << route.use_count() << endl; - /* save the new state of the world */ if (save_state (_current_snapshot_name)) { |