mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 15:32:37 +00:00
Ensure debug
is properly initialized for all plugins.
This commit is contained in:
parent
56f3af3b96
commit
f2071d31aa
@ -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<mcsdk_context_internal*>(context->internal.opaque);
|
||||
plugin::Init(message_queue, internal->playback, internal->library);
|
||||
plugin::Start(message_queue, internal->playback, internal->library);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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<musik::core::library::MasterLibrary>();
|
||||
auto library = std::make_shared<library::MasterLibrary>();
|
||||
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user