From 9afd18358b2a6dff8315e7c592a091e514a7661f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 31 Oct 2011 21:16:54 +0000 Subject: Remove Diskstream member playback_distance that can be passed directly from process() to commit(). git-svn-id: svn://localhost/ardour2/branches/3.0@10359 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_diskstream.cc | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'libs/ardour/audio_diskstream.cc') diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 4588522ab4..77c0ac9432 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -426,7 +426,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n bool collect_playback = false; bool can_record = _session.actively_recording (); - playback_distance = 0; + framecnt_t playback_distance = 0; if (!_io || !_io->active()) { return 0; @@ -643,7 +643,19 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n } if (rec_nframes == 0 && _actual_speed != 1.0f && _actual_speed != -1.0f) { - process_varispeed_playback(nframes, c); + + interpolation.set_speed (_target_speed); + + int channel = 0; + for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++channel) { + ChannelInfo* chaninfo (*chan); + + playback_distance = interpolation.interpolate ( + channel, nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer); + + chaninfo->current_playback_buffer = chaninfo->speed_buffer; + } + } else { playback_distance = nframes; } @@ -653,7 +665,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n ret = 0; - if (commit (nframes)) { + if (commit (playback_distance)) { need_butler = true; } @@ -661,26 +673,8 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n return ret; } -void -AudioDiskstream::process_varispeed_playback (pframes_t nframes, boost::shared_ptr c) -{ - ChannelList::iterator chan; - - interpolation.set_speed (_target_speed); - - int channel = 0; - for (chan = c->begin(); chan != c->end(); ++chan, ++channel) { - ChannelInfo* chaninfo (*chan); - - playback_distance = interpolation.interpolate ( - channel, nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer); - - chaninfo->current_playback_buffer = chaninfo->speed_buffer; - } -} - bool -AudioDiskstream::commit (framecnt_t /* nframes */) +AudioDiskstream::commit (framecnt_t playback_distance) { bool need_butler = false; -- cgit v1.2.3