Remove Diskstream member playback_distance that can be
authorCarl Hetherington <carl@carlh.net>
Mon, 31 Oct 2011 21:16:54 +0000 (21:16 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 31 Oct 2011 21:16:54 +0000 (21:16 +0000)
passed directly from process() to commit().

git-svn-id: svn://localhost/ardour2/branches/3.0@10359 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/audio_diskstream.h
libs/ardour/ardour/diskstream.h
libs/ardour/audio_diskstream.cc
libs/ardour/diskstream.cc
libs/ardour/midi_diskstream.cc

index 982d08e028f57a1d38f90dcc41f53717ab306d97..a1b16b394c7cbd278bb4e5aadc72ec8a6a2add5f 100644 (file)
@@ -152,7 +152,7 @@ class AudioDiskstream : public Diskstream
        friend class AudioTrack;
 
        int  process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
-       bool commit  (framecnt_t nframes);
+       bool commit  (framecnt_t);
 
   private:
        struct ChannelSource {
@@ -206,8 +206,6 @@ class AudioDiskstream : public Diskstream
 
        typedef std::vector<ChannelInfo*> ChannelList;
 
-       void process_varispeed_playback (pframes_t nframes, boost::shared_ptr<ChannelList> c);
-
        /* The two central butler operations */
        int do_flush (RunContext context, bool force = false);
        int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer); }
index bac998f677c51a04250a58a3badb1be33512ec89..cfccd48e1f4053b9c16c0d7a07f8bce57f874787 100644 (file)
@@ -183,7 +183,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
        friend class Track;
 
        virtual int  process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) = 0;
-       virtual bool commit  (framecnt_t nframes) = 0;
+       virtual bool commit  (framecnt_t) = 0;
 
        //private:
 
@@ -286,10 +286,6 @@ class Diskstream : public SessionObject, public PublicDiskstream
        /** The next frame position that we should be reading from in our playlist */
        framepos_t     file_frame;
        framepos_t     playback_sample;
-       /** The number of frames that have been played back this time around the process/commit
-        *  cycle, accounting for varispeed.
-        */
-       framecnt_t     playback_distance;
 
        bool          in_set_state;
 
index 4588522ab426d0fc0131517e9337d01a7f47e206..77c0ac94324cac3318d6462f410cf6873987f1e2 100644 (file)
@@ -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<ChannelList> 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;
 
index 3c79d31f98a4f032a178ee99ce96394f023e03cb..fe86666706bcb7fc275527fbf89f3fc1d669e9a4 100644 (file)
@@ -109,7 +109,6 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
         , _target_speed (_speed)
         , file_frame (0)
         , playback_sample (0)
-        , playback_distance (0)
         , in_set_state (false)
         , _flags (flag)
         , deprecated_io_node (0)
@@ -150,7 +149,6 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
         , _target_speed (_speed)
         , file_frame (0)
         , playback_sample (0)
-        , playback_distance (0)
         , in_set_state (false)
         , _flags (Recordable)
         , deprecated_io_node (0)
index 901aefcf17dc6885a71b35d0d54eb3d6f3a20a21..15cfb9f1c91d3c156c1eedc2306f8cc2856e2bbe 100644 (file)
@@ -483,8 +483,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
        bool      nominally_recording;
        bool      re = record_enabled ();
        bool      can_record = _session.actively_recording ();
-
-       playback_distance = 0;
+       framecnt_t playback_distance = 0;
 
        check_record_status (transport_frame, can_record);
 
@@ -599,7 +598,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
 
        ret = 0;
 
-       if (commit (nframes)) {
+       if (commit (playback_distance)) {
                need_butler = true;
        }
 
@@ -607,7 +606,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
 }
 
 bool
-MidiDiskstream::commit (framecnt_t nframes)
+MidiDiskstream::commit (framecnt_t playback_distance)
 {
        bool need_butler = false;
 
@@ -624,7 +623,7 @@ MidiDiskstream::commit (framecnt_t nframes)
 
        uint32_t frames_read = g_atomic_int_get(&_frames_read_from_ringbuffer);
        uint32_t frames_written = g_atomic_int_get(&_frames_written_to_ringbuffer);
-       if ((frames_written - frames_read) + nframes < midi_readahead) {
+       if ((frames_written - frames_read) + playback_distance < midi_readahead) {
                need_butler = true;
        }