diff --git a/xSchedule/SyncArtNet.cpp b/xSchedule/SyncArtNet.cpp index 7266ddb1f..d00948616 100644 --- a/xSchedule/SyncArtNet.cpp +++ b/xSchedule/SyncArtNet.cpp @@ -103,8 +103,8 @@ class ArtNetTimecodeThread : public wxThread { } }; -SyncArtNet::SyncArtNet(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP) : - SyncBase(sm, rm, options) { +SyncArtNet::SyncArtNet(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP) : + SyncBase(sm, rm, options, schm) { static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base")); _supportsStepMMSSFormat = true; @@ -249,6 +249,9 @@ void SyncArtNet::SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t step break; } + static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base")); + logger_base.debug("ArtnetSync: %02d:%02d:%02d.%02d", buffer[17], buffer[16], buffer[15], buffer[14]); + _artnetSocket->SendTo(_remoteAddr, &buffer[0], buffer.size()); } diff --git a/xSchedule/SyncArtNet.h b/xSchedule/SyncArtNet.h index e029b6575..f631abdbe 100644 --- a/xSchedule/SyncArtNet.h +++ b/xSchedule/SyncArtNet.h @@ -28,7 +28,7 @@ class SyncArtNet : public SyncBase public: - SyncArtNet(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP); + SyncArtNet(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP); SyncArtNet(SyncArtNet&& from) noexcept; virtual ~SyncArtNet(); virtual void SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t stepMS, uint32_t playlistMS, const std::string& fseq, const std::string& media, const std::string& step, const std::string& timeItem, uint32_t stepno, int overridetimeSecs) const override; diff --git a/xSchedule/SyncFPP.cpp b/xSchedule/SyncFPP.cpp index 7ddaed461..927526832 100644 --- a/xSchedule/SyncFPP.cpp +++ b/xSchedule/SyncFPP.cpp @@ -440,8 +440,8 @@ SyncMulticastFPP::~SyncMulticastFPP() } } -SyncBroadcastFPP::SyncBroadcastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP) : - SyncFPP(sm, rm, options) +SyncBroadcastFPP::SyncBroadcastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP) : + SyncFPP(sm, rm, options, schm) { static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base")); @@ -489,8 +489,8 @@ SyncBroadcastFPP::SyncBroadcastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOpt } } -SyncUnicastFPP::SyncUnicastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP) : - SyncFPP(sm, rm, options) +SyncUnicastFPP::SyncUnicastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP) : + SyncFPP(sm, rm, options, schm) { static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base")); @@ -539,8 +539,8 @@ SyncUnicastFPP::SyncUnicastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions } } -SyncUnicastCSVFPP::SyncUnicastCSVFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP) : SyncFPP(sm, rm, options) -{ +SyncUnicastCSVFPP::SyncUnicastCSVFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP) : + SyncFPP(sm, rm, options, schm) { static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base")); if (sm == SYNCMODE::FPPUNICASTCSVMASTER) @@ -588,8 +588,8 @@ SyncUnicastCSVFPP::SyncUnicastCSVFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleO } } -SyncMulticastFPP::SyncMulticastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP) : SyncFPP(sm, rm, options) -{ +SyncMulticastFPP::SyncMulticastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP) : + SyncFPP(sm, rm, options, schm) { static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base")); if (sm == SYNCMODE::FPPMULTICASTMASTER) diff --git a/xSchedule/SyncFPP.h b/xSchedule/SyncFPP.h index bc1213425..c95e99cda 100644 --- a/xSchedule/SyncFPP.h +++ b/xSchedule/SyncFPP.h @@ -22,8 +22,8 @@ class SyncFPP : public SyncBase { public: static void Ping(bool remote, const std::string& localIP); - SyncFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options) : - SyncBase(sm, rm, options) { + SyncFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm) : + SyncBase(sm, rm, options, schm) { } virtual void SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t stepMS, uint32_t playlistMS, const std::string& fseq, const std::string& media, const std::string& step, const std::string& timeItem, uint32_t stepno, int overridetimeSecs) const override; virtual void SendStop() const override; @@ -36,7 +36,7 @@ class SyncBroadcastFPP : public SyncFPP { virtual void SendFPPSync(const std::string& item, uint32_t stepMS, uint32_t frameMS) const override; public: - SyncBroadcastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP); + SyncBroadcastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP); SyncBroadcastFPP(SyncBroadcastFPP&& from) noexcept; virtual ~SyncBroadcastFPP(); virtual std::string GetType() const override { @@ -52,7 +52,7 @@ class SyncUnicastFPP : public SyncFPP { virtual void SendFPPSync(const std::string& item, uint32_t stepMS, uint32_t frameMS) const override; public: - SyncUnicastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP); + SyncUnicastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP); SyncUnicastFPP(SyncUnicastFPP&& from) noexcept; virtual ~SyncUnicastFPP(); virtual std::string GetType() const override { @@ -68,7 +68,7 @@ class SyncUnicastCSVFPP : public SyncFPP { virtual void SendFPPSync(const std::string& item, uint32_t stepMS, uint32_t frameMS) const override; public: - SyncUnicastCSVFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP); + SyncUnicastCSVFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP); SyncUnicastCSVFPP(SyncUnicastCSVFPP&& from) noexcept; virtual ~SyncUnicastCSVFPP(); virtual std::string GetType() const override { @@ -83,7 +83,7 @@ class SyncMulticastFPP : public SyncFPP { virtual void SendFPPSync(const std::string& item, uint32_t stepMS, uint32_t frameMS) const override; public: - SyncMulticastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP); + SyncMulticastFPP(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP); SyncMulticastFPP(SyncMulticastFPP&& from) noexcept; virtual ~SyncMulticastFPP(); virtual std::string GetType() const override { diff --git a/xSchedule/SyncMIDI.cpp b/xSchedule/SyncMIDI.cpp index 9ed6cbbb6..57603fe57 100644 --- a/xSchedule/SyncMIDI.cpp +++ b/xSchedule/SyncMIDI.cpp @@ -178,8 +178,8 @@ class MIDIClockThread : public wxThread { }; #endif -SyncMIDI::SyncMIDI(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager) : - SyncBase(sm, rm, options) { +SyncMIDI::SyncMIDI(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager) : + SyncBase(sm, rm, options, schm) { static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base")); _supportsStepMMSSFormat = true; diff --git a/xSchedule/SyncMIDI.h b/xSchedule/SyncMIDI.h index 95674fd14..2225e841f 100644 --- a/xSchedule/SyncMIDI.h +++ b/xSchedule/SyncMIDI.h @@ -41,7 +41,7 @@ class SyncMIDI : public SyncBase public: - SyncMIDI(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager); + SyncMIDI(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager); SyncMIDI(SyncMIDI&& from); virtual ~SyncMIDI(); virtual void SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t stepMS, uint32_t playlistMS, const std::string& fseq, const std::string& media, const std::string& step, const std::string& timeItem, uint32_t stepno, int overridetimeSecs) const override; diff --git a/xSchedule/SyncManager.cpp b/xSchedule/SyncManager.cpp index bc97eedd0..fd3f019d7 100644 --- a/xSchedule/SyncManager.cpp +++ b/xSchedule/SyncManager.cpp @@ -25,24 +25,24 @@ std::unique_ptr SyncManager::CreateSync(SYNCMODE sm, REMOTEMODE rm) const { wxASSERT(_scheduleManager != nullptr); if (sm == SYNCMODE::OSCMASTER || rm == REMOTEMODE::OSCSLAVE) { - return std::make_unique(SyncOSC(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncOSC(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (sm == SYNCMODE::ARTNETMASTER || rm == REMOTEMODE::ARTNETSLAVE) { - return std::make_unique(SyncArtNet(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncArtNet(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (sm == SYNCMODE::FPPBROADCASTMASTER) { - return std::make_unique(SyncBroadcastFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncBroadcastFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (sm == SYNCMODE::FPPUNICASTMASTER) { - return std::make_unique(SyncUnicastFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncUnicastFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (sm == SYNCMODE::FPPUNICASTCSVMASTER || rm == REMOTEMODE::FPPCSVSLAVE) { - return std::make_unique(SyncUnicastCSVFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncUnicastCSVFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (sm == SYNCMODE::FPPMULTICASTMASTER) { - return std::make_unique(SyncMulticastFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncMulticastFPP(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (rm == REMOTEMODE::FPPSLAVE || rm == REMOTEMODE::FPPBROADCASTSLAVE || rm == REMOTEMODE::FPPUNICASTSLAVE) { // really doesnt matter which FPP I create - return std::make_unique(SyncMulticastFPP(sm, REMOTEMODE::FPPSLAVE, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); + return std::make_unique(SyncMulticastFPP(sm, REMOTEMODE::FPPSLAVE, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager(), _scheduleManager->GetForceLocalIP())); } else if (sm == SYNCMODE::MIDIMASTER || rm == REMOTEMODE::MIDISLAVE) { - return std::make_unique(SyncMIDI(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager())); + return std::make_unique(SyncMIDI(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager())); } else if (rm == REMOTEMODE::SMPTESLAVE) { - return std::make_unique(SyncSMPTE(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager->GetListenerManager())); + return std::make_unique(SyncSMPTE(sm, rm, *_scheduleManager->GetOptions(), _scheduleManager, _scheduleManager->GetListenerManager())); } else if (rm == REMOTEMODE::DISABLED) { return nullptr; } else { @@ -205,7 +205,21 @@ void SyncManager::SendStop() const { } } -SyncBase::SyncBase(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options) : - _mode(mode), _remoteMode(remoteMode) { - _useStepMMSSFormat = options.IsUseStepMMSSTimecodeFormat(); +void SyncManager::ReloadOptions() const { + for (auto& it : _masters) { + it->ReloadOptions(); + } + if (_remote != nullptr) { + _remote->ReloadOptions(); + } +} + +SyncBase::SyncBase(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options, ScheduleManager* sm) : + _mode(mode), _remoteMode(remoteMode), _scheduleManager(sm) { + ReloadOptions(); +} + +void SyncBase::ReloadOptions() +{ + _useStepMMSSFormat = _scheduleManager->GetOptions()->IsUseStepMMSSTimecodeFormat(); } diff --git a/xSchedule/SyncManager.h b/xSchedule/SyncManager.h index 7fe01f337..c5c32a5ff 100644 --- a/xSchedule/SyncManager.h +++ b/xSchedule/SyncManager.h @@ -57,6 +57,7 @@ class SyncBase { SYNCMODE _mode = SYNCMODE::STANDALONE; REMOTEMODE _remoteMode = REMOTEMODE::DISABLED; bool _useStepMMSSFormat = false; + ScheduleManager* _scheduleManager = nullptr; uint32_t GetHours(uint32_t ms, uint32_t step, int overrideBaseTime) const { if (overrideBaseTime < 0 && _useStepMMSSFormat && _supportsStepMMSSFormat) { @@ -72,7 +73,7 @@ class SyncBase { } public: - SyncBase(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options); + SyncBase(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options, ScheduleManager* sm); virtual ~SyncBase() { } virtual void SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t stepMS, uint32_t playlistMS, const std::string& fseq, const std::string& media, const std::string& step, const std::string& timeItem, uint32_t stepno, int overridetimeSecs) const = 0; @@ -93,6 +94,7 @@ class SyncBase { virtual bool IsReactive() const { return true; } + void ReloadOptions(); }; class SyncManager { @@ -124,4 +126,5 @@ class SyncManager { bool IsFPPRemoteOrMaster() const; bool IsMaster(SYNCMODE mode) const; void SendStop() const; + void ReloadOptions() const; }; diff --git a/xSchedule/SyncOSC.cpp b/xSchedule/SyncOSC.cpp index 9eb808c07..5c834de6d 100644 --- a/xSchedule/SyncOSC.cpp +++ b/xSchedule/SyncOSC.cpp @@ -19,8 +19,8 @@ #include "../xLights/UtilFunctions.h" #include -SyncOSC::SyncOSC(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP) : - SyncBase(mode, remoteMode, options) { +SyncOSC::SyncOSC(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP) : + SyncBase(mode, remoteMode, options, schm) { static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base")); if (mode == SYNCMODE::OSCMASTER) { diff --git a/xSchedule/SyncOSC.h b/xSchedule/SyncOSC.h index 9540bf3c8..2e386c37f 100644 --- a/xSchedule/SyncOSC.h +++ b/xSchedule/SyncOSC.h @@ -31,7 +31,7 @@ class SyncOSC : public SyncBase public: - SyncOSC(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options, ListenerManager* listenerManager, const std::string& localIP); + SyncOSC(SYNCMODE mode, REMOTEMODE remoteMode, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager, const std::string& localIP); SyncOSC(SyncOSC&& from); virtual ~SyncOSC(); virtual void SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t stepMS, uint32_t playlistMS, const std::string& fseq, const std::string& media, const std::string& step, const std::string& timeItem, uint32_t stepno, int overridetimeSecs) const override; diff --git a/xSchedule/SyncSMPTE.cpp b/xSchedule/SyncSMPTE.cpp index 0feb046f6..d7b537faf 100644 --- a/xSchedule/SyncSMPTE.cpp +++ b/xSchedule/SyncSMPTE.cpp @@ -15,7 +15,7 @@ #include #include "../xLights/UtilFunctions.h" -SyncSMPTE::SyncSMPTE(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager) : SyncBase(sm, rm, options) +SyncSMPTE::SyncSMPTE(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager) : SyncBase(sm, rm, options, schm) { static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base")); diff --git a/xSchedule/SyncSMPTE.h b/xSchedule/SyncSMPTE.h index 589e25807..65bc7f3f8 100644 --- a/xSchedule/SyncSMPTE.h +++ b/xSchedule/SyncSMPTE.h @@ -22,7 +22,7 @@ class SyncSMPTE : public SyncBase public: - SyncSMPTE(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ListenerManager* listenerManager); + SyncSMPTE(SYNCMODE sm, REMOTEMODE rm, const ScheduleOptions& options, ScheduleManager* schm, ListenerManager* listenerManager); SyncSMPTE(SyncSMPTE&& from); virtual ~SyncSMPTE(); virtual void SendSync(uint32_t frameMS, uint32_t stepLengthMS, uint32_t stepMS, uint32_t playlistMS, const std::string& fseq, const std::string& media, const std::string& step, const std::string& timeItem, uint32_t stepno, int overridetimeSecs) const override; diff --git a/xSchedule/xScheduleMain.cpp b/xSchedule/xScheduleMain.cpp index c2b4480f5..a174e3085 100644 --- a/xSchedule/xScheduleMain.cpp +++ b/xSchedule/xScheduleMain.cpp @@ -1768,6 +1768,8 @@ void xScheduleFrame::OnMenuItem_OptionsSelected(wxCommandEvent& event) c->TempDisable(false); } + __schedule->GetSyncManager()->ReloadOptions(); + Schedule::SetCity(__schedule->GetOptions()->GetCity()); __schedule->GetOutputManager()->SetParallelTransmission(__schedule->GetOptions()->IsParallelTransmission()); OutputManager::SetRetryOpen(__schedule->GetOptions()->IsRetryOpen());