convert codebase to use Temporal for various time types
[ardour.git] / libs / ardour / disk_writer.cc
index 429eb1e7c9c5d64d964c121a2512e7e61db43eb0..b5dade0dc11f6c376aa900bfb51c35bda74cb7ca 100644 (file)
@@ -17,8 +17,6 @@
 
 */
 
-#include "pbd/i18n.h"
-
 #include "ardour/analyser.h"
 #include "ardour/audioengine.h"
 #include "ardour/audiofilesource.h"
@@ -36,6 +34,8 @@
 #include "ardour/session.h"
 #include "ardour/smf_source.h"
 
+#include "pbd/i18n.h"
+
 using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
@@ -48,15 +48,14 @@ DiskWriter::DiskWriter (Session& s, string const & str, DiskIOProcessor::Flag f)
        , _record_enabled (0)
        , _record_safe (0)
        , capture_start_sample (0)
-        , capture_captured (0)
-        , was_recording (false)
-        , adjust_capture_position (0)
-        , _capture_offset (0)
-        , first_recordable_sample (max_samplepos)
-        , last_recordable_sample (max_samplepos)
-        , last_possibly_recording (0)
-        , _alignment_style (ExistingMaterial)
-        , _alignment_choice (Automatic)
+       , capture_captured (0)
+       , was_recording (false)
+       , adjust_capture_position (0)
+       , _capture_offset (0)
+       , first_recordable_sample (max_samplepos)
+       , last_recordable_sample (max_samplepos)
+       , last_possibly_recording (0)
+       , _alignment_style (ExistingMaterial)
        , _num_captured_loops (0)
        , _accumulated_capture_offset (0)
        , _gui_feed_buffer(AudioEngine::instance()->raw_buffer_size (DataType::MIDI))
@@ -333,36 +332,11 @@ DiskWriter::set_align_style (AlignStyle a, bool force)
        }
 }
 
-void
-DiskWriter::set_align_choice (AlignChoice a, bool force)
-{
-       if (record_enabled() && _session.actively_recording()) {
-               return;
-       }
-
-       if ((a != _alignment_choice) || force) {
-               _alignment_choice = a;
-
-               switch (_alignment_choice) {
-               case UseExistingMaterial:
-                       set_align_style (ExistingMaterial);
-                       break;
-               case UseCaptureTime:
-                       set_align_style (CaptureTime);
-                       break;
-               default:
-                       error << string_compose (_("programming error: %1"), "DiskWriter: asked to use illegal alignment style") << endmsg;
-                       break;
-               }
-       }
-}
-
 XMLNode&
 DiskWriter::state (bool full)
 {
        XMLNode& node (DiskIOProcessor::state (full));
        node.set_property (X_("type"), X_("diskwriter"));
-       node.set_property (X_("capture-alignment"), enum_2_string (_alignment_choice));
        node.set_property (X_("record-safe"), (_record_safe ? X_("yes" : "no")));
        return node;
 }
@@ -374,14 +348,6 @@ DiskWriter::set_state (const XMLNode& node, int version)
                return -1;
        }
 
-       AlignChoice ac;
-
-       if (node.get_property (X_("capture-alignment"), ac)) {
-               set_align_choice (ac, true);
-        } else {
-                set_align_choice (Automatic, true);
-        }
-
        if (!node.get_property (X_("record-safe"), _record_safe)) {
                _record_safe = false;
        }
@@ -1299,14 +1265,14 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo
                /* set length in beats to entire capture length */
 
                BeatsSamplesConverter converter (_session.tempo_map(), capture_info.front()->start);
-               const Evoral::Beats total_capture_beats = converter.from (total_capture);
+               const Temporal::Beats total_capture_beats = converter.from (total_capture);
                _midi_write_source->set_length_beats (total_capture_beats);
 
                /* flush to disk: this step differs from the audio path,
                   where all the data is already on disk.
                */
 
-               _midi_write_source->mark_midi_streaming_write_completed (source_lock, Evoral::Sequence<Evoral::Beats>::ResolveStuckNotes, total_capture_beats);
+               _midi_write_source->mark_midi_streaming_write_completed (source_lock, Evoral::Sequence<Temporal::Beats>::ResolveStuckNotes, total_capture_beats);
        }
 
        _last_capture_sources.insert (_last_capture_sources.end(), audio_srcs.begin(), audio_srcs.end());