move away from "sync source" concepts

This commit is contained in:
Paul Davis
2018-10-05 12:35:10 -04:00
parent 1b71e4db2c
commit 4c7e5dbc74
11 changed files with 66 additions and 68 deletions

View File

@@ -74,8 +74,6 @@ CONFIG_VARIABLE (int, mtc_qf_speed_tolerance, "mtc-qf-speed-tolerance", 5)
CONFIG_VARIABLE (bool, timecode_sync_frame_rate, "timecode-sync-frame-rate", true)
#ifdef USE_TRACKS_CODE_FEATURES
CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", MTC)
#else
CONFIG_VARIABLE (SyncSource, sync_source, "sync-source", Engine)
#endif
CONFIG_VARIABLE (bool, send_ltc, "send-ltc", false)
CONFIG_VARIABLE (bool, ltc_send_continuously, "ltc-send-continuously", true)

View File

@@ -718,7 +718,7 @@ public:
static PBD::Signal1<void, samplepos_t> EndTimeChanged;
void request_sync_source (boost::shared_ptr<TransportMaster>);
bool synced_to_engine() const { return config.get_external_sync() && Config->get_sync_source() == Engine; }
bool synced_to_engine() const;
double engine_speed() const { return _engine_speed; }
double actual_speed() const {

View File

@@ -344,6 +344,8 @@ class LIBARDOUR_API TransportMaster : public PBD::Stateful {
bool removeable () const { return _removeable; }
void set_removeable (bool yn) { _removeable = yn; }
std::string display_name (bool sh/*ort*/ = true) const;
protected:
SyncSource _type;
PBD::Property<std::string> _name;

View File

@@ -75,9 +75,6 @@ LIBARDOUR_API bool path_is_paired (std::string path, std::string& pair_base);
LIBARDOUR_API void compute_equal_power_fades (ARDOUR::samplecnt_t nframes, float* in, float* out);
LIBARDOUR_API const char* sync_source_to_string (ARDOUR::SyncSource src, bool sh = false);
LIBARDOUR_API ARDOUR::SyncSource string_to_sync_source (std::string str);
LIBARDOUR_API const char* edit_mode_to_string (ARDOUR::EditMode);
LIBARDOUR_API ARDOUR::EditMode string_to_edit_mode (std::string);

View File

@@ -26,6 +26,7 @@
#include "ardour/io.h"
#include "ardour/session.h"
#include "ardour/transport_master.h"
#include "ardour/transport_master_manager.h"
#include "pbd/i18n.h"
@@ -183,7 +184,7 @@ Session::ltc_tx_send_time_code_for_cycle (samplepos_t start_sample, samplepos_t
return;
}
SyncSource sync_src = Config->get_sync_source();
SyncSource sync_src = TransportMasterManager::instance().current()->type();
if (engine().freewheeling() || !Config->get_send_ltc()
/* TODO
* decide which time-sources we can generated LTC from.

View File

@@ -4098,7 +4098,7 @@ Session::config_changed (std::string p, bool ours)
first_file_data_format_reset = false;
} else if (p == "external-sync") {
request_sync_source (TransportMasterManager::instance().master_by_type (Config->get_sync_source()));
request_sync_source (TransportMasterManager::instance().current());
} else if (p == "denormal-model") {
setup_fpu ();
} else if (p == "history-depth") {

View File

@@ -92,6 +92,11 @@ Session::should_ignore_transport_request (TransportRequestSource src, TransportR
return false;
}
bool
Session::synced_to_engine() const {
return config.get_external_sync() && TransportMasterManager::instance().current()->type() == Engine;
}
void
Session::request_sync_source (boost::shared_ptr<TransportMaster> tm)
{

View File

@@ -364,13 +364,13 @@ TransportMaster::factory (SyncSource type, std::string const& name, bool removea
switch (type) {
case MTC:
tm.reset (new MTC_TransportMaster (sync_source_to_string (type)));
tm.reset (new MTC_TransportMaster (name));
break;
case LTC:
tm.reset (new LTC_TransportMaster (sync_source_to_string (type)));
tm.reset (new LTC_TransportMaster (name));
break;
case MIDIClock:
tm.reset (new MIDIClock_TransportMaster (sync_source_to_string (type)));
tm.reset (new MIDIClock_TransportMaster (name));
break;
case Engine:
tm.reset (new Engine_TransportMaster (*AudioEngine::instance()));
@@ -386,6 +386,52 @@ TransportMaster::factory (SyncSource type, std::string const& name, bool removea
return tm;
}
/** @param sh Return a short version of the string */
std::string
TransportMaster::display_name (bool sh) const
{
switch (_type) {
case Engine:
/* no other backends offer sync for now ... deal with this if we
* ever have to.
*/
return S_("SyncSource|JACK");
case MTC:
if (sh) {
if (name().length() <= 4) {
return name();
}
return S_("SyncSource|MTC");
} else {
return name();
}
case MIDIClock:
if (sh) {
if (name().length() <= 4) {
return name();
}
return S_("SyncSource|M-Clk");
} else {
return name();
}
case LTC:
if (sh) {
if (name().length() <= 4) {
return name();
}
return S_("SyncSource|LTC");
} else {
return name();
}
}
/* GRRRR .... stupid, stupid gcc - you can't get here from there, all enum values are handled */
return S_("SyncSource|JACK");
}
boost::shared_ptr<Port>
TransportMasterViaMIDI::create_midi_port (std::string const & port_name)
{
@@ -437,3 +483,4 @@ TimecodeTransportMaster::set_fr2997 (bool yn)
PropertyChanged (Properties::fr2997);
}
}

View File

@@ -340,6 +340,10 @@ TransportMasterManager::add_locked (boost::shared_ptr<TransportMaster> tm)
}
}
if (_session) {
tm->set_session (_session);
}
_transport_masters.push_back (tm);
return 0;
}

View File

@@ -444,62 +444,6 @@ ARDOUR::edit_mode_to_string (EditMode mode)
}
}
SyncSource
ARDOUR::string_to_sync_source (string str)
{
if (str == _("MIDI Timecode") || str == _("MTC")) {
return MTC;
}
if (str == _("MIDI Clock")) {
return MIDIClock;
}
if (str == _("JACK")) {
return Engine;
}
if (str == _("LTC")) {
return LTC;
}
fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg;
abort(); /*NOTREACHED*/
return Engine;
}
/** @param sh Return a short version of the string */
const char*
ARDOUR::sync_source_to_string (SyncSource src, bool sh)
{
switch (src) {
case Engine:
/* no other backends offer sync for now ... deal with this if we
* ever have to.
*/
return S_("SyncSource|JACK");
case MTC:
if (sh) {
return S_("SyncSource|MTC");
} else {
return _("MIDI Timecode");
}
case MIDIClock:
if (sh) {
return S_("SyncSource|M-Clk");
} else {
return _("MIDI Clock");
}
case LTC:
return S_("SyncSource|LTC");
}
/* GRRRR .... stupid, stupid gcc - you can't get here from there, all enum values are handled */
return S_("SyncSource|JACK");
}
float
ARDOUR::meter_falloff_to_float (MeterFalloff falloff)
{

View File

@@ -210,7 +210,7 @@ BasicUI::transport_play (bool from_last_start)
#if 0
if (session->config.get_external_sync()) {
switch (Config->get_sync_source()) {
switch (TransportMasterManager::instance().current().type()) {
case Engine:
break;
default: