never ever change sample-rate saved with the session after creation.
authorRobin Gareus <robin@gareus.org>
Mon, 18 Apr 2016 12:50:09 +0000 (14:50 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 18 Apr 2016 12:50:09 +0000 (14:50 +0200)
libs/ardour/ardour/session.h
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/ardour/session_time.cc

index 137b6f04d6efd5506229cc7d50811f18240941df..3e8ab07df38666450f41f80c2c3c40031f7614d8 100644 (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;
index fec12290932d8e489d0f6d4422b600ee6b4487cd..e4f3e3803228fffe296c860bf9d016ca36a64da2 100644 (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();
index 975b38eee9c18dadbd69acba34d8d3279f7adecd..6376f1ab0b4b599abee71a032e1c8f2553517f0d 100644 (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);
index ab5a470a8af096c130008eca578fc7d600a115b5..6bb018649fd5bdff8c0ebd51a0de04417c664759 100644 (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);