summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-04-20 21:02:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-04-20 21:02:46 +0000
commit0d36301907afd612f93a7bfa53724cc9a17724de (patch)
tree620c096be24ebc38b5762493d6ad79e839420395 /libs
parentf19c01bbb42f4e80769adb8e3e1015724fe9d6c6 (diff)
3 notable patches from lincoln (a) non-layered track mode (NOTE: this is broken for loop recording right now) (b) trim region to previous/next region (c) region push/pull trimming. work on these 3 features should be assumed to be still slightly ongoing (eg. default bindings and more). great stuff
git-svn-id: svn://localhost/ardour2/branches/3.0@4994 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/audio_diskstream.h1
-rw-r--r--libs/ardour/ardour/configuration_vars.h1
-rw-r--r--libs/ardour/ardour/diskstream.h5
-rw-r--r--libs/ardour/ardour/playlist.h7
-rw-r--r--libs/ardour/ardour/types.h1
-rw-r--r--libs/ardour/audio_diskstream.cc17
-rw-r--r--libs/ardour/audio_playlist.cc2
-rw-r--r--libs/ardour/audio_track.cc8
-rw-r--r--libs/ardour/configuration.cc3
-rw-r--r--libs/ardour/enums.cc1
-rw-r--r--libs/ardour/midi_playlist.cc4
-rw-r--r--libs/ardour/playlist.cc57
12 files changed, 76 insertions, 31 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index 8acb3e2806..4f22efd535 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -78,6 +78,7 @@ class AudioDiskstream : public Diskstream
void set_record_enabled (bool yn);
int set_destructive (bool yn);
+ int set_non_layered (bool yn);
bool can_become_destructive (bool& requires_bounce) const;
float peak_power(uint32_t n = 0) {
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h
index 81985ff77a..c91306d6dd 100644
--- a/libs/ardour/ardour/configuration_vars.h
+++ b/libs/ardour/ardour/configuration_vars.h
@@ -172,6 +172,7 @@ CONFIG_VARIABLE (bool, default_narrow_ms, "default-narrow_ms", false)
CONFIG_VARIABLE (bool, name_new_markers, "name-new-markers", false)
CONFIG_VARIABLE (bool, rubberbanding_snaps_to_grid, "rubberbanding-snaps-to-grid", false)
CONFIG_VARIABLE (long, font_scale, "font-scale", 102400)
+CONFIG_VARIABLE (std::string, default_session_parent_dir, "default-session-parent-dir", "~")
/* denormal management */
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index a835e4b571..a5a98338da 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -64,7 +64,8 @@ class Diskstream : public SessionObject, public boost::noncopyable
enum Flag {
Recordable = 0x1,
Hidden = 0x2,
- Destructive = 0x4
+ Destructive = 0x4,
+ NonLayered = 0x8
};
Diskstream (Session &, const string& name, Flag f = Recordable);
@@ -94,10 +95,12 @@ class Diskstream : public SessionObject, public boost::noncopyable
bool destructive() const { return _flags & Destructive; }
virtual int set_destructive (bool yn) { return -1; }
+ virtual int set_non_layered (bool yn) { return -1; }
virtual bool can_become_destructive (bool& requires_bounce) const { return false; }
bool hidden() const { return _flags & Hidden; }
bool recordable() const { return _flags & Recordable; }
+ bool non_layered() const { return _flags & NonLayered; }
bool reversed() const { return _actual_speed < 0.0f; }
double speed() const { return _visible_speed; }
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index a88687cbbb..63edad8805 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -91,7 +91,7 @@ class Playlist : public SessionObject,
/* Editing operations */
- void add_region (boost::shared_ptr<Region>, nframes_t position, float times = 1);
+ void add_region (boost::shared_ptr<Region>, nframes_t position, float times = 1, bool auto_partition = false);
void remove_region (boost::shared_ptr<Region>);
void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
@@ -99,7 +99,7 @@ class Playlist : public SessionObject,
void split_region (boost::shared_ptr<Region>, nframes_t position);
void split (nframes64_t at);
void shift (nframes64_t at, nframes64_t distance, bool move_intersected, bool ignore_music_glue);
- void partition (nframes_t start, nframes_t end, bool just_top_level);
+ void partition (nframes_t start, nframes_t end, bool cut = false);
void duplicate (boost::shared_ptr<Region>, nframes_t position, float times);
void nudge_after (nframes_t start, nframes_t distance, bool forwards);
void shuffle (boost::shared_ptr<Region>, int dir);
@@ -187,7 +187,7 @@ class Playlist : public SessionObject,
DataType _type;
mutable gint block_notifications;
mutable gint ignore_state_changes;
- mutable Glib::Mutex region_lock;
+ mutable Glib::RecMutex region_lock;
std::set<boost::shared_ptr<Region> > pending_adds;
std::set<boost::shared_ptr<Region> > pending_removes;
RegionList pending_bounds;
@@ -212,6 +212,7 @@ class Playlist : public SessionObject,
PBD::ID _orig_diskstream_id;
uint64_t layer_op_counter;
nframes_t freeze_length;
+ bool auto_partition;
void init (bool hide);
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index b6b6321d4f..2ed5e0e365 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -135,6 +135,7 @@ namespace ARDOUR {
enum TrackMode {
Normal,
+ NonLayered,
Destructive
};
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 4c36100c82..94c52c5976 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -1687,7 +1687,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
_last_capture_regions.push_back (region);
i_am_the_modifier++;
- _playlist->add_region (region, (*ci)->start);
+ _playlist->add_region (region, (*ci)->start, 1, non_layered());
i_am_the_modifier--;
buffer_position += (*ci)->frames;
@@ -2407,6 +2407,21 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
}
int
+AudioDiskstream::set_non_layered (bool yn)
+{
+ if (yn != non_layered()) {
+
+ if (yn) {
+ _flags = Flag (_flags | NonLayered);
+ } else {
+ _flags = Flag (_flags & ~NonLayered);
+ }
+ }
+
+ return 0;
+}
+
+int
AudioDiskstream::set_destructive (bool yn)
{
bool bounce_ignored;
diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc
index 4953cdf702..ef2cf281ef 100644
--- a/libs/ardour/audio_playlist.cc
+++ b/libs/ardour/audio_playlist.cc
@@ -147,7 +147,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf
its OK to block (for short intervals).
*/
- Glib::Mutex::Lock rm (region_lock);
+ Glib::RecMutex::Lock rm (region_lock);
end = start + cnt - 1;
read_frames = 0;
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 8f37ea2239..25161ea249 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -77,7 +77,10 @@ AudioTrack::use_new_diskstream ()
if (_mode == Destructive) {
dflags = AudioDiskstream::Flag (dflags | AudioDiskstream::Destructive);
+ } else if (_mode == NonLayered){
+ dflags = AudioDiskstream::Flag(dflags | AudioDiskstream::NonLayered);
}
+
boost::shared_ptr<AudioDiskstream> ds (new AudioDiskstream (_session, name(), dflags));
@@ -94,7 +97,8 @@ AudioTrack::set_mode (TrackMode m)
if (_diskstream->set_destructive (m == Destructive)) {
return -1;
}
-
+
+ _diskstream->set_non_layered (m == NonLayered);
_mode = m;
TrackModeChanged (); /* EMIT SIGNAL */
@@ -107,6 +111,7 @@ bool
AudioTrack::can_use_mode (TrackMode m, bool& bounce_required)
{
switch (m) {
+ case NonLayered:
case Normal:
bounce_required = false;
return true;
@@ -177,6 +182,7 @@ AudioTrack::set_diskstream (boost::shared_ptr<AudioDiskstream> ds, void *src)
_diskstream = ds;
_diskstream->set_io (*this);
_diskstream->set_destructive (_mode == Destructive);
+ _diskstream->set_non_layered (_mode == NonLayered);
if (audio_diskstream()->deprecated_io_node) {
diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc
index bf8facd1a4..611ebddb59 100644
--- a/libs/ardour/configuration.cc
+++ b/libs/ardour/configuration.cc
@@ -129,7 +129,8 @@ Configuration::load_state ()
"ardour.rc", user_rc_file))
{
XMLTree tree;
-
+ found = true;
+
string rcfile = user_rc_file.to_string();
/* stupid XML parser hates empty files */
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index c61f38c922..841b2ad185 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -152,6 +152,7 @@ setup_enum_writer ()
REGISTER (_MeterPoint);
REGISTER_ENUM (Normal);
+ REGISTER_ENUM (NonLayered);
REGISTER_ENUM (Destructive);
REGISTER (_TrackMode);
diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc
index 0e4c65ce3f..bb3603b8a8 100644
--- a/libs/ardour/midi_playlist.cc
+++ b/libs/ardour/midi_playlist.cc
@@ -130,7 +130,7 @@ MidiPlaylist::read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t d
its OK to block (for short intervals).
*/
- Glib::Mutex::Lock rm (region_lock);
+ Glib::RecMutex::Lock rm (region_lock);
nframes_t end = start + dur - 1;
@@ -271,7 +271,7 @@ MidiPlaylist::contained_automation()
its OK to block (for short intervals).
*/
- Glib::Mutex::Lock rm (region_lock);
+ Glib::RecMutex::Lock rm (region_lock);
set<Evoral::Parameter> ret;
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index f34e47b9da..a4a0a62e98 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -474,7 +474,7 @@ Playlist::flush_notifications ()
*************************************************************/
void
-Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, float times)
+Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, float times, bool auto_partition)
{
RegionLock rlock (this);
times = fabs (times);
@@ -482,6 +482,10 @@ Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, floa
int itimes = (int) floor (times);
nframes_t pos = position;
+
+ if(times == 1 && auto_partition){
+ partition(pos, (nframes_t) (pos + region->length()), true);
+ }
if (itimes >= 1) {
add_region_internal (region, pos);
@@ -510,7 +514,6 @@ Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, floa
add_region_internal (sub, pos);
}
-
possibly_splice_unlocked (position, (pos + length) - position, boost::shared_ptr<Region>());
}
@@ -529,8 +532,9 @@ Playlist::set_region_ownership ()
bool
Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t position)
{
- if (region->data_type() != _type)
+ if (region->data_type() != _type){
return false;
+ }
RegionSortByPosition cmp;
nframes_t old_length = 0;
@@ -674,11 +678,11 @@ Playlist::get_region_list_equivalent_regions (boost::shared_ptr<Region> other, v
}
void
-Playlist::partition (nframes_t start, nframes_t end, bool just_top_level)
+Playlist::partition (nframes_t start, nframes_t end, bool cut)
{
RegionList thawlist;
- partition_internal (start, end, false, thawlist);
+ partition_internal (start, end, cut, thawlist);
for (RegionList::iterator i = thawlist.begin(); i != thawlist.end(); ++i) {
(*i)->thaw ("separation");
@@ -692,6 +696,7 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
{
RegionLock rlock (this);
+
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> current;
string new_name;
@@ -708,16 +713,18 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
RegionList copy = regions;
for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) {
-
+
tmp = i;
++tmp;
current = *i;
if (current->first_frame() >= start && current->last_frame() < end) {
+
if (cutting) {
remove_region_internal (current);
}
+
continue;
}
@@ -740,7 +747,6 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
pos4 = current->last_frame();
if (overlap == OverlapInternal) {
-
/* split: we need 3 new regions, the front, middle and end.
cut: we need 2 regions, the front and end.
*/
@@ -757,7 +763,6 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
*/
if (!cutting) {
-
/* "middle" ++++++ */
_session.region_name (new_name, current->name(), false);
@@ -772,7 +777,7 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit));
-
+
add_region_internal (region, end);
new_regions.push_back (region);
@@ -781,9 +786,9 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
current->freeze ();
thawlist.push_back (current);
current->trim_end (pos2, this);
-
+
} else if (overlap == OverlapEnd) {
-
+
/*
start end
---------------*************************------------
@@ -795,12 +800,13 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
*/
if (!cutting) {
-
+
/* end +++++ */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(),
Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit));
+
add_region_internal (region, start);
new_regions.push_back (region);
}
@@ -810,9 +816,9 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
current->freeze ();
thawlist.push_back (current);
current->trim_end (pos2, this);
-
+
} else if (overlap == OverlapStart) {
-
+
/* split: we need 2 regions: the front and the end.
cut: just trim current to skip the cut area
*/
@@ -830,11 +836,11 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
*/
if (!cutting) {
-
/* front **** */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, 0, pos3 - pos1, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit));
+
add_region_internal (region, pos1);
new_regions.push_back (region);
}
@@ -844,9 +850,8 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
current->freeze ();
thawlist.push_back (current);
current->trim_front (pos3, this);
-
} else if (overlap == OverlapExternal) {
-
+
/* split: no split required.
cut: remove the region.
*/
@@ -866,10 +871,11 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
if (cutting) {
remove_region_internal (current);
}
+
new_regions.push_back (current);
}
}
-
+
in_partition = false;
}
@@ -1591,9 +1597,12 @@ Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir)
boost::shared_ptr<Region> ret;
nframes_t closest = max_frames;
+ bool end_iter = false;
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+ if(end_iter) break;
+
nframes_t distance;
boost::shared_ptr<Region> r = (*i);
nframes_t pos = 0;
@@ -1614,23 +1623,28 @@ Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir)
switch (dir) {
case 1: /* forwards */
- if (pos >= frame) {
+ if (pos > frame) {
if ((distance = pos - frame) < closest) {
closest = distance;
ret = r;
+ end_iter = true;
}
}
break;
default: /* backwards */
-
- if (pos <= frame) {
+
+ if (pos < frame) {
if ((distance = frame - pos) < closest) {
closest = distance;
ret = r;
}
}
+ else {
+ end_iter = true;
+ }
+
break;
}
}
@@ -1710,6 +1724,7 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir)
+
void
Playlist::mark_session_dirty ()
{