Remove direct use of audio-engine rate (1/2)

This is in preparation for sample-rate independence.
This commit is contained in:
Robin Gareus 2023-01-22 20:06:14 +01:00
parent 859d6ebe4a
commit 5130a43d87
5 changed files with 12 additions and 11 deletions

View File

@ -39,8 +39,8 @@ 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())
#define S2SC(s) Temporal::samples_to_superclock (s, TEMPORAL_SAMPLE_RATE)
#define SC2S(s) Temporal::superclock_to_samples (s, TEMPORAL_SAMPLE_RATE)
AudioPlaylist::AudioPlaylist (Session& session, const XMLNode& node, bool hidden)
: Playlist (session, node, DataType::AUDIO, hidden)

View File

@ -70,8 +70,8 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
#define S2SC(s) Temporal::samples_to_superclock (s, AudioEngine::instance()->sample_rate())
#define SC2S(s) Temporal::superclock_to_samples (s, AudioEngine::instance()->sample_rate())
#define S2SC(s) Temporal::samples_to_superclock (s, TEMPORAL_SAMPLE_RATE)
#define SC2S(s) Temporal::superclock_to_samples (s, TEMPORAL_SAMPLE_RATE)
namespace ARDOUR {
namespace Properties {

View File

@ -151,6 +151,7 @@ ARDOUR::samplecnt_t
LTC_TransportMaster::update_interval() const
{
if (timecode.rate) {
/* Use engine rate, timecode ports are not resampled */
return AudioEngine::instance()->sample_rate() / timecode.rate;
}

View File

@ -2747,12 +2747,12 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
samplepos_t start0 = std::max (samplepos_t (0), start);
TempoMap::SharedPtr tmap (TempoMap::use());
TempoMetric metric (tmap->metric_at (samples_to_superclock (start0, AudioEngine::instance()->sample_rate())));
TempoMetric metric (tmap->metric_at (samples_to_superclock (start0, TEMPORAL_SAMPLE_RATE)));
TempoMapPoints tempo_map_points;
tmap->get_grid (tempo_map_points,
samples_to_superclock (start0, AudioEngine::instance()->sample_rate()),
samples_to_superclock (end, AudioEngine::instance()->sample_rate()), 0);
samples_to_superclock (start0, TEMPORAL_SAMPLE_RATE),
samples_to_superclock (end, TEMPORAL_SAMPLE_RATE), 0);
if (_freewheel_control_port) {
*_freewheel_control_port = _session.engine().freewheeling() ? 1.f : 0.f;
@ -2890,9 +2890,9 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
}
}
while (m != m_end || ((tempo_map_point != tempo_map_points.end()) && ((*tempo_map_point).sample(AudioEngine::instance()->sample_rate()) < tend))) {
while (m != m_end || ((tempo_map_point != tempo_map_points.end()) && ((*tempo_map_point).sample(TEMPORAL_SAMPLE_RATE) < tend))) {
if (m != m_end && ((tempo_map_point == tempo_map_points.end()) || (*tempo_map_point).sample(AudioEngine::instance()->sample_rate()) > (*m).time())) {
if (m != m_end && ((tempo_map_point == tempo_map_points.end()) || (*tempo_map_point).sample(TEMPORAL_SAMPLE_RATE) > (*m).time())) {
const Evoral::Event<samplepos_t> ev (*m, false);
@ -2905,7 +2905,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
} else {
assert (tempo_map_point != tempo_map_points.end());
const samplepos_t sample = tempo_map_point->sample (AudioEngine::instance()->sample_rate());
const samplepos_t sample = tempo_map_point->sample (TEMPORAL_SAMPLE_RATE);
const Temporal::BBT_Time bbt = tempo_map_point->bbt();
double bpm = tempo_map_point->tempo().quarter_notes_per_minute ();

View File

@ -280,7 +280,7 @@ intptr_t Session::vst_callback (
} else {
timeinfo->samplePos = 0;
timeinfo->sampleRate = AudioEngine::instance()->sample_rate();
timeinfo->sampleRate = TEMPORAL_SAMPLE_RATE;
}
if ((timeinfo->flags & (kVstTransportPlaying | kVstTransportRecording | kVstTransportCycleActive))