summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_diskstream.cc
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2009-06-23 09:50:02 +0000
committerHans Baier <hansfbaier@googlemail.com>2009-06-23 09:50:02 +0000
commitf42f577bedbffcd2465341e033afac0a0326a491 (patch)
tree3499d135da2d870010a8231389fb040a22c02218 /libs/ardour/audio_diskstream.cc
parentdef335e427f46513436884bf81d10caf96d7c482 (diff)
Interpolation: First working but buggy version using libsamplerate
git-svn-id: svn://localhost/ardour2/branches/3.0@5255 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_diskstream.cc')
-rw-r--r--libs/ardour/audio_diskstream.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 9ff030678a..47d7b5c6e6 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -821,11 +821,12 @@ AudioDiskstream::process_varispeed_playback(nframes_t nframes, boost::shared_ptr
interpolation.set_target_speed (_target_speed);
interpolation.set_speed (_speed);
- for (chan = c->begin(); chan != c->end(); ++chan) {
+ int channel = 0;
+ for (chan = c->begin(); chan != c->end(); ++chan, ++channel) {
ChannelInfo* chaninfo (*chan);
playback_distance = interpolation.interpolate (
- nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer);
+ channel, nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer);
}
}
@@ -2204,12 +2205,14 @@ AudioDiskstream::set_align_style_from_io ()
int
AudioDiskstream::add_channel_to (boost::shared_ptr<ChannelList> c, uint32_t how_many)
{
+
while (how_many--) {
c->push_back (new ChannelInfo(_session.audio_diskstream_buffer_size(), speed_buffer_size, wrap_buffer_size));
+ interpolation.add_channel_to (_session.audio_diskstream_buffer_size(), speed_buffer_size);
}
_n_channels.set(DataType::AUDIO, c->size());
-
+
return 0;
}
@@ -2226,8 +2229,11 @@ int
AudioDiskstream::remove_channel_from (boost::shared_ptr<ChannelList> c, uint32_t how_many)
{
while (how_many-- && !c->empty()) {
- //delete c->back(); // FIXME: crash (thread safe with RCU?)
+ // FIXME: crash (thread safe with RCU?)
+ // memory leak, when disabled.... :(
+ //delete c->back();
c->pop_back();
+ interpolation.remove_channel_from ();
}
_n_channels.set(DataType::AUDIO, c->size());