summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/region.h36
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/region.cc29
-rw-r--r--libs/ardour/session_state.cc28
4 files changed, 76 insertions, 18 deletions
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 3bb5d0aac8..2639662b2e 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -139,23 +139,24 @@ class Region
framepos_t first_frame () const { return _position; }
framepos_t last_frame () const { return _position + _length - 1; }
- bool hidden () const { return _hidden; }
- bool muted () const { return _muted; }
- bool opaque () const { return _opaque; }
- bool locked () const { return _locked; }
- bool position_locked () const { return _position_locked; }
- bool valid_transients () const { return _valid_transients; }
- bool automatic () const { return _automatic; }
- bool whole_file () const { return _whole_file; }
- bool captured () const { return !(_import || _external); }
- bool can_move () const { return !_position_locked; }
- bool sync_marked () const { return _sync_marked; }
- bool external () const { return _external; }
- bool import () const { return _import; }
-
- Trimmable::CanTrim can_trim () const;
+ bool hidden() const { return _hidden; }
+ bool muted() const { return _muted; }
+ bool opaque () const { return _opaque; }
+ bool locked() const { return _locked; }
+ bool position_locked() const { return _position_locked; }
+ bool valid_transients() const { return _valid_transients; }
+ bool automatic() const { return _automatic; }
+ bool whole_file() const { return _whole_file; }
+ bool captured() const { return !(_import || _external); }
+ bool can_move() const { return !_position_locked; }
+ bool sync_marked() const { return _sync_marked; }
+ bool external() const { return _external; }
+ bool import() const { return _import; }
+
+ Trimmable::CanTrim can_trim() const;
PositionLockStyle position_lock_style () const { return _position_lock_style; }
+
void set_position_lock_style (PositionLockStyle ps);
void recompute_position_from_lock_style ();
@@ -175,6 +176,9 @@ class Region
bool region_list_equivalent (boost::shared_ptr<const Region>) const;
bool source_equivalent (boost::shared_ptr<const Region>) const;
bool uses_source (boost::shared_ptr<const Source>) const;
+
+ std::string source_string () const;
+
/* EDITING OPERATIONS */
@@ -223,7 +227,7 @@ class Region
void source_deleted (boost::weak_ptr<Source>);
boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; }
- uint32_t n_channels() const { return _sources.size(); }
+ uint32_t n_channels() const { return _sources.size(); }
const SourceList& sources () const { return _sources; }
const SourceList& master_sources () const { return _master_sources; }
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 0970e01b5c..293d9d391f 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -512,6 +512,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void add_source (boost::shared_ptr<Source>);
void remove_source (boost::weak_ptr<Source>);
+ void cleanup_regions();
int cleanup_sources (CleanupReport&);
int cleanup_trash_sources (CleanupReport&);
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 5a89707495..d711695927 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -423,6 +423,7 @@ Region::set_name (const std::string& str)
if (_name != str) {
SessionObject::set_name(str); // EMIT SIGNAL NameChanged()
assert(_name == str);
+
send_change (Properties::name);
}
@@ -490,6 +491,7 @@ Region::first_edit ()
_first_edit = EditChangesNothing;
send_change (Properties::name);
+
RegionFactory::CheckNewRegion (shared_from_this());
}
}
@@ -559,6 +561,7 @@ Region::set_position_lock_style (PositionLockStyle ps)
}
send_change (Properties::position_lock_style);
+
}
}
@@ -643,7 +646,6 @@ Region::set_position_on_top (framepos_t pos, void* /*src*/)
/* do this even if the position is the same. this helps out
a GUI that has moved its representation already.
*/
-
send_change (Properties::position);
}
@@ -1023,6 +1025,7 @@ Region::set_sync_position (framepos_t absolute_pos)
if (!property_changes_suspended()) {
maybe_uncopy ();
}
+
send_change (Properties::sync_position);
}
}
@@ -1035,6 +1038,7 @@ Region::clear_sync_position ()
if (!property_changes_suspended()) {
maybe_uncopy ();
}
+
send_change (Properties::sync_position);
}
}
@@ -1428,6 +1432,29 @@ Region::source_equivalent (boost::shared_ptr<const Region> other) const
return true;
}
+std::string
+Region::source_string () const
+{
+ //string res = itos(_sources.size());
+
+ char buf[64];
+
+ stringstream res;
+ res << _sources.size() << ":";
+
+ SourceList::const_iterator i;
+
+ for (i = _sources.begin(); i != _sources.end(); ++i) {
+ res << (*i)->id() << ":";
+ }
+
+ for (i = _master_sources.begin(); i != _master_sources.end(); ++i) {
+ res << (*i)->id() << ":";
+ }
+
+ return res.str();
+}
+
bool
Region::uses_source (boost::shared_ptr<const Source> source) const
{
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index cb1394740c..05fdb13bec 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2575,6 +2575,32 @@ Session::ask_about_playlist_deletion (boost::shared_ptr<Playlist> p)
return r.get_value_or (1);
}
+void
+Session::cleanup_regions ()
+{
+ const RegionFactory::RegionMap& regions (RegionFactory::regions());
+
+ for (RegionFactory::RegionMap::const_iterator i = regions.begin(); i != regions.end(); ++i) {
+
+ boost::shared_ptr<AudioRegion> audio_region = boost::dynamic_pointer_cast<AudioRegion>( i->second);
+
+ if (!audio_region) {
+ continue;
+ }
+
+ uint32_t used = playlists->region_use_count (audio_region);
+
+ if (used == 0 && !audio_region->automatic()){
+ RegionFactory::map_remove(i->second);
+ }
+ }
+
+ /* dump the history list */
+ _history.clear ();
+
+ save_state ("");
+}
+
int
Session::cleanup_sources (CleanupReport& rep)
{
@@ -2999,7 +3025,7 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc)
break;
case ControllableDescriptor::Solo:
- c = r->solo_control();
+ c = r->solo_control();
break;
case ControllableDescriptor::Mute: