cleanup after timecnt_t API changed (libs edition)

This commit is contained in:
Paul Davis 2020-12-06 12:57:12 -07:00
parent afea443419
commit fbdf06a794
8 changed files with 20 additions and 10 deletions

View file

@ -34,7 +34,7 @@ public:
int flush_header () { return 0; }
float sample_rate () const { return _sample_rate; }
void set_length (samplecnt_t len) { _length = len; }
void set_length (samplecnt_t len) { _length = timecnt_t (len); }
void flush () {}
bool can_be_analysed() const { return false; }
@ -50,7 +50,7 @@ protected:
, AudioFileSource (s, x, false)
, _sample_rate(srate)
{
_length = len;
_length = timecnt_t (len);
}
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const {

View file

@ -38,6 +38,10 @@ using namespace ARDOUR;
using namespace std;
using namespace PBD;
#include "ardour/audioengine.h"
#define S2SC(s) Temporal::samples_to_superclock (s, AudioEngine::instance()->sample_rate())
#define SC2S(s) Temporal::superclock_to_samples (s, AudioEngine::instance()->sample_rate())
AudioPlaylist::AudioPlaylist (Session& session, const XMLNode& node, bool hidden)
: Playlist (session, node, DataType::AUDIO, hidden)
{

View file

@ -64,6 +64,10 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
#include "ardour/audioengine.h"
#define S2SC(s) Temporal::samples_to_superclock (s, AudioEngine::instance()->sample_rate())
#define SC2S(s) Temporal::superclock_to_samples (s, AudioEngine::instance()->sample_rate())
namespace ARDOUR {
namespace Properties {
PBD::PropertyDescriptor<bool> envelope_active;
@ -706,6 +710,7 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* MIX OR COPY THE REGION BODY FROM mixdown_buffer INTO buf */
samplecnt_t const N = to_read - fade_in_limit - fade_out_limit;
if (N > 0) {
if (is_opaque) {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Region %1 memcpy into buf @ %2 + %3, from mixdown buffer @ %4 + %5, len = %6 cnt was %7\n",
@ -735,6 +740,7 @@ samplecnt_t
AudioRegion::read_from_sources (SourceList const & srcs, samplecnt_t limit, Sample* buf, samplepos_t position, samplecnt_t cnt, uint32_t chan_n) const
{
sampleoffset_t const internal_offset = position - _position.val().samples();
if (internal_offset >= limit) {
return 0;
}
@ -747,6 +753,7 @@ AudioRegion::read_from_sources (SourceList const & srcs, samplecnt_t limit, Samp
if (chan_n < n_channels()) {
boost::shared_ptr<AudioSource> src = boost::dynamic_pointer_cast<AudioSource> (srcs[chan_n]);
if (src->read (buf, _start.val().samples() + internal_offset, to_read) != to_read) {
return 0; /* "read nothing" */
}

View file

@ -1295,8 +1295,6 @@ DiskReader::refill_audio (Sample* sum_buffer, Sample* mixdown_buffer, float* gai
to_read = min (to_read, samples_to_read);
assert (to_read >= 0);
// cerr << owner()->name() << " to-read: " << to_read << endl;
if (to_read) {
ReaderChannelInfo* rci = dynamic_cast<ReaderChannelInfo*> (chan);

View file

@ -224,7 +224,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/,
if (position < _position) {
/* we are starting the read from before the start of the region */
internal_offset = 0;
internal_offset = timecnt_t (Temporal::BeatTime);;
dur -= position.distance (_position);
} else {
/* we are starting the read from after the start of the region */
@ -300,7 +300,7 @@ MidiRegion::render (Evoral::EventSink<samplepos_t>& dst,
if (!_position.val().zero()) {
/* we are starting the read from before the start of the region */
internal_offset = 0;
internal_offset = timecnt_t (Temporal::BeatTime);
} else {
/* we are starting the read from after the start of the region */
internal_offset = timecnt_t (-_position.val());

View file

@ -37,7 +37,7 @@ Mp3FileSource::Mp3FileSource (Session& s, const string& path, int chn, Flag flag
, _mp3 (path)
, _channel (chn)
{
_length = _mp3.length ();
_length = timecnt_t (_mp3.length ());
if (_channel >= (int) _mp3.channels ()) {
error << string_compose("Mp3FileSource: file only contains %1 channels; %2 is invalid as a channel number (%3)", _mp3.channels (), _channel, name()) << endmsg;

View file

@ -818,7 +818,7 @@ Region::move_start (timecnt_t const & distance)
} else {
if (_start < -distance) {
new_start = 0;
new_start = timecnt_t (_start.val().time_domain());
} else {
new_start = start() + distance;
}
@ -964,7 +964,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len)
} else if (start_shift.negative()) {
if (start() < -start_shift && !can_trim_start_before_source_start ()) {
new_start = 0;
new_start = timecnt_t (start().time_domain());
} else {
new_start = start() + start_shift;
}

View file

@ -381,7 +381,8 @@ SndFileSource::open ()
return -1;
}
_length = _info.frames;
_length = timecnt_t (_info.frames);
#ifdef HAVE_RF64_RIFF
if (_file_is_new && _length == 0 && writable()) {