diff --git a/src/musikcore/c_context.cpp b/src/musikcore/c_context.cpp index 6b81712e2..7dd355601 100644 --- a/src/musikcore/c_context.cpp +++ b/src/musikcore/c_context.cpp @@ -178,6 +178,8 @@ mcsdk_export void mcsdk_context_init(mcsdk_context** context) { mcsdk_env_init(); } + plugin::Init(); + auto c = new mcsdk_context(); memset(c, 0, sizeof(mcsdk_context)); @@ -253,7 +255,7 @@ mcsdk_export void mcsdk_set_plugin_context(mcsdk_context* context) { plugin_context = context; if (plugin_context) { auto internal = static_cast(context->internal.opaque); - plugin::Init(message_queue, internal->playback, internal->library); + plugin::Start(message_queue, internal->playback, internal->library); } } diff --git a/src/musikcore/plugin/Plugins.cpp b/src/musikcore/plugin/Plugins.cpp index ad13948f0..8f8375967 100644 --- a/src/musikcore/plugin/Plugins.cpp +++ b/src/musikcore/plugin/Plugins.cpp @@ -361,7 +361,7 @@ static class Environment: public IEnvironment { namespace musik { namespace core { namespace plugin { - void Init(IMessageQueue* messageQueue, IPlaybackService* playbackService, ILibraryPtr library) { + void Init() { /* preferences */ Preferences::LoadPluginPreferences(); @@ -371,7 +371,9 @@ namespace musik { namespace core { namespace plugin { [](musik::core::sdk::IPlugin* plugin, SetDebug func) { func(&debugger); }); + } + void Start(IMessageQueue* messageQueue, IPlaybackService* playbackService, ILibraryPtr library) { /* metadata proxies */ delete metadataProxy; ::messageQueue = messageQueue; diff --git a/src/musikcore/plugin/Plugins.h b/src/musikcore/plugin/Plugins.h index 4e1d1b89a..84c48ad8a 100644 --- a/src/musikcore/plugin/Plugins.h +++ b/src/musikcore/plugin/Plugins.h @@ -41,7 +41,9 @@ namespace musik { namespace core { namespace plugin { - void Init( + void Init(); + + void Start( musik::core::runtime::IMessageQueue* messageQueue, musik::core::sdk::IPlaybackService* playback, musik::core::ILibraryPtr library); diff --git a/src/musikcube/Main.cpp b/src/musikcube/Main.cpp index e90a48aec..4c377c14f 100644 --- a/src/musikcube/Main.cpp +++ b/src/musikcube/Main.cpp @@ -100,37 +100,37 @@ int main(int argc, char* argv[]) { boost::filesystem::path::imbue(utf8Locale); /* ensure we have the correct locale loaded */ - musik::core::i18n::Locale::Instance().Initialize(musik::core::GetApplicationDirectory() + "/locales/"); + core::i18n::Locale::Instance().Initialize(core::GetApplicationDirectory() + "/locales/"); #ifdef WIN32 - AddDllDirectory(u8to16(musik::core::GetPluginDirectory()).c_str()); + AddDllDirectory(u8to16(core::GetPluginDirectory()).c_str()); #ifdef __PDCURSES__ PDC_set_resize_limits(MIN_HEIGHT, 1000, MIN_WIDTH, 1000); resize_term(26, 100); /* must be before app init */ #endif #endif - std::string errorFn = musik::core::GetDataDirectory() + "stderr.txt"; + std::string errorFn = core::GetDataDirectory() + "stderr.txt"; freopen(errorFn.c_str(), "w", stderr); - auto fileLogger = new musik::debug::SimpleFileBackend(); + auto fileLogger = new debug::SimpleFileBackend(); auto consoleLogger = new ConsoleLogger(Window::MessageQueue()); - musik::debug::Start({ fileLogger, consoleLogger }); + debug::Start({ fileLogger, consoleLogger }); + + plugin::Init(); LibraryFactory::Initialize(Window::MessageQueue()); - auto library = std::make_shared(); + auto library = std::make_shared(); { - auto prefs = Preferences::ForComponent( - musik::core::prefs::components::Settings); + auto prefs = Preferences::ForComponent(core::prefs::components::Settings); PlaybackService playback(Window::MessageQueue(), library); GlobalHotkeys globalHotkeys(playback, library); Window::SetNavigationKeys(Hotkeys::NavigationKeys()); - musik::core::plugin::Init( - &Window::MessageQueue(), &playback, library); + plugin::Start(&Window::MessageQueue(), &playback, library); #ifdef WIN32 auto font = GetApplicationDirectory() + "fonts/SourceCodePro-Medium.ttf"; @@ -150,7 +150,7 @@ int main(int argc, char* argv[]) { app.SetQuitKey(prefs->GetString(keys::AppQuitKey, "^D")); /* fire up the indexer if configured to run on startup */ - if (prefs->GetBool(musik::core::prefs::keys::SyncOnStartup, true)) { + if (prefs->GetBool(core::prefs::keys::SyncOnStartup, true)) { library->Indexer()->Schedule(IIndexer::SyncType::All); } @@ -214,12 +214,12 @@ int main(int argc, char* argv[]) { library->Indexer()->Stop(); } - musik::core::audio::vis::HideSelectedVisualizer(); - musik::core::plugin::Deinit(); + audio::vis::HideSelectedVisualizer(); + plugin::Deinit(); LibraryFactory::Instance().Shutdown(); - musik::debug::Stop(); + debug::Stop(); return 0; } diff --git a/src/musikcubed/main.cpp b/src/musikcubed/main.cpp index 010f5e07e..da4bf0c7e 100644 --- a/src/musikcubed/main.cpp +++ b/src/musikcubed/main.cpp @@ -282,6 +282,8 @@ int main(int argc, char** argv) { srand((unsigned int) time(0)); + plugin::Init(); + EvMessageQueue messageQueue; LibraryFactory::Initialize(messageQueue); auto library = LibraryFactory::Instance().DefaultLocalLibrary(); @@ -289,7 +291,7 @@ int main(int argc, char** argv) { { PlaybackService playback(messageQueue, library); - plugin::Init(&messageQueue, &playback, library); + plugin::Start(&messageQueue, &playback, library); auto prefs = Preferences::ForComponent(prefs::components::Settings); if (prefs->GetBool(prefs::keys::SyncOnStartup, true)) { diff --git a/src/plugins/pipewireout/PipeWireOut.cpp b/src/plugins/pipewireout/PipeWireOut.cpp index 3eedd302c..b4f20e89e 100644 --- a/src/plugins/pipewireout/PipeWireOut.cpp +++ b/src/plugins/pipewireout/PipeWireOut.cpp @@ -289,7 +289,7 @@ IDevice* PipeWireOut::GetDefaultDevice() { } void PipeWireOut::StopPipeWire() { - if (::debug) ::debug->Info(TAG, "shutdown started"); + ::debug->Info(TAG, "shutdown started"); this->Stop(); @@ -317,7 +317,7 @@ void PipeWireOut::StopPipeWire() { this->channelCount = 0; this->sampleRate = 0; - if (::debug) ::debug->Info(TAG, "shutdown complete"); + ::debug->Info(TAG, "shutdown complete"); } bool PipeWireOut::StartPipeWire(IBuffer* buffer) {