Various adjustments to make more operations respect the Edit property on route groups.
[ardour.git] / libs / ardour / session_time.cc
index 281c3a3315c75bb2d9470c985d4a44fe2d6f1031..32a94adee106c4d3e5da729953e453a382a4a25d 100644 (file)
 #include <cmath>
 #include <unistd.h>
 
-#include <ardour/timestamps.h>
+#include "ardour/timestamps.h"
 
-#include <pbd/error.h>
-#include <pbd/enumwriter.h>
-#include <pbd/stacktrace.h>
+#include "pbd/error.h"
+#include "pbd/enumwriter.h"
+#include "pbd/stacktrace.h"
 
-#include <ardour/ardour.h>
-#include <ardour/configuration.h>
-#include <ardour/audioengine.h>
-#include <ardour/session.h>
-#include <ardour/tempo.h>
+#include "ardour/ardour.h"
+#include "ardour/configuration.h"
+#include "ardour/audioengine.h"
+#include "ardour/session.h"
+#include "ardour/tempo.h"
 
 #include "i18n.h"
 
+using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
@@ -51,7 +52,7 @@ Session::bbt_time (nframes_t when, BBT_Time& bbt)
 float
 Session::smpte_frames_per_second() const
 {
-       switch (Config->get_smpte_format()) {
+       switch (config.get_smpte_format()) {
                case smpte_23976: 
                        return 23.976;
 
@@ -100,7 +101,7 @@ Session::smpte_frames_per_second() const
 bool
 Session::smpte_drop_frames() const
 {
-       switch (Config->get_smpte_format()) {
+       switch (config.get_smpte_format()) {
                case smpte_23976: 
                        return false;
 
@@ -149,7 +150,7 @@ Session::smpte_drop_frames() const
 void
 Session::sync_time_vars ()
 {
-       _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (Config->get_video_pullup()/100.0)));
+       _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0)));
        _frames_per_smpte_frame = (double) _current_frame_rate / (double) smpte_frames_per_second();
        if (smpte_drop_frames()) {
          _frames_per_hour = (long)(107892 * _frames_per_smpte_frame);
@@ -158,14 +159,6 @@ Session::sync_time_vars ()
        }
        _smpte_frames_per_hour = (nframes_t)rint(smpte_frames_per_second() * 3600.0);
 
-}
-
-int
-Session::set_smpte_format (SmpteFormat format)
-{
-
-       Config->set_smpte_format (format);
-
        last_smpte_valid = false;
        // smpte type bits are the middle two in the upper nibble
        switch ((int) ceil (smpte_frames_per_second())) {
@@ -186,8 +179,6 @@ Session::set_smpte_format (SmpteFormat format)
                }
                break;
        };
-
-       return 0;
 }
 
 void
@@ -273,7 +264,7 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset
        }
   
        if (use_subframes) {
-               sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / Config->get_subframes_per_frame());
+               sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / config.get_subframes_per_frame());
        }
   
        if (use_offset) {
@@ -335,10 +326,10 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset,
        // Calculate exact number of (exceeding) smpte frames and fractional frames
        smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame;
        smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact );
-       smpte.subframes = (long) rint(smpte_frames_fraction * Config->get_subframes_per_frame());
+       smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame());
   
        // XXX Not sure if this is necessary anymore...
-       if (smpte.subframes == Config->get_subframes_per_frame()) {
+       if (smpte.subframes == config.get_subframes_per_frame()) {
                // This can happen with 24 fps (and 29.97 fps ?)
                smpte_frames_left_exact = ceil( smpte_frames_left_exact );
                smpte.subframes = 0;
@@ -570,7 +561,7 @@ Session::jack_timebase_callback (jack_transport_state_t state,
 }
 
 ARDOUR::nframes_t
-Session::convert_to_frames_at (nframes_t position, AnyTime& any)
+Session::convert_to_frames_at (nframes_t position, AnyTime const & any)
 {
        double secs;