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
This commit is contained in:
parent
4978c0d4c6
commit
9afd18358b
@ -152,7 +152,7 @@ class AudioDiskstream : public Diskstream
|
|||||||
friend class AudioTrack;
|
friend class AudioTrack;
|
||||||
|
|
||||||
int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
|
int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
|
||||||
bool commit (framecnt_t nframes);
|
bool commit (framecnt_t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ChannelSource {
|
struct ChannelSource {
|
||||||
@ -206,8 +206,6 @@ class AudioDiskstream : public Diskstream
|
|||||||
|
|
||||||
typedef std::vector<ChannelInfo*> ChannelList;
|
typedef std::vector<ChannelInfo*> ChannelList;
|
||||||
|
|
||||||
void process_varispeed_playback (pframes_t nframes, boost::shared_ptr<ChannelList> c);
|
|
||||||
|
|
||||||
/* The two central butler operations */
|
/* The two central butler operations */
|
||||||
int do_flush (RunContext context, bool force = false);
|
int do_flush (RunContext context, bool force = false);
|
||||||
int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer); }
|
int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer); }
|
||||||
|
@ -183,7 +183,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
|
|||||||
friend class Track;
|
friend class Track;
|
||||||
|
|
||||||
virtual int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) = 0;
|
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:
|
//private:
|
||||||
|
|
||||||
@ -286,10 +286,6 @@ class Diskstream : public SessionObject, public PublicDiskstream
|
|||||||
/** The next frame position that we should be reading from in our playlist */
|
/** The next frame position that we should be reading from in our playlist */
|
||||||
framepos_t file_frame;
|
framepos_t file_frame;
|
||||||
framepos_t playback_sample;
|
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 in_set_state;
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n
|
|||||||
bool collect_playback = false;
|
bool collect_playback = false;
|
||||||
bool can_record = _session.actively_recording ();
|
bool can_record = _session.actively_recording ();
|
||||||
|
|
||||||
playback_distance = 0;
|
framecnt_t playback_distance = 0;
|
||||||
|
|
||||||
if (!_io || !_io->active()) {
|
if (!_io || !_io->active()) {
|
||||||
return 0;
|
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) {
|
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 {
|
} else {
|
||||||
playback_distance = nframes;
|
playback_distance = nframes;
|
||||||
}
|
}
|
||||||
@ -653,7 +665,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if (commit (nframes)) {
|
if (commit (playback_distance)) {
|
||||||
need_butler = true;
|
need_butler = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,26 +673,8 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n
|
|||||||
return ret;
|
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
|
bool
|
||||||
AudioDiskstream::commit (framecnt_t /* nframes */)
|
AudioDiskstream::commit (framecnt_t playback_distance)
|
||||||
{
|
{
|
||||||
bool need_butler = false;
|
bool need_butler = false;
|
||||||
|
|
||||||
|
@ -109,7 +109,6 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
|
|||||||
, _target_speed (_speed)
|
, _target_speed (_speed)
|
||||||
, file_frame (0)
|
, file_frame (0)
|
||||||
, playback_sample (0)
|
, playback_sample (0)
|
||||||
, playback_distance (0)
|
|
||||||
, in_set_state (false)
|
, in_set_state (false)
|
||||||
, _flags (flag)
|
, _flags (flag)
|
||||||
, deprecated_io_node (0)
|
, deprecated_io_node (0)
|
||||||
@ -150,7 +149,6 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
|
|||||||
, _target_speed (_speed)
|
, _target_speed (_speed)
|
||||||
, file_frame (0)
|
, file_frame (0)
|
||||||
, playback_sample (0)
|
, playback_sample (0)
|
||||||
, playback_distance (0)
|
|
||||||
, in_set_state (false)
|
, in_set_state (false)
|
||||||
, _flags (Recordable)
|
, _flags (Recordable)
|
||||||
, deprecated_io_node (0)
|
, deprecated_io_node (0)
|
||||||
|
@ -483,8 +483,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
|
|||||||
bool nominally_recording;
|
bool nominally_recording;
|
||||||
bool re = record_enabled ();
|
bool re = record_enabled ();
|
||||||
bool can_record = _session.actively_recording ();
|
bool can_record = _session.actively_recording ();
|
||||||
|
framecnt_t playback_distance = 0;
|
||||||
playback_distance = 0;
|
|
||||||
|
|
||||||
check_record_status (transport_frame, can_record);
|
check_record_status (transport_frame, can_record);
|
||||||
|
|
||||||
@ -599,7 +598,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if (commit (nframes)) {
|
if (commit (playback_distance)) {
|
||||||
need_butler = true;
|
need_butler = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +606,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MidiDiskstream::commit (framecnt_t nframes)
|
MidiDiskstream::commit (framecnt_t playback_distance)
|
||||||
{
|
{
|
||||||
bool need_butler = false;
|
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_read = g_atomic_int_get(&_frames_read_from_ringbuffer);
|
||||||
uint32_t frames_written = g_atomic_int_get(&_frames_written_to_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;
|
need_butler = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user