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 {
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); }
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:
/** 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;
bool collect_playback = false;
bool can_record = _session.actively_recording ();
- playback_distance = 0;
+ framecnt_t playback_distance = 0;
if (!_io || !_io->active()) {
return 0;
}
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;
}
ret = 0;
- if (commit (nframes)) {
+ if (commit (playback_distance)) {
need_butler = true;
}
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;
, _target_speed (_speed)
, file_frame (0)
, playback_sample (0)
- , playback_distance (0)
, in_set_state (false)
, _flags (flag)
, deprecated_io_node (0)
, _target_speed (_speed)
, file_frame (0)
, playback_sample (0)
- , playback_distance (0)
, in_set_state (false)
, _flags (Recordable)
, deprecated_io_node (0)
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);
ret = 0;
- if (commit (nframes)) {
+ if (commit (playback_distance)) {
need_butler = true;
}
}
bool
-MidiDiskstream::commit (framecnt_t nframes)
+MidiDiskstream::commit (framecnt_t playback_distance)
{
bool need_butler = false;
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;
}