never ever change sample-rate saved with the session after creation.

This commit is contained in:
Robin Gareus
2016-04-18 14:50:09 +02:00
parent 652468a344
commit 888614b714
4 changed files with 11 additions and 8 deletions

View File

@@ -1152,9 +1152,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
process_function_type last_process_function;
bool _bounce_processing_active;
bool waiting_for_sync_offset;
framecnt_t _base_frame_rate;
framecnt_t _current_frame_rate; //this includes video pullup offset
framecnt_t _nominal_frame_rate; //ignores audioengine setting, "native" SR
framecnt_t _base_frame_rate; // sample-rate of the session at creation time, "native" SR
framecnt_t _nominal_frame_rate; // overridden by audioengine setting
framecnt_t _current_frame_rate; // this includes video pullup offset
int transport_sub_state;
mutable gint _record_status;
framepos_t _transport_frame;

View File

@@ -166,8 +166,8 @@ Session::Session (AudioEngine &eng,
, _bounce_processing_active (false)
, waiting_for_sync_offset (false)
, _base_frame_rate (0)
, _current_frame_rate (0)
, _nominal_frame_rate (0)
, _current_frame_rate (0)
, transport_sub_state (0)
, _record_status (Disabled)
, _transport_frame (0)
@@ -2024,7 +2024,9 @@ Session::set_frame_rate (framecnt_t frames_per_second)
here.
*/
_base_frame_rate = frames_per_second;
if (_base_frame_rate == 0) {
_base_frame_rate = frames_per_second;
}
_nominal_frame_rate = frames_per_second;
sync_time_vars();

View File

@@ -1046,7 +1046,7 @@ Session::state (bool full_state)
if (full_state) {
node->add_property ("name", _name);
snprintf (buf, sizeof (buf), "%" PRId64, _nominal_frame_rate);
snprintf (buf, sizeof (buf), "%" PRId64, _base_frame_rate);
node->add_property ("sample-rate", buf);
if (session_dirs.size() > 1) {
@@ -1313,7 +1313,8 @@ Session::set_state (const XMLNode& node, int version)
if ((prop = node.property (X_("sample-rate"))) != 0) {
_nominal_frame_rate = atoi (prop->value());
_base_frame_rate = atoi (prop->value());
_nominal_frame_rate = _base_frame_rate;
if (_nominal_frame_rate != _current_frame_rate) {
boost::optional<int> r = AskAboutSampleRateMismatch (_nominal_frame_rate, _current_frame_rate);

View File

@@ -66,7 +66,7 @@ Session::timecode_drop_frames() const
void
Session::sync_time_vars ()
{
_current_frame_rate = (framecnt_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0)));
_current_frame_rate = (framecnt_t) round (_nominal_frame_rate * (1.0 + (config.get_video_pullup()/100.0)));
_frames_per_timecode_frame = (double) _current_frame_rate / (double) timecode_frames_per_second();
if (timecode_drop_frames()) {
_frames_per_hour = (int32_t)(107892 * _frames_per_timecode_frame);