/* Timecode status signals */
PBD::Signal1<void, bool> MTCSyncStateChanged;
-
+ PBD::Signal1<void, bool> LTCSyncStateChanged;
+
/* Record status signals */
PBD::Signal0<void> RecordStateChanged; /* signals changes in recording state (i.e. are we recording) */
void request_sync_source (Slave*);
bool synced_to_engine() const { return _slave && config.get_external_sync() && Config->get_sync_source() == Engine; }
bool synced_to_mtc () const { return config.get_external_sync() && Config->get_sync_source() == MTC && g_atomic_int_get (const_cast<gint*>(&_mtc_active)); }
+ bool synced_to_ltc () const { return config.get_external_sync() && Config->get_sync_source() == LTC && g_atomic_int_get (const_cast<gint*>(&_ltc_active)); }
double transport_speed() const { return _transport_speed; }
bool transport_stopped() const { return _transport_speed == 0.0f; }
void reconnect_mtc_ports ();
void reconnect_mmc_ports (bool);
+ void reconnect_ltc_input ();
+ void reconnect_ltc_output ();
+
protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);
void mtc_status_changed (bool);
PBD::ScopedConnection mtc_status_connection;
+ void ltc_status_changed (bool);
+ PBD::ScopedConnection ltc_status_connection;
void initialize_latencies ();
void set_worst_io_latencies ();
SlaveState _slave_state;
gint _mtc_active;
+ gint _ltc_active;
framepos_t slave_wait_end;
void reset_slave_state ();
boost::shared_ptr<IO> _ltc_input;
boost::shared_ptr<IO> _ltc_output;
- void reconnect_ltc_input ();
- void reconnect_ltc_output ();
-
/* Scene Changing */
SceneChanger* _scene_changer;
class LIBARDOUR_API TimecodeSlave : public Slave {
public:
- TimecodeSlave () {}
-
- virtual Timecode::TimecodeFormat apparent_timecode_format() const = 0;
-
- /* this is intended to be used by a UI and polled from a timeout. it should
- return a string describing the current position of the TC source. it
- should NOT do any computation, but should use a cached value
- of the TC source position.
- */
- virtual std::string approximate_current_position() const = 0;
-
- framepos_t timecode_offset;
- bool timecode_negative_offset;
+ TimecodeSlave () {}
+
+ virtual Timecode::TimecodeFormat apparent_timecode_format() const = 0;
+
+ /* this is intended to be used by a UI and polled from a timeout. it should
+ return a string describing the current position of the TC source. it
+ should NOT do any computation, but should use a cached value
+ of the TC source position.
+ */
+ virtual std::string approximate_current_position() const = 0;
+
+ framepos_t timecode_offset;
+ bool timecode_negative_offset;
+
+ PBD::Signal1<void, bool> ActiveChanged;
};
class LIBARDOUR_API MTC_Slave : public TimecodeSlave {
std::string approximate_current_position() const;
std::string approximate_current_delta() const;
- PBD::Signal1<void, bool> ActiveChanged;
-
private:
Session& session;
MidiPort* port;
#include "pbd/pthread_utils.h"
#include "ardour/debug.h"
+#include "ardour/profile.h"
#include "ardour/slave.h"
#include "ardour/session.h"
#include "ardour/audioengine.h"
ltc_speed = 0;
engine_dll_initstate = 0;
sync_lock_broken = false;
+
+ ActiveChanged (false); /* EMIT SIGNAL */
}
void
if (last_timestamp == 0) {
engine_dll_initstate = 0;
if (delayedlocked < 10) ++delayedlocked;
- }
- else if (engine_dll_initstate != transport_direction && ltc_speed != 0) {
+ } else if (engine_dll_initstate != transport_direction && ltc_speed != 0) {
+
+ ActiveChanged (true); /* EMIT SIGNAL */
+
engine_dll_initstate = transport_direction;
init_engine_dll(last_ltc_frame + rint(ltc_speed * double(2 * nframes + now - last_timestamp)),
session.engine().samples_per_cycle());
reset();
speed = 0;
pos = session.transport_frame();
+ ActiveChanged (false); /* EMIT SIGNAL */
return true;
}
, average_dir (0)
, have_first_delta_accumulator (false)
, _slave_state (Stopped)
- , _mtc_active (false)
+ , _mtc_active (false)
+ , _ltc_active (false)
, post_export_sync (false)
, post_export_position (0)
, _exporting (false)
if (src != _("None") && !src.empty()) {
_ltc_input->nth (0)->connect (src);
}
+
+ if ( ARDOUR::Profile->get_trx () ) {
+ // Tracks need this signal to update timecode_source_dropdown
+ MtcOrLtcInputPortChanged (); //emit signal
+ }
}
}
{
if (_ltc_output) {
-#if 0
- string src = Config->get_ltc_sink_port();
+ string src = Config->get_ltc_output_port();
_ltc_output->disconnect (this);
if (src != _("None") && !src.empty()) {
_ltc_output->nth (0)->connect (src);
}
-#endif
}
}
MTCSyncStateChanged( yn );
}
+void
+Session::ltc_status_changed (bool yn)
+{
+ g_atomic_int_set (&_ltc_active, yn);
+ LTCSyncStateChanged( yn );
+}
+
void
Session::use_sync_source (Slave* new_slave)
{
mtc_status_connection.disconnect ();
}
+ LTC_Slave* ltc_slave = dynamic_cast<LTC_Slave*> (_slave);
+ if (ltc_slave) {
+ ltc_slave->ActiveChanged.connect_same_thread (ltc_status_connection, boost::bind (&Session::ltc_status_changed, this, _1));
+ LTCSyncStateChanged (ltc_slave->locked() );
+ } else {
+ if (g_atomic_int_get (&_ltc_active) ){
+ g_atomic_int_set (&_ltc_active, 0);
+ LTCSyncStateChanged( false );
+ }
+ ltc_status_connection.disconnect ();
+ }
+
DEBUG_TRACE (DEBUG::Slave, string_compose ("set new slave to %1\n", _slave));
// need to queue this for next process() cycle
return Engine;
}
+ if (str == _("LTC")) {
+ return LTC;
+ }
+
fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
abort(); /*NOTREACHED*/
return Engine;