13
0

correctly track is disk read (audio) should be forwards/backwards, and what was done last time we read from disk

This commit is contained in:
Paul Davis 2020-02-20 00:19:22 -07:00
parent 7ca068f8d5
commit 1e9af51f36
2 changed files with 9 additions and 2 deletions

View File

@ -20,6 +20,8 @@
#ifndef __ardour_disk_reader_h__
#define __ardour_disk_reader_h__
#include <boost/optional.hpp>
#include "pbd/i18n.h"
#include "evoral/Curve.h"
@ -191,6 +193,7 @@ private:
DeclickAmp _declick_amp;
sampleoffset_t _declick_offs;
MidiStateTracker _tracker;
boost::optional<bool> _last_read_reversed;
int _do_refill_with_alloc (bool partial_fill);

View File

@ -630,7 +630,7 @@ DiskReader::overwrite_existing_audio ()
return true;
}
const bool reversed = _session.transport_speed() < 0.0f;
const bool reversed = !_session.transport_will_roll_forwards ();
sampleoffset_t chunk1_offset;
samplecnt_t chunk1_cnt;
@ -739,6 +739,7 @@ DiskReader::seek (samplepos_t sample, bool complete_refill)
int ret = -1;
ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader();
const bool read_reversed = !_session.transport_will_roll_forwards ();
if (c->empty()) {
return 0;
@ -966,6 +967,7 @@ DiskReader::audio_read (Sample* sum_buffer,
sum_buffer += this_read;
}
_last_read_reversed = reversed;
return rcnt;
}
@ -1021,12 +1023,14 @@ DiskReader::refill_audio (Sample* sum_buffer, Sample* mixdown_buffer, float* gai
}
int32_t ret = 0;
bool const reversed = _session.transport_speed() < 0.0f;
bool const reversed = !_session.transport_will_roll_forwards ();
samplecnt_t zero_fill;
uint32_t chan_n;
ChannelList::iterator i;
boost::shared_ptr<ChannelList> c = channels.reader();
_last_read_reversed = !_session.transport_will_roll_forwards ();
if (c->empty()) {
return 0;
}