summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_diskstream.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-23 20:14:07 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-23 20:14:07 +0000
commitf4401c59284258c6aa56707da64e3da32756329f (patch)
tree73679199ae43516347d607adad212c10612f7eb9 /libs/ardour/audio_diskstream.cc
parentcac03dbeb6ebdcd406385dd14a746cb8c51dd5f8 (diff)
midway snapshot of work done on managing Region & Source lifetimes correctly. may fix missing MIDI file bug ; save empty playlists because they may be referred to by the history file ; undo commands auto-delete when objects they refer to die (currently not commands built from XML deserialization); Sources now know how many regions are using them for something, meaning that we know if we can delete the files holding any data for the source
git-svn-id: svn://localhost/ardour2/branches/3.0@7291 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_diskstream.cc')
-rw-r--r--libs/ardour/audio_diskstream.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index b3204c38b6..ae80690b81 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -480,8 +480,8 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
was_recording = true;
}
- if (can_record && !_last_capture_regions.empty()) {
- _last_capture_regions.clear ();
+ if (can_record && !_last_capture_sources.empty()) {
+ _last_capture_sources.clear ();
}
if (rec_nframes) {
@@ -1447,7 +1447,6 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
plist.add (Properties::start, c->front()->write_source->last_capture_start_frame());
plist.add (Properties::length, total_capture);
plist.add (Properties::name, whole_file_region_name);
-
boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
rx->set_automatic (true);
rx->set_whole_file (true);
@@ -1462,7 +1461,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
/* XXX what now? */
}
- _last_capture_regions.push_back (region);
+ _last_capture_sources.insert (_last_capture_sources.end(), srcs.begin(), srcs.end());
// cerr << _name << ": there are " << capture_info.size() << " capture_info records\n";
@@ -1494,10 +1493,6 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
continue; /* XXX is this OK? */
}
- region->DropReferences.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
-
- _last_capture_regions.push_back (region);
-
i_am_the_modifier++;
_playlist->add_region (region, (*ci)->start, 1, non_layered());
i_am_the_modifier--;
@@ -1914,6 +1909,8 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
boost::shared_ptr<ChannelList> c = channels.reader();
uint32_t n;
+ cerr << name() << " resetting write sources, recrodable " << recordable() << " chans = " << c->size() << endl;
+
if (!_session.writable() || !recordable()) {
return;
}
@@ -2356,6 +2353,7 @@ void
AudioDiskstream::ChannelInfo::resize_capture (nframes_t capture_bufsize)
{
delete capture_buf;
+
capture_buf = new RingBufferNPT<Sample> (capture_bufsize);
memset (capture_buf->buffer(), 0, sizeof (Sample) * capture_buf->bufsize());
}