diff options
author | Robin Gareus <robin@gareus.org> | 2020-05-13 16:08:48 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-05-13 17:39:06 +0200 |
commit | 7289be59c984192d269e63d081809ef835d7b477 (patch) | |
tree | 785a0397fe888ca1cf897c92e4442c4d1ea36408 /libs/ardour/ardour | |
parent | 5120b650c5ec6cb25099976e5476934cb969d7cf (diff) |
Set timecode format from active master only
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/transport_master.h | 38 | ||||
-rw-r--r-- | libs/ardour/ardour/transport_master_manager.h | 26 |
2 files changed, 33 insertions, 31 deletions
diff --git a/libs/ardour/ardour/transport_master.h b/libs/ardour/ardour/transport_master.h index 02f728e483..ee311d290b 100644 --- a/libs/ardour/ardour/transport_master.h +++ b/libs/ardour/ardour/transport_master.h @@ -474,8 +474,10 @@ public: TimecodeTransportMaster (std::string const& name, SyncSource type); virtual Timecode::TimecodeFormat apparent_timecode_format () const = 0; - samplepos_t timecode_offset; - bool timecode_negative_offset; + + bool apparent_timecode_format_valid () const { + return timecode_format_valid; + } bool fr2997 () const { @@ -486,6 +488,10 @@ public: protected: void register_properties (); + samplepos_t timecode_offset; + bool timecode_negative_offset; + bool timecode_format_valid; + private: PBD::Property<bool> _fr2997; }; @@ -536,8 +542,7 @@ private: samplepos_t window_begin; samplepos_t window_end; samplepos_t first_mtc_timestamp; - bool did_reset_tc_format; - Timecode::TimecodeFormat saved_tc_format; + Glib::Threads::Mutex reset_lock; uint32_t reset_pending; bool reset_position; @@ -545,12 +550,9 @@ private: int busy_guard1; int busy_guard2; - double speedup_due_to_tc_mismatch; double quarter_frame_duration; Timecode::TimecodeFormat mtc_timecode; - Timecode::TimecodeFormat a3e_timecode; Timecode::Time timecode; - bool printed_timecode_warning; void queue_reset (bool with_pos); void maybe_reset (); @@ -616,26 +618,20 @@ private: void parameter_changed (std::string const& p); void connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string, boost::weak_ptr<ARDOUR::Port>, std::string, bool); - bool did_reset_tc_format; - Timecode::TimecodeFormat saved_tc_format; - LTCDecoder* decoder; double samples_per_ltc_frame; Timecode::Time timecode; LTCFrameExt prev_frame; bool fps_detected; - samplecnt_t monotonic_cnt; - uint64_t frames_since_reset; - int delayedlocked; - - int ltc_detect_fps_cnt; - int ltc_detect_fps_max; - bool printed_timecode_warning; - bool sync_lock_broken; - Timecode::TimecodeFormat ltc_timecode; - Timecode::TimecodeFormat a3e_timecode; - double samples_per_timecode_frame; + samplecnt_t monotonic_cnt; + uint64_t frames_since_reset; + int delayedlocked; + + int ltc_detect_fps_cnt; + int ltc_detect_fps_max; + bool sync_lock_broken; + double samples_per_timecode_frame; PBD::ScopedConnection port_connection; PBD::ScopedConnectionList session_connections; diff --git a/libs/ardour/ardour/transport_master_manager.h b/libs/ardour/ardour/transport_master_manager.h index 0aaf1bf00c..6035a18b8b 100644 --- a/libs/ardour/ardour/transport_master_manager.h +++ b/libs/ardour/ardour/transport_master_manager.h @@ -96,26 +96,32 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable mutable Glib::Threads::RWLock lock; double _master_speed; samplepos_t _master_position; - boost::shared_ptr<TransportMaster> _current_master; + + boost::shared_ptr<TransportMaster> _current_master; Session* _session; bool _master_invalid_this_cycle; bool disk_output_blocked; - // a DLL to chase the transport master - - int transport_dll_initstate; - double t0; /// time at the beginning of ??? - double t1; /// calculated end of the ??? - double e2; /// second order loop error - double bandwidth; /// DLL filter bandwidth - double b, c, omega; /// DLL filter coefficients + /* a DLL to chase the transport master, calculate playback speed + * by matching Ardour's current playhead position against + * the position of the transport-master */ + double t0; // PH position at the beginning of this cycle + double t1; // expected PH position if next cycle + double e2; // second order loop error + double bandwidth; // DLL filter bandwidth + double b, c, omega; // DLL filter coefficients void init_transport_master_dll (double speed, samplepos_t pos); - int master_dll_initstate; + int master_dll_initstate; // play-direction -1, +1, or 0: not initialized static TransportMasterManager* _instance; + /* original TC format in case the slave changed it */ + boost::optional<Timecode::TimecodeFormat> _session_tc_format; + void maybe_restore_tc_format (); + void maybe_set_tc_format (); + int add_locked (boost::shared_ptr<TransportMaster>); double compute_matching_master_speed (pframes_t nframes, samplepos_t, bool& locate_required); int set_current_locked (boost::shared_ptr<TransportMaster>); |