summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-18 14:50:09 +0200
committerRobin Gareus <robin@gareus.org>2016-04-18 14:50:09 +0200
commit888614b7144b8a5112d910c3875c681ec0eaa3c8 (patch)
tree9335b258a81a50c4218accca4d03ff14da162e66 /libs
parent652468a34430cb1c7ef841dcc278e2cfb9806ea5 (diff)
never ever change sample-rate saved with the session after creation.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h6
-rw-r--r--libs/ardour/session.cc6
-rw-r--r--libs/ardour/session_state.cc5
-rw-r--r--libs/ardour/session_time.cc2
4 files changed, 11 insertions, 8 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 137b6f04d6..3e8ab07df3 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index fec1229093..e4f3e38032 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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();
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 975b38eee9..6376f1ab0b 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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);
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index ab5a470a8a..6bb018649f 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -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);