diff options
author | Carl Hetherington <carl@carlh.net> | 2011-10-31 21:16:54 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-10-31 21:16:54 +0000 |
commit | 9afd18358b2a6dff8315e7c592a091e514a7661f (patch) | |
tree | c0bbea750e8dfaabf8e0a06f02f2bde2ad7fa6d9 /libs | |
parent | 4978c0d4c63bba054181cc0988fd83bc5fa8c9eb (diff) |
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
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/audio_diskstream.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 6 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 38 | ||||
-rw-r--r-- | libs/ardour/diskstream.cc | 2 | ||||
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 9 |
5 files changed, 22 insertions, 37 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 982d08e028..a1b16b394c 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -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); } diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index bac998f677..cfccd48e1f 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -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; 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<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; diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 3c79d31f98..fe86666706 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -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) diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 901aefcf17..15cfb9f1c9 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -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; } |