summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_diskstream.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-09 17:24:07 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-09 17:24:07 +0000
commit14004b75a6d18a74fa59ac06c203af693164b774 (patch)
tree1d0d3f416a7c1c1a8d8edd8ff630d87e2b276498 /libs/ardour/audio_diskstream.cc
parent01829e63382ebab3d54b02fffbad11de7cf69ea6 (diff)
dynamic playback & capture buffer resizing (though transport is stopped first)
git-svn-id: svn://localhost/ardour2/branches/3.0@7250 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_diskstream.cc')
-rw-r--r--libs/ardour/audio_diskstream.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index d864d86cf8..b3204c38b6 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -2297,6 +2297,26 @@ AudioDiskstream::can_become_destructive (bool& requires_bounce) const
return true;
}
+void
+AudioDiskstream::adjust_playback_buffering ()
+{
+ boost::shared_ptr<ChannelList> c = channels.reader();
+
+ for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
+ (*chan)->resize_playback (_session.butler()->audio_diskstream_playback_buffer_size());
+ }
+}
+
+void
+AudioDiskstream::adjust_capture_buffering ()
+{
+ boost::shared_ptr<ChannelList> c = channels.reader();
+
+ for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
+ (*chan)->resize_capture (_session.butler()->audio_diskstream_capture_buffer_size());
+ }
+}
+
AudioDiskstream::ChannelInfo::ChannelInfo (nframes_t playback_bufsize, nframes_t capture_bufsize, nframes_t speed_size, nframes_t wrap_size)
{
peak_power = 0.0f;
@@ -2324,6 +2344,22 @@ AudioDiskstream::ChannelInfo::ChannelInfo (nframes_t playback_bufsize, nframes_t
memset (capture_transition_buf->buffer(), 0, sizeof (CaptureTransition) * capture_transition_buf->bufsize());
}
+void
+AudioDiskstream::ChannelInfo::resize_playback (nframes_t playback_bufsize)
+{
+ delete playback_buf;
+ playback_buf = new RingBufferNPT<Sample> (playback_bufsize);
+ memset (playback_buf->buffer(), 0, sizeof (Sample) * playback_buf->bufsize());
+}
+
+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());
+}
+
AudioDiskstream::ChannelInfo::~ChannelInfo ()
{
write_source.reset ();
@@ -2346,3 +2382,4 @@ AudioDiskstream::ChannelInfo::~ChannelInfo ()
delete capture_transition_buf;
capture_transition_buf = 0;
}
+