Consolidate base and nominal SR
Now that mismatched sample-rates are resampled, there is no distinction between base and nominal sample-rate.
This commit is contained in:
parent
53cfbe9c7f
commit
d89162745f
@ -517,7 +517,7 @@ public:
|
||||
/** "actual" sample rate of session, set by current audioengine rate, pullup/down etc. */
|
||||
samplecnt_t sample_rate () const { return _current_sample_rate; }
|
||||
/** "native" sample rate of session, regardless of current audioengine rate, pullup/down etc */
|
||||
samplecnt_t nominal_sample_rate () const { return _nominal_sample_rate; }
|
||||
samplecnt_t nominal_sample_rate () const { return _base_sample_rate; }
|
||||
samplecnt_t frames_per_hour () const { return _frames_per_hour; }
|
||||
|
||||
double samples_per_timecode_frame() const { return _samples_per_timecode_frame; }
|
||||
@ -1432,7 +1432,6 @@ private:
|
||||
bool _bounce_processing_active;
|
||||
bool waiting_for_sync_offset;
|
||||
samplecnt_t _base_sample_rate; // sample-rate of the session at creation time, "native" SR
|
||||
samplecnt_t _nominal_sample_rate; // overridden by audioengine setting
|
||||
samplecnt_t _current_sample_rate; // this includes video pullup offset
|
||||
samplepos_t _transport_sample;
|
||||
GATOMIC_QUAL gint _seek_counter;
|
||||
|
@ -191,7 +191,6 @@ Session::Session (AudioEngine &eng,
|
||||
, _bounce_processing_active (false)
|
||||
, waiting_for_sync_offset (false)
|
||||
, _base_sample_rate (0)
|
||||
, _nominal_sample_rate (0)
|
||||
, _current_sample_rate (0)
|
||||
, _transport_sample (0)
|
||||
, _session_range_location (0)
|
||||
@ -2111,21 +2110,28 @@ Session::preroll_samples (samplepos_t pos) const
|
||||
void
|
||||
Session::set_sample_rate (samplecnt_t frames_per_second)
|
||||
{
|
||||
/** \fn void Session::set_sample_size(samplecnt_t)
|
||||
the AudioEngine object that calls this guarantees
|
||||
that it will not be called while we are also in
|
||||
::process(). Its fine to do things that block
|
||||
here.
|
||||
/* this is called from the engine when SR changes,
|
||||
* and after creating or loading a session
|
||||
* via post_engine_init().
|
||||
*
|
||||
* In the latter case this call can happen
|
||||
* concurrently with processing.
|
||||
*/
|
||||
|
||||
if (_base_sample_rate == 0) {
|
||||
_base_sample_rate = frames_per_second;
|
||||
}
|
||||
else if (_base_sample_rate != frames_per_second && frames_per_second != _nominal_sample_rate && _engine.running ()) {
|
||||
else if (_base_sample_rate != frames_per_second && _engine.running ()) {
|
||||
NotifyAboutSampleRateMismatch (_base_sample_rate, frames_per_second);
|
||||
}
|
||||
_nominal_sample_rate = _base_sample_rate;
|
||||
Temporal::set_sample_rate (_nominal_sample_rate);
|
||||
|
||||
/* The session's actual SR does not change.
|
||||
* _engine.Running calls Session::initialize_latencies ()
|
||||
* which sets up resampling, so the following really needs
|
||||
* to be called only once.
|
||||
*/
|
||||
|
||||
Temporal::set_sample_rate (_base_sample_rate);
|
||||
|
||||
sync_time_vars();
|
||||
|
||||
@ -2136,12 +2142,7 @@ Session::set_sample_rate (samplecnt_t frames_per_second)
|
||||
Location* loc = _locations->auto_loop_location ();
|
||||
DiskReader::reset_loop_declick (loc, nominal_sample_rate());
|
||||
|
||||
// XXX we need some equivalent to this, somehow
|
||||
// SndFileSource::setup_standard_crossfades (frames_per_second);
|
||||
|
||||
set_dirty();
|
||||
|
||||
/* XXX need to reset/reinstantiate all LADSPA plugins */
|
||||
}
|
||||
|
||||
void
|
||||
@ -4387,7 +4388,7 @@ Session::maybe_update_session_range (timepos_t const & a, timepos_t const & b)
|
||||
return;
|
||||
}
|
||||
|
||||
samplepos_t session_end_marker_shift_samples = session_end_shift * _nominal_sample_rate;
|
||||
samplepos_t session_end_marker_shift_samples = session_end_shift * nominal_sample_rate ();
|
||||
|
||||
if (_session_range_location == 0) {
|
||||
|
||||
|
@ -112,7 +112,7 @@ Session::process (pframes_t nframes)
|
||||
|
||||
boost::shared_ptr<GraphChain> io_graph_chain = _io_graph_chain[0];
|
||||
if (io_graph_chain) {
|
||||
PortManager::falloff_cache_calc (nframes, _nominal_sample_rate);
|
||||
PortManager::falloff_cache_calc (nframes, nominal_sample_rate ());
|
||||
_process_graph->process_io_plugs (io_graph_chain, nframes, 0);
|
||||
io_graph_chain.reset (); /* drop reference */
|
||||
}
|
||||
|
@ -1690,8 +1690,8 @@ Session::set_state (const XMLNode& node, int version)
|
||||
|
||||
if (node.get_property (X_("sample-rate"), _base_sample_rate)) {
|
||||
|
||||
_nominal_sample_rate = _base_sample_rate;
|
||||
Temporal::set_sample_rate (_nominal_sample_rate);
|
||||
/* required to convert positions during session load */
|
||||
Temporal::set_sample_rate (_base_sample_rate);
|
||||
|
||||
while (!AudioEngine::instance()->running () || _base_sample_rate != AudioEngine::instance()->sample_rate ()) {
|
||||
boost::optional<int> r = AskAboutSampleRateMismatch (_base_sample_rate, _current_sample_rate);
|
||||
@ -1702,7 +1702,6 @@ Session::set_state (const XMLNode& node, int version)
|
||||
} else if (rv == -1 && AudioEngine::instance()->running ()) {
|
||||
/* retry */
|
||||
set_block_size (_engine.samples_per_cycle());
|
||||
/* retry */
|
||||
continue;
|
||||
} else {
|
||||
if (AudioEngine::instance()->running ()) {
|
||||
@ -1716,7 +1715,7 @@ Session::set_state (const XMLNode& node, int version)
|
||||
}
|
||||
|
||||
if (_base_sample_rate != _engine.sample_rate ()) {
|
||||
set_sample_rate (_engine.sample_rate());
|
||||
set_sample_rate (_base_sample_rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ Session::timecode_drop_frames() const
|
||||
void
|
||||
Session::sync_time_vars ()
|
||||
{
|
||||
_current_sample_rate = (samplecnt_t) round (_nominal_sample_rate * (1.0 + (config.get_video_pullup()/100.0)));
|
||||
_current_sample_rate = (samplecnt_t) round (_base_sample_rate * (1.0 + (config.get_video_pullup()/100.0)));
|
||||
_samples_per_timecode_frame = (double) _current_sample_rate / (double) timecode_frames_per_second();
|
||||
if (timecode_drop_frames()) {
|
||||
_frames_per_hour = (int32_t)(107892 * _samples_per_timecode_frame);
|
||||
|
Loading…
Reference in New Issue
Block a user