summaryrefslogtreecommitdiff
path: root/libs/ardour/disk_io.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-05-22 21:35:27 +0200
committerRobin Gareus <robin@gareus.org>2018-07-09 17:30:38 +0200
commit87b2c94759ab95c31bf0ba43e299eb78dcfd6385 (patch)
treed8e2b40750f2c4729b6adb09256027cf6ffd3a50 /libs/ardour/disk_io.cc
parentcf11764763c302242f4d803cae2c326a66c8f5d8 (diff)
Separate ChannelInfo for disk reader and writer
This allows to use different types for write and read buffers, in preparation for a dedicated reader-buffer.
Diffstat (limited to 'libs/ardour/disk_io.cc')
-rw-r--r--libs/ardour/disk_io.cc57
1 files changed, 24 insertions, 33 deletions
diff --git a/libs/ardour/disk_io.cc b/libs/ardour/disk_io.cc
index 0f5cc657a4..d546bd5340 100644
--- a/libs/ardour/disk_io.cc
+++ b/libs/ardour/disk_io.cc
@@ -63,6 +63,23 @@ DiskIOProcessor::DiskIOProcessor (Session& s, string const & str, Flag f)
set_display_to_user (false);
}
+DiskIOProcessor::~DiskIOProcessor ()
+{
+ {
+ RCUWriter<ChannelList> writer (channels);
+ boost::shared_ptr<ChannelList> c = writer.get_copy();
+
+ for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
+ delete *chan;
+ }
+
+ c->clear();
+ }
+
+ channels.flush ();
+}
+
+
void
DiskIOProcessor::init ()
{
@@ -219,20 +236,6 @@ DiskIOProcessor::set_state (const XMLNode& node, int version)
}
int
-DiskIOProcessor::add_channel_to (boost::shared_ptr<ChannelList> c, uint32_t how_many)
-{
- while (how_many--) {
- c->push_back (new ChannelInfo (_session.butler()->audio_diskstream_playback_buffer_size()));
- DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: new channel, write space = %2 read = %3\n",
- name(),
- c->back()->buf->write_space(),
- c->back()->buf->read_space()));
- }
-
- return 0;
-}
-
-int
DiskIOProcessor::add_channel (uint32_t how_many)
{
RCUWriter<ChannelList> writer (channels);
@@ -329,32 +332,20 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
}
DiskIOProcessor::ChannelInfo::ChannelInfo (samplecnt_t bufsize)
- : buf (new RingBufferNPT<Sample> (bufsize))
+ : buf (0)
+ , wbuf (0)
+ , capture_transition_buf (0)
+ , curr_capture_cnt (0)
{
- /* touch the ringbuffer buffer, which will cause
- them to be mapped into locked physical RAM if
- we're running with mlockall(). this doesn't do
- much if we're not.
- */
-
- memset (buf->buffer(), 0, sizeof (Sample) * buf->bufsize());
- capture_transition_buf = new RingBufferNPT<CaptureTransition> (256);
-}
-
-void
-DiskIOProcessor::ChannelInfo::resize (samplecnt_t bufsize)
-{
- delete buf;
- buf = new RingBufferNPT<Sample> (bufsize);
- memset (buf->buffer(), 0, sizeof (Sample) * buf->bufsize());
}
DiskIOProcessor::ChannelInfo::~ChannelInfo ()
{
delete buf;
- buf = 0;
-
+ delete wbuf;
delete capture_transition_buf;
+ buf = 0;
+ wbuf = 0;
capture_transition_buf = 0;
}