diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 14a38f7cfa7ce..45bfcc7e74adb 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -140,7 +140,6 @@ set(LINK_LIB muse::workspace workspacescene muse::audio - muse::audioplugins muse::mpe muse::midi muse::learn @@ -162,6 +161,10 @@ if (MUSE_MODULE_UI) list(APPEND LINK_LIB muse::dockwindow) endif() +if (MUSE_MODULE_AUDIOPLUGINS) + list(APPEND LINK_LIB muse::audioplugins) +endif() + if (MUE_BUILD_CONVERTER_MODULE) list(APPEND LINK_LIB converter) endif() diff --git a/src/app/internal/consoleapp.h b/src/app/internal/consoleapp.h index 3adfb9f65bcee..024254b705e1c 100644 --- a/src/app/internal/consoleapp.h +++ b/src/app/internal/consoleapp.h @@ -37,7 +37,7 @@ #include "converter/iconvertercontroller.h" #include "engraving/devtools/drawdata/idiagnosticdrawprovider.h" #include "autobot/iautobot.h" -#include "audio/iregisteraudiopluginsscenario.h" +#include "audioplugins/iregisteraudiopluginsscenario.h" #include "multiinstances/imultiinstancesprovider.h" #include "ui/iuiconfiguration.h" @@ -60,7 +60,7 @@ class ConsoleApp : public muse::BaseApplication, public std::enable_shared_from_ muse::Inject converter; muse::Inject diagnosticDrawProvider; muse::Inject autobot; - muse::Inject registerAudioPluginsScenario; + muse::Inject registerAudioPluginsScenario; muse::Inject multiInstancesProvider; muse::Inject uiConfiguration; muse::Inject appshellConfiguration; diff --git a/src/framework/audio/CMakeLists.txt b/src/framework/audio/CMakeLists.txt index 0dba558b44d29..2c45ef6a8eecd 100644 --- a/src/framework/audio/CMakeLists.txt +++ b/src/framework/audio/CMakeLists.txt @@ -99,12 +99,6 @@ set(MODULE_SRC ${CMAKE_CURRENT_LIST_DIR}/iplayback.h ${CMAKE_CURRENT_LIST_DIR}/isoundfontrepository.h ${CMAKE_CURRENT_LIST_DIR}/isynthesizer.h - ${CMAKE_CURRENT_LIST_DIR}/iknownaudiopluginsregister.h - ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginsscanner.h - ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginsscannerregister.h - ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginmetareader.h - ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginmetareaderregister.h - ${CMAKE_CURRENT_LIST_DIR}/iregisteraudiopluginsscenario.h ${CMAKE_CURRENT_LIST_DIR}/devtools/inputlag.h # Common internal @@ -126,16 +120,6 @@ set(MODULE_SRC ${CMAKE_CURRENT_LIST_DIR}/internal/abstractsynthesizer.h ${CMAKE_CURRENT_LIST_DIR}/internal/abstracteventsequencer.h - # Plugins - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/knownaudiopluginsregister.cpp - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/knownaudiopluginsregister.h - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/audiopluginsscannerregister.cpp - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/audiopluginsscannerregister.h - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/audiopluginmetareaderregister.cpp - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/audiopluginmetareaderregister.h - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/registeraudiopluginsscenario.cpp - ${CMAKE_CURRENT_LIST_DIR}/internal/plugins/registeraudiopluginsscenario.h - # Driver ${DRIVER_SRC} @@ -337,5 +321,5 @@ set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml) setup_module() if (MUSE_MODULE_AUDIO_TESTS) - add_subdirectory(tests) + #add_subdirectory(tests) no tests endif() diff --git a/src/framework/audio/audiomodule.cpp b/src/framework/audio/audiomodule.cpp index 3e090638e32c4..1102a6182624d 100644 --- a/src/framework/audio/audiomodule.cpp +++ b/src/framework/audio/audiomodule.cpp @@ -33,11 +33,6 @@ #include "internal/audiothreadsecurer.h" #include "internal/audiooutputdevicecontroller.h" -#include "internal/plugins/knownaudiopluginsregister.h" -#include "internal/plugins/audiopluginsscannerregister.h" -#include "internal/plugins/audiopluginmetareaderregister.h" -#include "internal/plugins/registeraudiopluginsscenario.h" - #include "internal/worker/audioengine.h" #include "internal/worker/playback.h" @@ -124,7 +119,6 @@ void AudioModule::registerExports() m_synthResolver = std::make_shared(); m_playbackFacade = std::make_shared(iocContext()); m_soundFontRepository = std::make_shared(); - m_registerAudioPluginsScenario = std::make_shared(); #if defined(MUSE_MODULE_AUDIO_JACK) m_audioDriver = std::shared_ptr(new JackAudioDriver()); @@ -160,11 +154,6 @@ void AudioModule::registerExports() ioc()->registerExport(moduleName(), m_fxResolver); ioc()->registerExport(moduleName(), m_soundFontRepository); - - ioc()->registerExport(moduleName(), std::make_shared()); - ioc()->registerExport(moduleName(), std::make_shared()); - ioc()->registerExport(moduleName(), std::make_shared()); - ioc()->registerExport(moduleName(), m_registerAudioPluginsScenario); } void AudioModule::registerResources() @@ -216,7 +205,6 @@ void AudioModule::onInit(const IApplication::RunMode& mode) // Init configuration m_configuration->init(); - m_registerAudioPluginsScenario->init(); if (mode == IApplication::RunMode::AudioPluginRegistration) { return; @@ -238,15 +226,6 @@ void AudioModule::onInit(const IApplication::RunMode& mode) for (const io::path_t& p : paths) { pr->reg("soundfonts", p); } - pr->reg("known_audio_plugins", m_configuration->knownAudioPluginsFilePath()); - } -} - -void AudioModule::onDelayedInit() -{ - Ret ret = m_registerAudioPluginsScenario->registerNewPlugins(); - if (!ret) { - LOGE() << ret.toString(); } } diff --git a/src/framework/audio/audiomodule.h b/src/framework/audio/audiomodule.h index e40c9e4986b54..c77ff684cc632 100644 --- a/src/framework/audio/audiomodule.h +++ b/src/framework/audio/audiomodule.h @@ -59,7 +59,6 @@ class AudioModule : public modularity::IModuleSetup, public async::Asyncable void registerUiTypes() override; void resolveImports() override; void onInit(const IApplication::RunMode& mode) override; - void onDelayedInit() override; void onDeinit() override; void onDestroy() override; @@ -80,9 +79,6 @@ class AudioModule : public modularity::IModuleSetup, public async::Asyncable std::shared_ptr m_soundFontRepository; - std::shared_ptr m_knownAudioPluginsRegister; - std::shared_ptr m_registerAudioPluginsScenario; - std::shared_ptr m_audioDriver; }; } diff --git a/src/framework/audio/audiotypes.h b/src/framework/audio/audiotypes.h index db47d9aac3a6a..9eec8a16e9f19 100644 --- a/src/framework/audio/audiotypes.h +++ b/src/framework/audio/audiotypes.h @@ -179,20 +179,6 @@ using AudioResourceMetaSet = std::set; static const AudioResourceId MUSE_REVERB_ID("Muse Reverb"); -enum class AudioPluginType { - Undefined = -1, - Instrument, - Fx, -}; - -struct AudioPluginInfo { - AudioPluginType type = AudioPluginType::Undefined; - AudioResourceMeta meta; - io::path_t path; - bool enabled = false; - int errorCode = 0; -}; - enum class AudioFxType { Undefined = -1, VstFx, diff --git a/src/framework/audio/audioutils.h b/src/framework/audio/audioutils.h index cb30704d3e91c..21394efed845f 100644 --- a/src/framework/audio/audioutils.h +++ b/src/framework/audio/audioutils.h @@ -38,22 +38,6 @@ inline AudioResourceMeta makeReverbMeta() return meta; } -inline AudioPluginType audioPluginTypeFromCategoriesString(const String& categoriesStr) -{ - static const std::vector > STRING_TO_PLUGIN_TYPE_LIST = { - { u"Instrument", AudioPluginType::Instrument }, - { u"Fx", AudioPluginType::Fx }, - }; - - for (auto it = STRING_TO_PLUGIN_TYPE_LIST.cbegin(); it != STRING_TO_PLUGIN_TYPE_LIST.cend(); ++it) { - if (categoriesStr.contains(it->first)) { - return it->second; - } - } - - return AudioPluginType::Undefined; -} - inline String audioSourceName(const AudioInputParams& params) { if (params.type() == AudioSourceType::MuseSampler) { diff --git a/src/framework/audio/iaudioconfiguration.h b/src/framework/audio/iaudioconfiguration.h index 64ce6e2ede22c..60c06419d87f9 100644 --- a/src/framework/audio/iaudioconfiguration.h +++ b/src/framework/audio/iaudioconfiguration.h @@ -72,8 +72,6 @@ class IAudioConfiguration : MODULE_EXPORT_INTERFACE virtual void setUserSoundFontDirectories(const io::paths_t& paths) = 0; virtual async::Channel soundFontDirectoriesChanged() const = 0; - virtual io::path_t knownAudioPluginsFilePath() const = 0; - virtual bool shouldMeasureInputLag() const = 0; }; } diff --git a/src/framework/audio/internal/audioconfiguration.cpp b/src/framework/audio/internal/audioconfiguration.cpp index ed0870330b003..a2f3200a53afe 100644 --- a/src/framework/audio/internal/audioconfiguration.cpp +++ b/src/framework/audio/internal/audioconfiguration.cpp @@ -234,11 +234,6 @@ async::Channel AudioConfiguration::soundFontDirectoriesChanged() co return m_soundFontDirsChanged; } -io::path_t AudioConfiguration::knownAudioPluginsFilePath() const -{ - return globalConfiguration()->userAppDataPath() + "/known_audio_plugins.json"; -} - bool AudioConfiguration::shouldMeasureInputLag() const { return settings()->value(AUDIO_MEASURE_INPUT_LAG).toBool(); diff --git a/src/framework/audio/internal/audioconfiguration.h b/src/framework/audio/internal/audioconfiguration.h index 607b5bf392640..4c1026e9d6a25 100644 --- a/src/framework/audio/internal/audioconfiguration.h +++ b/src/framework/audio/internal/audioconfiguration.h @@ -74,8 +74,6 @@ class AudioConfiguration : public IAudioConfiguration void setUserSoundFontDirectories(const io::paths_t& paths) override; async::Channel soundFontDirectoriesChanged() const override; - io::path_t knownAudioPluginsFilePath() const override; - bool shouldMeasureInputLag() const override; private: diff --git a/src/framework/audio/tests/mocks/audioconfigurationmock.h b/src/framework/audio/tests/mocks/audioconfigurationmock.h deleted file mode 100644 index 9c9d5ff8270d5..0000000000000 --- a/src/framework/audio/tests/mocks/audioconfigurationmock.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-3.0-only - * MuseScore-CLA-applies - * - * MuseScore - * Music Composition & Notation - * - * Copyright (C) 2021 MuseScore BVBA and others - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef MUSE_AUDIO_AUDIOCONFIGURATIONMOCK_H -#define MUSE_AUDIO_AUDIOCONFIGURATIONMOCK_H - -#include - -#include "framework/audio/iaudioconfiguration.h" - -namespace muse::audio { -class AudioConfigurationMock : public IAudioConfiguration -{ -public: - MOCK_METHOD(std::vector, availableAudioApiList, (), (const, override)); - - MOCK_METHOD(std::string, currentAudioApi, (), (const, override)); - MOCK_METHOD(void, setCurrentAudioApi, (const std::string&), (override)); - - MOCK_METHOD(std::string, audioOutputDeviceId, (), (const, override)); - MOCK_METHOD(void, setAudioOutputDeviceId, (const std::string&), (override)); - MOCK_METHOD(async::Notification, audioOutputDeviceIdChanged, (), (const, override)); - - MOCK_METHOD(audioch_t, audioChannelsCount, (), (const, override)); - - MOCK_METHOD(unsigned int, driverBufferSize, (), (const, override)); - MOCK_METHOD(void, setDriverBufferSize, (unsigned int), (override)); - MOCK_METHOD(async::Notification, driverBufferSizeChanged, (), (const, override)); - - MOCK_METHOD(msecs_t, audioWorkerInterval, (const samples_t, const sample_rate_t), (const, override)); - MOCK_METHOD(samples_t, minSamplesToReserve, (RenderMode), (const, override)); - - MOCK_METHOD(samples_t, samplesToPreallocate, (), (const, override)); - MOCK_METHOD(async::Channel, samplesToPreallocateChanged, (), (const, override)); - - MOCK_METHOD(unsigned int, sampleRate, (), (const, override)); - MOCK_METHOD(void, setSampleRate, (unsigned int), (override)); - MOCK_METHOD(async::Notification, sampleRateChanged, (), (const, override)); - - MOCK_METHOD(size_t, minTrackCountForMultithreading, (), (const, override)); - - // synthesizers - MOCK_METHOD(AudioInputParams, defaultAudioInputParams, (), (const, override)); - - MOCK_METHOD(io::paths_t, soundFontDirectories, (), (const, override)); - MOCK_METHOD(io::paths_t, userSoundFontDirectories, (), (const, override)); - MOCK_METHOD(void, setUserSoundFontDirectories, (const io::paths_t&), (override)); - MOCK_METHOD(async::Channel, soundFontDirectoriesChanged, (), (const, override)); - - MOCK_METHOD(io::path_t, knownAudioPluginsFilePath, (), (const, override)); - - MOCK_METHOD(bool, shouldMeasureInputLag, (), (const, override)); -}; -} - -#endif // MUSE_AUDIO_AUDIOCONFIGURATIONMOCK_H diff --git a/src/framework/audioplugins/CMakeLists.txt b/src/framework/audioplugins/CMakeLists.txt index 9b36097fd92f4..9cfbccceb5f5f 100644 --- a/src/framework/audioplugins/CMakeLists.txt +++ b/src/framework/audioplugins/CMakeLists.txt @@ -25,10 +25,31 @@ set(MODULE_SRC ${CMAKE_CURRENT_LIST_DIR}/audiopluginsmodule.cpp ${CMAKE_CURRENT_LIST_DIR}/audiopluginsmodule.h + ${CMAKE_CURRENT_LIST_DIR}/audiopluginstypes.h + ${CMAKE_CURRENT_LIST_DIR}/audiopluginserrors.h + ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginsconfiguration.h + ${CMAKE_CURRENT_LIST_DIR}/iknownaudiopluginsregister.h + ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginsscanner.h + ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginsscannerregister.h + ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginmetareader.h + ${CMAKE_CURRENT_LIST_DIR}/iaudiopluginmetareaderregister.h + ${CMAKE_CURRENT_LIST_DIR}/iregisteraudiopluginsscenario.h + + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginsutils.h + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginsconfiguration.cpp + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginsconfiguration.h + ${CMAKE_CURRENT_LIST_DIR}/internal/knownaudiopluginsregister.cpp + ${CMAKE_CURRENT_LIST_DIR}/internal/knownaudiopluginsregister.h + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginsscannerregister.cpp + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginsscannerregister.h + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginmetareaderregister.cpp + ${CMAKE_CURRENT_LIST_DIR}/internal/audiopluginmetareaderregister.h + ${CMAKE_CURRENT_LIST_DIR}/internal/registeraudiopluginsscenario.cpp + ${CMAKE_CURRENT_LIST_DIR}/internal/registeraudiopluginsscenario.h ) setup_module() if (MUSE_MODULE_AUDIOPLUGINS_TESTS) - #add_subdirectory(tests) + add_subdirectory(tests) endif() diff --git a/src/framework/audioplugins/audiopluginserrors.h b/src/framework/audioplugins/audiopluginserrors.h new file mode 100644 index 0000000000000..bae1dc4d4973e --- /dev/null +++ b/src/framework/audioplugins/audiopluginserrors.h @@ -0,0 +1,39 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "global/types/ret.h" + +namespace muse::audioplugins { +enum class Err { + Undefined = int(Ret::Code::Undefined), + NoError = int(Ret::Code::Ok), + UnknownError = int(Ret::Code::AudioFirst), + + UnknownPluginType = 351, +}; + +inline Ret make_ret(Err e) +{ + return Ret(static_cast(e)); +} +} diff --git a/src/framework/audioplugins/audiopluginsmodule.cpp b/src/framework/audioplugins/audiopluginsmodule.cpp index b9a570c88d731..9ba4fbb140b5b 100644 --- a/src/framework/audioplugins/audiopluginsmodule.cpp +++ b/src/framework/audioplugins/audiopluginsmodule.cpp @@ -21,6 +21,13 @@ */ #include "audiopluginsmodule.h" +#include "internal/audiopluginsconfiguration.h" +#include "internal/knownaudiopluginsregister.h" +#include "internal/audiopluginsscannerregister.h" +#include "internal/audiopluginmetareaderregister.h" +#include "internal/registeraudiopluginsscenario.h" + +#include "diagnostics/idiagnosticspathsregister.h" #include "log.h" @@ -30,7 +37,6 @@ using namespace muse::audioplugins; AudioPluginsModule::AudioPluginsModule() { - } std::string AudioPluginsModule::moduleName() const @@ -40,34 +46,35 @@ std::string AudioPluginsModule::moduleName() const void AudioPluginsModule::registerExports() { + m_configuration = std::make_shared(); + m_registerAudioPluginsScenario = std::make_shared(); + ioc()->registerExport(moduleName(), m_configuration); + ioc()->registerExport(moduleName(), std::make_shared()); + ioc()->registerExport(moduleName(), std::make_shared()); + ioc()->registerExport(moduleName(), std::make_shared()); + ioc()->registerExport(moduleName(), m_registerAudioPluginsScenario); } void AudioPluginsModule::resolveImports() { - } -void AudioPluginsModule::onInit(const IApplication::RunMode& mode) +void AudioPluginsModule::onInit(const IApplication::RunMode&) { - + m_registerAudioPluginsScenario->init(); //! --- Diagnostics --- - // auto pr = ioc()->resolve(moduleName()); - // if (pr) { - // std::vector paths = m_configuration->soundFontDirectories(); - // for (const io::path_t& p : paths) { - // pr->reg("soundfonts", p); - // } - // pr->reg("known_audio_plugins", m_configuration->knownAudioPluginsFilePath()); - // } + auto pr = ioc()->resolve(moduleName()); + if (pr) { + pr->reg("known_audio_plugins", m_configuration->knownAudioPluginsFilePath()); + } } void AudioPluginsModule::onDelayedInit() { - // Ret ret = m_registerAudioPluginsScenario->registerNewPlugins(); - // if (!ret) { - // LOGE() << ret.toString(); - // } + Ret ret = m_registerAudioPluginsScenario->registerNewPlugins(); + if (!ret) { + LOGE() << ret.toString(); + } } - diff --git a/src/framework/audioplugins/audiopluginsmodule.h b/src/framework/audioplugins/audiopluginsmodule.h index 039c37a4b3bfa..fa8255e15ce08 100644 --- a/src/framework/audioplugins/audiopluginsmodule.h +++ b/src/framework/audioplugins/audiopluginsmodule.h @@ -26,6 +26,9 @@ #include "modularity/imodulesetup.h" namespace muse::audioplugins { +class AudioPluginsConfiguration; +class KnownAudioPluginsRegister; +class RegisterAudioPluginsScenario; class AudioPluginsModule : public modularity::IModuleSetup { public: @@ -40,7 +43,8 @@ class AudioPluginsModule : public modularity::IModuleSetup private: + std::shared_ptr m_configuration; + std::shared_ptr m_knownAudioPluginsRegister; + std::shared_ptr m_registerAudioPluginsScenario; }; } - - diff --git a/src/framework/audioplugins/audiopluginstypes.h b/src/framework/audioplugins/audiopluginstypes.h new file mode 100644 index 0000000000000..7a888507e29c1 --- /dev/null +++ b/src/framework/audioplugins/audiopluginstypes.h @@ -0,0 +1,40 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "audio/audiotypes.h" + +namespace muse::audioplugins { +enum class AudioPluginType { + Undefined = -1, + Instrument, + Fx, +}; + +struct AudioPluginInfo { + AudioPluginType type = AudioPluginType::Undefined; + audio::AudioResourceMeta meta; + io::path_t path; + bool enabled = false; + int errorCode = 0; +}; +} diff --git a/src/framework/audio/iaudiopluginmetareader.h b/src/framework/audioplugins/iaudiopluginmetareader.h similarity index 78% rename from src/framework/audio/iaudiopluginmetareader.h rename to src/framework/audioplugins/iaudiopluginmetareader.h index 4991b190e2608..a86151154d1da 100644 --- a/src/framework/audio/iaudiopluginmetareader.h +++ b/src/framework/audioplugins/iaudiopluginmetareader.h @@ -20,23 +20,20 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_IAUDIOPLUGINMETAREADER_H -#define MUSE_AUDIO_IAUDIOPLUGINMETAREADER_H +#pragma once #include "global/types/retval.h" -#include "audiotypes.h" +#include "audio/audiotypes.h" -namespace muse::audio { +namespace muse::audioplugins { class IAudioPluginMetaReader { public: virtual ~IAudioPluginMetaReader() = default; virtual bool canReadMeta(const io::path_t& pluginPath) const = 0; - virtual RetVal readMeta(const io::path_t& pluginPath) const = 0; + virtual RetVal readMeta(const io::path_t& pluginPath) const = 0; }; using IAudioPluginMetaReaderPtr = std::shared_ptr; } - -#endif // MUSE_AUDIO_IAUDIOPLUGINMETAREADER_H diff --git a/src/framework/audio/iaudiopluginmetareaderregister.h b/src/framework/audioplugins/iaudiopluginmetareaderregister.h similarity index 86% rename from src/framework/audio/iaudiopluginmetareaderregister.h rename to src/framework/audioplugins/iaudiopluginmetareaderregister.h index 44a898a851373..be8d2b151412e 100644 --- a/src/framework/audio/iaudiopluginmetareaderregister.h +++ b/src/framework/audioplugins/iaudiopluginmetareaderregister.h @@ -20,14 +20,13 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_IAUDIOPLUGINMETAREADERREGISTER_H -#define MUSE_AUDIO_IAUDIOPLUGINMETAREADERREGISTER_H +#pragma once #include "modularity/imoduleinterface.h" #include "iaudiopluginmetareader.h" -namespace muse::audio { +namespace muse::audioplugins { class IAudioPluginMetaReaderRegister : MODULE_EXPORT_INTERFACE { INTERFACE_ID(IAudioPluginMetaReaderRegister) @@ -39,5 +38,3 @@ class IAudioPluginMetaReaderRegister : MODULE_EXPORT_INTERFACE virtual void registerReader(IAudioPluginMetaReaderPtr reader) = 0; }; } - -#endif // MUSE_AUDIO_IAUDIOPLUGINMETAREADERREGISTER_H diff --git a/src/framework/audioplugins/iaudiopluginsconfiguration.h b/src/framework/audioplugins/iaudiopluginsconfiguration.h new file mode 100644 index 0000000000000..ba377d55285d4 --- /dev/null +++ b/src/framework/audioplugins/iaudiopluginsconfiguration.h @@ -0,0 +1,38 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "modularity/imoduleinterface.h" + +#include "global/io/path.h" + +namespace muse::audioplugins { +class IAudioPluginsConfiguration : MODULE_EXPORT_INTERFACE +{ + INTERFACE_ID(IAudioPluginsConfiguration) + +public: + virtual ~IAudioPluginsConfiguration() = default; + + virtual io::path_t knownAudioPluginsFilePath() const = 0; +}; +} diff --git a/src/framework/audio/iaudiopluginsscanner.h b/src/framework/audioplugins/iaudiopluginsscanner.h similarity index 86% rename from src/framework/audio/iaudiopluginsscanner.h rename to src/framework/audioplugins/iaudiopluginsscanner.h index 48800ea2b23fc..efe6920fa425b 100644 --- a/src/framework/audio/iaudiopluginsscanner.h +++ b/src/framework/audioplugins/iaudiopluginsscanner.h @@ -19,14 +19,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_IAUDIOPLUGINSSCANNER_H -#define MUSE_AUDIO_IAUDIOPLUGINSSCANNER_H +#pragma once #include #include "global/io/path.h" -namespace muse::audio { +namespace muse::audioplugins { class IAudioPluginsScanner { public: @@ -37,5 +36,3 @@ class IAudioPluginsScanner using IAudioPluginsScannerPtr = std::shared_ptr; } - -#endif // MUSE_AUDIO_IAUDIOPLUGINSSCANNER_H diff --git a/src/framework/audio/iaudiopluginsscannerregister.h b/src/framework/audioplugins/iaudiopluginsscannerregister.h similarity index 86% rename from src/framework/audio/iaudiopluginsscannerregister.h rename to src/framework/audioplugins/iaudiopluginsscannerregister.h index 5dd696681ce3b..67b995aae10c7 100644 --- a/src/framework/audio/iaudiopluginsscannerregister.h +++ b/src/framework/audioplugins/iaudiopluginsscannerregister.h @@ -19,14 +19,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_IAUDIOPLUGINSSCANNERREGISTER_H -#define MUSE_AUDIO_IAUDIOPLUGINSSCANNERREGISTER_H +#pragma once #include "modularity/imoduleinterface.h" #include "iaudiopluginsscanner.h" -namespace muse::audio { +namespace muse::audioplugins { class IAudioPluginsScannerRegister : MODULE_EXPORT_INTERFACE { INTERFACE_ID(IAudioPluginsScannerRegister) @@ -38,5 +37,3 @@ class IAudioPluginsScannerRegister : MODULE_EXPORT_INTERFACE virtual void registerScanner(IAudioPluginsScannerPtr scanner) = 0; }; } - -#endif // MUSE_AUDIO_IAUDIOPLUGINSSCANNERREGISTER_H diff --git a/src/framework/audio/iknownaudiopluginsregister.h b/src/framework/audioplugins/iknownaudiopluginsregister.h similarity index 76% rename from src/framework/audio/iknownaudiopluginsregister.h rename to src/framework/audioplugins/iknownaudiopluginsregister.h index 431187cb2786a..f01e381fcfdb2 100644 --- a/src/framework/audio/iknownaudiopluginsregister.h +++ b/src/framework/audioplugins/iknownaudiopluginsregister.h @@ -19,17 +19,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_IKNOWNAUDIOPLUGINSREGISTER_H -#define MUSE_AUDIO_IKNOWNAUDIOPLUGINSREGISTER_H +#pragma once #include "modularity/imoduleinterface.h" #include "global/types/ret.h" #include "global/io/path.h" -#include "audiotypes.h" +#include "audiopluginstypes.h" -namespace muse::audio { +namespace muse::audioplugins { class IKnownAudioPluginsRegister : MODULE_EXPORT_INTERFACE { INTERFACE_ID(IKnownAudioPluginsRegister) @@ -42,14 +41,12 @@ class IKnownAudioPluginsRegister : MODULE_EXPORT_INTERFACE using PluginInfoAccepted = std::function; virtual std::vector pluginInfoList(PluginInfoAccepted accepted = PluginInfoAccepted()) const = 0; - virtual const io::path_t& pluginPath(const AudioResourceId& resourceId) const = 0; + virtual const io::path_t& pluginPath(const audio::AudioResourceId& resourceId) const = 0; virtual bool exists(const io::path_t& pluginPath) const = 0; - virtual bool exists(const AudioResourceId& resourceId) const = 0; + virtual bool exists(const audio::AudioResourceId& resourceId) const = 0; virtual Ret registerPlugin(const AudioPluginInfo& info) = 0; - virtual Ret unregisterPlugin(const AudioResourceId& resourceId) = 0; + virtual Ret unregisterPlugin(const audio::AudioResourceId& resourceId) = 0; }; } - -#endif // MUSE_AUDIO_IKNOWNAUDIOPLUGINSREGISTER_H diff --git a/src/framework/audio/internal/plugins/audiopluginmetareaderregister.cpp b/src/framework/audioplugins/internal/audiopluginmetareaderregister.cpp similarity index 96% rename from src/framework/audio/internal/plugins/audiopluginmetareaderregister.cpp rename to src/framework/audioplugins/internal/audiopluginmetareaderregister.cpp index 6aca193450e57..fdc168ee2393a 100644 --- a/src/framework/audio/internal/plugins/audiopluginmetareaderregister.cpp +++ b/src/framework/audioplugins/internal/audiopluginmetareaderregister.cpp @@ -22,7 +22,7 @@ #include "audiopluginmetareaderregister.h" -using namespace muse::audio; +using namespace muse::audioplugins; const std::vector& AudioPluginMetaReaderRegister::readers() const { diff --git a/src/framework/audio/internal/plugins/audiopluginmetareaderregister.h b/src/framework/audioplugins/internal/audiopluginmetareaderregister.h similarity index 82% rename from src/framework/audio/internal/plugins/audiopluginmetareaderregister.h rename to src/framework/audioplugins/internal/audiopluginmetareaderregister.h index bd836b929f695..6836784965c17 100644 --- a/src/framework/audio/internal/plugins/audiopluginmetareaderregister.h +++ b/src/framework/audioplugins/internal/audiopluginmetareaderregister.h @@ -20,12 +20,11 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_AUDIOPLUGINMETAREADERREGISTER_H -#define MUSE_AUDIO_AUDIOPLUGINMETAREADERREGISTER_H +#pragma once -#include "iaudiopluginmetareaderregister.h" +#include "../iaudiopluginmetareaderregister.h" -namespace muse::audio { +namespace muse::audioplugins { class AudioPluginMetaReaderRegister : public IAudioPluginMetaReaderRegister { public: @@ -36,5 +35,3 @@ class AudioPluginMetaReaderRegister : public IAudioPluginMetaReaderRegister std::vector m_readers; }; } - -#endif // MUSE_AUDIO_AUDIOPLUGINMETAREADERREGISTER_H diff --git a/src/framework/audioplugins/internal/audiopluginsconfiguration.cpp b/src/framework/audioplugins/internal/audiopluginsconfiguration.cpp new file mode 100644 index 0000000000000..703f9df7b4cb9 --- /dev/null +++ b/src/framework/audioplugins/internal/audiopluginsconfiguration.cpp @@ -0,0 +1,30 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2024 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "audiopluginsconfiguration.h" + +using namespace muse; +using namespace muse::audioplugins; + +io::path_t AudioPluginsConfiguration::knownAudioPluginsFilePath() const +{ + return globalConfiguration()->userAppDataPath() + "/known_audio_plugins.json"; +} diff --git a/src/framework/audioplugins/internal/audiopluginsconfiguration.h b/src/framework/audioplugins/internal/audiopluginsconfiguration.h new file mode 100644 index 0000000000000..c4e904b3ec9c6 --- /dev/null +++ b/src/framework/audioplugins/internal/audiopluginsconfiguration.h @@ -0,0 +1,40 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2024 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "../iaudiopluginsconfiguration.h" + +#include "modularity/ioc.h" +#include "global/iglobalconfiguration.h" + +namespace muse::audioplugins { +class AudioPluginsConfiguration : public IAudioPluginsConfiguration +{ + muse::Inject globalConfiguration; + +public: + AudioPluginsConfiguration() = default; + + io::path_t knownAudioPluginsFilePath() const override; +}; +} diff --git a/src/framework/audio/internal/plugins/audiopluginsscannerregister.cpp b/src/framework/audioplugins/internal/audiopluginsscannerregister.cpp similarity index 96% rename from src/framework/audio/internal/plugins/audiopluginsscannerregister.cpp rename to src/framework/audioplugins/internal/audiopluginsscannerregister.cpp index c0c5d814f9c1e..df6e1cee3c9f2 100644 --- a/src/framework/audio/internal/plugins/audiopluginsscannerregister.cpp +++ b/src/framework/audioplugins/internal/audiopluginsscannerregister.cpp @@ -22,7 +22,7 @@ #include "audiopluginsscannerregister.h" -using namespace muse::audio; +using namespace muse::audioplugins; const std::vector& AudioPluginsScannerRegister::scanners() const { diff --git a/src/framework/audio/internal/plugins/audiopluginsscannerregister.h b/src/framework/audioplugins/internal/audiopluginsscannerregister.h similarity index 82% rename from src/framework/audio/internal/plugins/audiopluginsscannerregister.h rename to src/framework/audioplugins/internal/audiopluginsscannerregister.h index 702e8df4a5f2a..479c063d51792 100644 --- a/src/framework/audio/internal/plugins/audiopluginsscannerregister.h +++ b/src/framework/audioplugins/internal/audiopluginsscannerregister.h @@ -20,12 +20,11 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_AUDIOPLUGINSSCANNERREGISTER_H -#define MUSE_AUDIO_AUDIOPLUGINSSCANNERREGISTER_H +#pragma once -#include "iaudiopluginsscannerregister.h" +#include "../iaudiopluginsscannerregister.h" -namespace muse::audio { +namespace muse::audioplugins { class AudioPluginsScannerRegister : public IAudioPluginsScannerRegister { public: @@ -36,5 +35,3 @@ class AudioPluginsScannerRegister : public IAudioPluginsScannerRegister std::vector m_scanners; }; } - -#endif // MUSE_AUDIO_AUDIOPLUGINSSCANNERREGISTER_H diff --git a/src/framework/audioplugins/internal/audiopluginsutils.h b/src/framework/audioplugins/internal/audiopluginsutils.h new file mode 100644 index 0000000000000..d1156c3502557 --- /dev/null +++ b/src/framework/audioplugins/internal/audiopluginsutils.h @@ -0,0 +1,42 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "../audiopluginstypes.h" + +namespace muse::audioplugins { +inline AudioPluginType audioPluginTypeFromCategoriesString(const String& categoriesStr) +{ + static const std::vector > STRING_TO_PLUGIN_TYPE_LIST = { + { u"Instrument", AudioPluginType::Instrument }, + { u"Fx", AudioPluginType::Fx }, + }; + + for (auto it = STRING_TO_PLUGIN_TYPE_LIST.cbegin(); it != STRING_TO_PLUGIN_TYPE_LIST.cend(); ++it) { + if (categoriesStr.contains(it->first)) { + return it->second; + } + } + + return AudioPluginType::Undefined; +} +} diff --git a/src/framework/audio/internal/plugins/knownaudiopluginsregister.cpp b/src/framework/audioplugins/internal/knownaudiopluginsregister.cpp similarity index 96% rename from src/framework/audio/internal/plugins/knownaudiopluginsregister.cpp rename to src/framework/audioplugins/internal/knownaudiopluginsregister.cpp index a686fb1800d76..7c94cc52fc577 100644 --- a/src/framework/audio/internal/plugins/knownaudiopluginsregister.cpp +++ b/src/framework/audioplugins/internal/knownaudiopluginsregister.cpp @@ -24,16 +24,18 @@ #include "global/serialization/json.h" -#include "audioutils.h" +#include "audio/audiotypes.h" +#include "audiopluginsutils.h" #include "log.h" using namespace muse; +using namespace muse::audioplugins; using namespace muse::audio; -namespace muse::audio { -static const std::map RESOURCE_TYPE_TO_STRING_MAP { - { AudioResourceType::VstPlugin, "VstPlugin" }, +namespace muse::audioplugins { +static const std::map RESOURCE_TYPE_TO_STRING_MAP { + { audio::AudioResourceType::VstPlugin, "VstPlugin" }, }; static JsonObject attributesToJson(const AudioResourceAttributes& attributes) diff --git a/src/framework/audio/internal/plugins/knownaudiopluginsregister.h b/src/framework/audioplugins/internal/knownaudiopluginsregister.h similarity index 69% rename from src/framework/audio/internal/plugins/knownaudiopluginsregister.h rename to src/framework/audioplugins/internal/knownaudiopluginsregister.h index 6007c2ae28243..490b60aeb6ae1 100644 --- a/src/framework/audio/internal/plugins/knownaudiopluginsregister.h +++ b/src/framework/audioplugins/internal/knownaudiopluginsregister.h @@ -20,41 +20,38 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_KNOWNAUDIOPLUGINSREGISTER_H -#define MUSE_AUDIO_KNOWNAUDIOPLUGINSREGISTER_H +#pragma once #include "global/modularity/ioc.h" #include "global/io/ifilesystem.h" -#include "iknownaudiopluginsregister.h" -#include "iaudioconfiguration.h" +#include "../iknownaudiopluginsregister.h" +#include "../iaudiopluginsconfiguration.h" -namespace muse::audio { +namespace muse::audioplugins { class KnownAudioPluginsRegister : public IKnownAudioPluginsRegister { public: - Inject configuration; + Inject configuration; Inject fileSystem; public: Ret load() override; std::vector pluginInfoList(PluginInfoAccepted accepted = PluginInfoAccepted()) const override; - const io::path_t& pluginPath(const AudioResourceId& resourceId) const override; + const io::path_t& pluginPath(const audio::AudioResourceId& resourceId) const override; bool exists(const io::path_t& pluginPath) const override; - bool exists(const AudioResourceId& resourceId) const override; + bool exists(const audio::AudioResourceId& resourceId) const override; Ret registerPlugin(const AudioPluginInfo& info) override; - Ret unregisterPlugin(const AudioResourceId& resourceId) override; + Ret unregisterPlugin(const audio::AudioResourceId& resourceId) override; private: Ret writePluginsInfo(); bool m_loaded = false; - std::multimap m_pluginInfoMap; + std::multimap m_pluginInfoMap; std::set m_pluginPaths; }; } - -#endif // MUSE_AUDIO_KNOWNAUDIOPLUGINSREGISTER_H diff --git a/src/framework/audio/internal/plugins/registeraudiopluginsscenario.cpp b/src/framework/audioplugins/internal/registeraudiopluginsscenario.cpp similarity index 97% rename from src/framework/audio/internal/plugins/registeraudiopluginsscenario.cpp rename to src/framework/audioplugins/internal/registeraudiopluginsscenario.cpp index 0460c75b00056..705d0c872c7b7 100644 --- a/src/framework/audio/internal/plugins/registeraudiopluginsscenario.cpp +++ b/src/framework/audioplugins/internal/registeraudiopluginsscenario.cpp @@ -26,13 +26,12 @@ #include "global/translation.h" -#include "audioutils.h" -#include "audioerrors.h" +#include "audiopluginserrors.h" #include "log.h" using namespace muse; -using namespace muse::audio; +using namespace muse::audioplugins; void RegisterAudioPluginsScenario::init() { @@ -121,7 +120,7 @@ Ret RegisterAudioPluginsScenario::registerPlugin(const io::path_t& pluginPath) IAudioPluginMetaReaderPtr reader = metaReader(pluginPath); if (!reader) { - return make_ret(audio::Err::UnknownPluginType); + return make_ret(Err::UnknownPluginType); } RetVal metaList = reader->readMeta(pluginPath); diff --git a/src/framework/audio/internal/plugins/registeraudiopluginsscenario.h b/src/framework/audioplugins/internal/registeraudiopluginsscenario.h similarity index 69% rename from src/framework/audio/internal/plugins/registeraudiopluginsscenario.h rename to src/framework/audioplugins/internal/registeraudiopluginsscenario.h index 878c26515d9a2..f74c957f5a51a 100644 --- a/src/framework/audio/internal/plugins/registeraudiopluginsscenario.h +++ b/src/framework/audioplugins/internal/registeraudiopluginsscenario.h @@ -20,8 +20,7 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_REGISTERAUDIOPLUGINSSCENARIO_H -#define MUSE_AUDIO_REGISTERAUDIOPLUGINSSCENARIO_H +#pragma once #include "global/modularity/ioc.h" #include "global/iprocess.h" @@ -29,21 +28,21 @@ #include "global/iinteractive.h" #include "global/async/asyncable.h" -#include "iregisteraudiopluginsscenario.h" -#include "iknownaudiopluginsregister.h" -#include "iaudiopluginsscannerregister.h" -#include "iaudiopluginmetareaderregister.h" +#include "../iregisteraudiopluginsscenario.h" +#include "../iknownaudiopluginsregister.h" +#include "../iaudiopluginsscannerregister.h" +#include "../iaudiopluginmetareaderregister.h" -namespace muse::audio { +namespace muse::audioplugins { class RegisterAudioPluginsScenario : public IRegisterAudioPluginsScenario, public async::Asyncable { public: - INJECT(IKnownAudioPluginsRegister, knownPluginsRegister) - INJECT(IAudioPluginsScannerRegister, scannerRegister) - INJECT(IAudioPluginMetaReaderRegister, metaReaderRegister) - INJECT(IGlobalConfiguration, globalConfiguration) - INJECT(IInteractive, interactive) - INJECT(IProcess, process) + Inject knownPluginsRegister; + Inject scannerRegister; + Inject metaReaderRegister; + Inject globalConfiguration; + Inject interactive; + Inject process; public: void init(); @@ -60,5 +59,3 @@ class RegisterAudioPluginsScenario : public IRegisterAudioPluginsScenario, publi bool m_aborted = false; }; } - -#endif // MUSE_AUDIO_REGISTERAUDIOPLUGINSSCENARIO_H diff --git a/src/framework/audio/iregisteraudiopluginsscenario.h b/src/framework/audioplugins/iregisteraudiopluginsscenario.h similarity index 87% rename from src/framework/audio/iregisteraudiopluginsscenario.h rename to src/framework/audioplugins/iregisteraudiopluginsscenario.h index 52292567f4fc4..dae74ed7c3d16 100644 --- a/src/framework/audio/iregisteraudiopluginsscenario.h +++ b/src/framework/audioplugins/iregisteraudiopluginsscenario.h @@ -20,15 +20,14 @@ * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_IREGISTERAUDIOPLUGINSSCENARIO_H -#define MUSE_AUDIO_IREGISTERAUDIOPLUGINSSCENARIO_H +#pragma once #include "modularity/imoduleinterface.h" #include "global/types/ret.h" #include "global/io/path.h" -namespace muse::audio { +namespace muse::audioplugins { class IRegisterAudioPluginsScenario : MODULE_EXPORT_INTERFACE { INTERFACE_ID(IRegisterAudioPluginsScenario) @@ -41,5 +40,3 @@ class IRegisterAudioPluginsScenario : MODULE_EXPORT_INTERFACE virtual Ret registerFailedPlugin(const io::path_t& pluginPath, int failCode) = 0; }; } - -#endif // MUSE_AUDIO_IREGISTERAUDIOPLUGINSSCENARIO_H diff --git a/src/framework/audio/tests/CMakeLists.txt b/src/framework/audioplugins/tests/CMakeLists.txt similarity index 79% rename from src/framework/audio/tests/CMakeLists.txt rename to src/framework/audioplugins/tests/CMakeLists.txt index d2482b002f614..f34383f5f7694 100644 --- a/src/framework/audio/tests/CMakeLists.txt +++ b/src/framework/audioplugins/tests/CMakeLists.txt @@ -18,15 +18,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set(MODULE_TEST muse_audio_test) +set(MODULE_TEST muse_audioplugins_test) -if (NOT MUSE_MODULE_AUDIO_JACK) - -if(OS_IS_FBSD) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /usr/local/lib/libasound.so") -endif() set(MODULE_TEST_SRC - ${CMAKE_CURRENT_LIST_DIR}/mocks/audioconfigurationmock.h + ${CMAKE_CURRENT_LIST_DIR}/mocks/audiopluginsconfigurationmock.h ${CMAKE_CURRENT_LIST_DIR}/mocks/knownaudiopluginsregistermock.h ${CMAKE_CURRENT_LIST_DIR}/mocks/audiopluginsscannerregistermock.h ${CMAKE_CURRENT_LIST_DIR}/mocks/audiopluginsscannermock.h @@ -35,11 +30,10 @@ set(MODULE_TEST_SRC ${CMAKE_CURRENT_LIST_DIR}/knownaudiopluginsregistertest.cpp ${CMAKE_CURRENT_LIST_DIR}/registeraudiopluginsscenariotest.cpp - ${CMAKE_CURRENT_LIST_DIR}/audioutilstest.cpp + ${CMAKE_CURRENT_LIST_DIR}/audiopluginsutilstest.cpp ) -set(MODULE_TEST_LINK muse_audio) +set(MODULE_TEST_LINK muse_audioplugins) include(SetupGTest) -endif() diff --git a/src/framework/audio/tests/audioutilstest.cpp b/src/framework/audioplugins/tests/audiopluginsutilstest.cpp similarity index 85% rename from src/framework/audio/tests/audioutilstest.cpp rename to src/framework/audioplugins/tests/audiopluginsutilstest.cpp index da5910410d5bb..bab71f54eee94 100644 --- a/src/framework/audio/tests/audioutilstest.cpp +++ b/src/framework/audioplugins/tests/audiopluginsutilstest.cpp @@ -22,18 +22,19 @@ #include -#include "audio/audioutils.h" +#include "audioplugins/internal/audiopluginsutils.h" +#include "audioplugins/audiopluginstypes.h" -using namespace muse::audio; +using namespace muse::audioplugins; -namespace muse::audio { -class Audio_AudioUtilsTest : public ::testing::Test +namespace muse::audioplugins { +class AudioPlugins_AudioUtilsTest : public ::testing::Test { public: }; } -TEST_F(Audio_AudioUtilsTest, AudioPluginTypeFromCategoriesString) +TEST_F(AudioPlugins_AudioUtilsTest, AudioPluginTypeFromCategoriesString) { EXPECT_EQ(AudioPluginType::Fx, audioPluginTypeFromCategoriesString(u"Fx|Delay")); EXPECT_EQ(AudioPluginType::Fx, audioPluginTypeFromCategoriesString(u"Test|Fx")); diff --git a/src/framework/audio/tests/knownaudiopluginsregistertest.cpp b/src/framework/audioplugins/tests/knownaudiopluginsregistertest.cpp similarity index 95% rename from src/framework/audio/tests/knownaudiopluginsregistertest.cpp rename to src/framework/audioplugins/tests/knownaudiopluginsregistertest.cpp index 54007843a33a5..2187b6b237344 100644 --- a/src/framework/audio/tests/knownaudiopluginsregistertest.cpp +++ b/src/framework/audioplugins/tests/knownaudiopluginsregistertest.cpp @@ -24,27 +24,28 @@ #include "global/serialization/json.h" -#include "internal/plugins/knownaudiopluginsregister.h" +#include "audioplugins/internal/knownaudiopluginsregister.h" #include "global/tests/mocks/filesystemmock.h" -#include "tests/mocks/audioconfigurationmock.h" +#include "mocks/audiopluginsconfigurationmock.h" using ::testing::_; using ::testing::Return; using namespace muse; +using namespace muse::audioplugins; using namespace muse::audio; using namespace muse::io; -namespace muse::audio { -class Audio_KnownAudioPluginsRegisterTest : public ::testing::Test +namespace muse::audioplugins { +class AudioPlugins_KnownAudioPluginsRegisterTest : public ::testing::Test { protected: void SetUp() override { m_knownPlugins = std::make_shared(); m_fileSystem = std::make_shared(); - m_configuration = std::make_shared(); + m_configuration = std::make_shared(); m_knownPlugins->fileSystem.set(m_fileSystem); m_knownPlugins->configuration.set(m_configuration); @@ -148,7 +149,7 @@ class Audio_KnownAudioPluginsRegisterTest : public ::testing::Test std::shared_ptr m_knownPlugins; std::shared_ptr m_fileSystem; - std::shared_ptr m_configuration; + std::shared_ptr m_configuration; path_t m_knownAudioPluginsFilePath; }; @@ -165,7 +166,7 @@ inline bool operator==(const AudioPluginInfo& info1, const AudioPluginInfo& info } } -TEST_F(Audio_KnownAudioPluginsRegisterTest, PluginInfoList) +TEST_F(AudioPlugins_KnownAudioPluginsRegisterTest, PluginInfoList) { // [GIVEN] All known plugins std::vector expectedPluginInfoList = setupTestData(); diff --git a/src/framework/audio/tests/mocks/audiopluginmetareadermock.h b/src/framework/audioplugins/tests/mocks/audiopluginmetareadermock.h similarity index 75% rename from src/framework/audio/tests/mocks/audiopluginmetareadermock.h rename to src/framework/audioplugins/tests/mocks/audiopluginmetareadermock.h index 310d5917a6a47..a8a461f966d83 100644 --- a/src/framework/audio/tests/mocks/audiopluginmetareadermock.h +++ b/src/framework/audioplugins/tests/mocks/audiopluginmetareadermock.h @@ -19,20 +19,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_AUDIOPLUGINMETAREADERMOCK_H -#define MUSE_AUDIO_AUDIOPLUGINMETAREADERMOCK_H +#pragma once #include -#include "audio/iaudiopluginmetareader.h" +#include "audioplugins/iaudiopluginmetareader.h" -namespace muse::audio { +namespace muse::audioplugins { class AudioPluginMetaReaderMock : public IAudioPluginMetaReader { public: MOCK_METHOD(bool, canReadMeta, (const io::path_t&), (const, override)); - MOCK_METHOD(RetVal, readMeta, (const io::path_t&), (const, override)); + MOCK_METHOD(RetVal, readMeta, (const io::path_t&), (const, override)); }; } - -#endif // MUSE_AUDIO_AUDIOPLUGINMETAREADERMOCK_H diff --git a/src/framework/audio/tests/mocks/audiopluginmetareaderregistermock.h b/src/framework/audioplugins/tests/mocks/audiopluginmetareaderregistermock.h similarity index 81% rename from src/framework/audio/tests/mocks/audiopluginmetareaderregistermock.h rename to src/framework/audioplugins/tests/mocks/audiopluginmetareaderregistermock.h index f1b6275fe9ebc..8b74cbc198c7f 100644 --- a/src/framework/audio/tests/mocks/audiopluginmetareaderregistermock.h +++ b/src/framework/audioplugins/tests/mocks/audiopluginmetareaderregistermock.h @@ -19,14 +19,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_AUDIOPLUGINMETAREADERREGISTERMOCK_H -#define MUSE_AUDIO_AUDIOPLUGINMETAREADERREGISTERMOCK_H +#pragma once #include -#include "audio/iaudiopluginmetareaderregister.h" +#include "audioplugins/iaudiopluginmetareaderregister.h" -namespace muse::audio { +namespace muse::audioplugins { class AudioPluginMetaReaderRegisterMock : public IAudioPluginMetaReaderRegister { public: @@ -34,5 +33,3 @@ class AudioPluginMetaReaderRegisterMock : public IAudioPluginMetaReaderRegister MOCK_METHOD(void, registerReader, (IAudioPluginMetaReaderPtr), (override)); }; } - -#endif // MUSE_AUDIO_AUDIOPLUGINMETAREADERREGISTERMOCK_H diff --git a/src/framework/audioplugins/tests/mocks/audiopluginsconfigurationmock.h b/src/framework/audioplugins/tests/mocks/audiopluginsconfigurationmock.h new file mode 100644 index 0000000000000..b8fb4b0280b43 --- /dev/null +++ b/src/framework/audioplugins/tests/mocks/audiopluginsconfigurationmock.h @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-CLA-applies + * + * MuseScore + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore BVBA and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include + +#include "audioplugins/iaudiopluginsconfiguration.h" + +namespace muse::audioplugins { +class AudioPluginsConfigurationMock : public IAudioPluginsConfiguration +{ +public: + + MOCK_METHOD(io::path_t, knownAudioPluginsFilePath, (), (const, override)); +}; +} diff --git a/src/framework/audio/tests/mocks/audiopluginsscannermock.h b/src/framework/audioplugins/tests/mocks/audiopluginsscannermock.h similarity index 82% rename from src/framework/audio/tests/mocks/audiopluginsscannermock.h rename to src/framework/audioplugins/tests/mocks/audiopluginsscannermock.h index 04728591e4b8d..87a97aa6eb0d0 100644 --- a/src/framework/audio/tests/mocks/audiopluginsscannermock.h +++ b/src/framework/audioplugins/tests/mocks/audiopluginsscannermock.h @@ -19,19 +19,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_AUDIOPLUGINSSCANNERMOCK_H -#define MUSE_AUDIO_AUDIOPLUGINSSCANNERMOCK_H +#pragma once #include -#include "audio/iaudiopluginsscanner.h" +#include "audioplugins/iaudiopluginsscanner.h" -namespace muse::audio { +namespace muse::audioplugins { class AudioPluginsScannerMock : public IAudioPluginsScanner { public: MOCK_METHOD(io::paths_t, scanPlugins, (), (const, override)); }; } - -#endif // MUSE_AUDIO_AUDIOPLUGINSSCANNERMOCK_H diff --git a/src/framework/audio/tests/mocks/audiopluginsscannerregistermock.h b/src/framework/audioplugins/tests/mocks/audiopluginsscannerregistermock.h similarity index 81% rename from src/framework/audio/tests/mocks/audiopluginsscannerregistermock.h rename to src/framework/audioplugins/tests/mocks/audiopluginsscannerregistermock.h index a6c4c0045a8f3..06dce4e388856 100644 --- a/src/framework/audio/tests/mocks/audiopluginsscannerregistermock.h +++ b/src/framework/audioplugins/tests/mocks/audiopluginsscannerregistermock.h @@ -19,14 +19,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_AUDIOPLUGINSCANNERREGISTERMOCK_H -#define MUSE_AUDIO_AUDIOPLUGINSCANNERREGISTERMOCK_H +#pragma once #include -#include "audio/iaudiopluginsscannerregister.h" +#include "audioplugins/iaudiopluginsscannerregister.h" -namespace muse::audio { +namespace muse::audioplugins { class AudioPluginsScannerRegisterMock : public IAudioPluginsScannerRegister { public: @@ -34,5 +33,3 @@ class AudioPluginsScannerRegisterMock : public IAudioPluginsScannerRegister MOCK_METHOD(void, registerScanner, (IAudioPluginsScannerPtr), (override)); }; } - -#endif // MUSE_AUDIO_AUDIOPLUGINSCANNERREGISTERMOCK_H diff --git a/src/framework/audio/tests/mocks/knownaudiopluginsregistermock.h b/src/framework/audioplugins/tests/mocks/knownaudiopluginsregistermock.h similarity index 71% rename from src/framework/audio/tests/mocks/knownaudiopluginsregistermock.h rename to src/framework/audioplugins/tests/mocks/knownaudiopluginsregistermock.h index 9a1737f719a39..25ce1b5260713 100644 --- a/src/framework/audio/tests/mocks/knownaudiopluginsregistermock.h +++ b/src/framework/audioplugins/tests/mocks/knownaudiopluginsregistermock.h @@ -19,28 +19,25 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef MUSE_AUDIO_KNOWNAUDIOPLUGINSREGISTERMOCK_H -#define MUSE_AUDIO_KNOWNAUDIOPLUGINSREGISTERMOCK_H +#pragma once #include -#include "audio/iknownaudiopluginsregister.h" +#include "audioplugins/iknownaudiopluginsregister.h" -namespace muse::audio { +namespace muse::audioplugins { class KnownAudioPluginsRegisterMock : public IKnownAudioPluginsRegister { public: MOCK_METHOD(Ret, load, (), (override)); MOCK_METHOD(std::vector, pluginInfoList, (PluginInfoAccepted), (const, override)); - MOCK_METHOD(const io::path_t&, pluginPath, (const AudioResourceId&), (const, override)); + MOCK_METHOD(const io::path_t&, pluginPath, (const audio::AudioResourceId&), (const, override)); MOCK_METHOD(bool, exists, (const io::path_t&), (const, override)); - MOCK_METHOD(bool, exists, (const AudioResourceId&), (const, override)); + MOCK_METHOD(bool, exists, (const audio::AudioResourceId&), (const, override)); MOCK_METHOD(Ret, registerPlugin, (const AudioPluginInfo&), (override)); - MOCK_METHOD(Ret, unregisterPlugin, (const AudioResourceId&), (override)); + MOCK_METHOD(Ret, unregisterPlugin, (const audio::AudioResourceId&), (override)); }; } - -#endif // MUSE_AUDIO_KNOWNAUDIOPLUGINSREGISTERMOCK_H diff --git a/src/framework/audio/tests/registeraudiopluginsscenariotest.cpp b/src/framework/audioplugins/tests/registeraudiopluginsscenariotest.cpp similarity index 92% rename from src/framework/audio/tests/registeraudiopluginsscenariotest.cpp rename to src/framework/audioplugins/tests/registeraudiopluginsscenariotest.cpp index d3b84a402391d..59b865a3cd964 100644 --- a/src/framework/audio/tests/registeraudiopluginsscenariotest.cpp +++ b/src/framework/audioplugins/tests/registeraudiopluginsscenariotest.cpp @@ -22,16 +22,16 @@ #include -#include "audio/internal/plugins/registeraudiopluginsscenario.h" +#include "audioplugins/internal/registeraudiopluginsscenario.h" #include "global/tests/mocks/globalconfigurationmock.h" #include "global/tests/mocks/interactivemock.h" #include "global/tests/mocks/processmock.h" -#include "audio/tests/mocks/knownaudiopluginsregistermock.h" -#include "audio/tests/mocks/audiopluginsscannerregistermock.h" -#include "audio/tests/mocks/audiopluginsscannermock.h" -#include "audio/tests/mocks/audiopluginmetareaderregistermock.h" -#include "audio/tests/mocks/audiopluginmetareadermock.h" +#include "mocks/knownaudiopluginsregistermock.h" +#include "mocks/audiopluginsscannerregistermock.h" +#include "mocks/audiopluginsscannermock.h" +#include "mocks/audiopluginmetareaderregistermock.h" +#include "mocks/audiopluginmetareadermock.h" #include "translation.h" @@ -41,10 +41,11 @@ using ::testing::ReturnRef; using namespace muse; using namespace muse::audio; +using namespace muse::audioplugins; using namespace muse::io; -namespace muse::audio { -class Audio_RegisterAudioPluginsScenarioTest : public ::testing::Test +namespace muse::audioplugins { +class AudioPlugins_RegisterAudioPluginsScenarioTest : public ::testing::Test { protected: void SetUp() override @@ -101,7 +102,7 @@ inline bool operator==(const AudioPluginInfo& info1, const AudioPluginInfo& info } } -TEST_F(Audio_RegisterAudioPluginsScenarioTest, Init) +TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, Init) { // [THEN] The register is inited EXPECT_CALL(*m_knownPlugins, load()) @@ -111,7 +112,7 @@ TEST_F(Audio_RegisterAudioPluginsScenarioTest, Init) m_scenario->init(); } -TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterNewPlugins) +TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, RegisterNewPlugins) { // [GIVEN] All found plugins paths_t foundPluginPaths = { @@ -195,7 +196,7 @@ TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterNewPlugins) EXPECT_TRUE(ret); } -TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterNewPlugins_NoNewPlugins) +TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, RegisterNewPlugins_NoNewPlugins) { // [GIVEN] All found plugins (all are already registered) paths_t foundPluginPaths = { @@ -234,7 +235,7 @@ TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterNewPlugins_NoNewPlugins) EXPECT_TRUE(ret); } -TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterPlugin) +TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, RegisterPlugin) { // [GIVEN] Some plugin we want to register path_t pluginPath = "/some/test/path/to/plugin/AAA.vst3"; @@ -281,7 +282,7 @@ TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterPlugin) EXPECT_TRUE(ret); } -TEST_F(Audio_RegisterAudioPluginsScenarioTest, RegisterFailedPlugin) +TEST_F(AudioPlugins_RegisterAudioPluginsScenarioTest, RegisterFailedPlugin) { // [GIVEN] Some incompatible plugin we want to register path_t pluginPath = "/some/test/path/to/plugin/AAA.vst3"; diff --git a/src/framework/vst/internal/fx/vstfxprocessor.cpp b/src/framework/vst/internal/fx/vstfxprocessor.cpp index 05b9b036aab81..d0830527cb0ce 100644 --- a/src/framework/vst/internal/fx/vstfxprocessor.cpp +++ b/src/framework/vst/internal/fx/vstfxprocessor.cpp @@ -25,6 +25,7 @@ using namespace muse; using namespace muse::vst; using namespace muse::audio; +using namespace muse::audioplugins; VstFxProcessor::VstFxProcessor(VstPluginPtr&& pluginPtr, const AudioFxParams& params) : m_pluginPtr(pluginPtr), diff --git a/src/framework/vst/internal/synth/vstsynthesiser.cpp b/src/framework/vst/internal/synth/vstsynthesiser.cpp index 7b85e5cdda86d..748d3df8193f9 100644 --- a/src/framework/vst/internal/synth/vstsynthesiser.cpp +++ b/src/framework/vst/internal/synth/vstsynthesiser.cpp @@ -29,6 +29,7 @@ using namespace muse; using namespace muse::vst; using namespace muse::audio::synth; using namespace muse::audio; +using namespace muse::audioplugins; static const std::set SUPPORTED_CONTROLLERS = { Steinberg::Vst::kCtrlVolume, diff --git a/src/framework/vst/internal/vstaudioclient.cpp b/src/framework/vst/internal/vstaudioclient.cpp index 5a25152f9a54c..7baa7e8111256 100644 --- a/src/framework/vst/internal/vstaudioclient.cpp +++ b/src/framework/vst/internal/vstaudioclient.cpp @@ -27,6 +27,7 @@ using namespace muse; using namespace muse::vst; using namespace muse::mpe; using namespace muse::audio; +using namespace muse::audioplugins; static size_t noteEventKey(int pitch, int channel) { diff --git a/src/framework/vst/internal/vstaudioclient.h b/src/framework/vst/internal/vstaudioclient.h index f1fda7ce745d3..287f4bf33b1c6 100644 --- a/src/framework/vst/internal/vstaudioclient.h +++ b/src/framework/vst/internal/vstaudioclient.h @@ -22,7 +22,7 @@ #ifndef MUSE_VST_VSTAUDIOCLIENT_H #define MUSE_VST_VSTAUDIOCLIENT_H -#include "audio/audiotypes.h" +#include "audioplugins/audiopluginstypes.h" #include "vstplugin.h" #include "vsttypes.h" @@ -34,7 +34,7 @@ class VstAudioClient VstAudioClient() = default; ~VstAudioClient(); - void init(muse::audio::AudioPluginType type, VstPluginPtr plugin, muse::audio::audioch_t audioChannelsCount = 2); + void init(audioplugins::AudioPluginType type, VstPluginPtr plugin, muse::audio::audioch_t audioChannelsCount = 2); void loadSupportedParams(); @@ -103,8 +103,8 @@ class VstAudioClient bool m_needUnprepareProcessData = false; - muse::audio::AudioPluginType m_type = muse::audio::AudioPluginType::Undefined; - muse::audio::audioch_t m_audioChannelsCount = 0; + audioplugins::AudioPluginType m_type = audioplugins::AudioPluginType::Undefined; + audio::audioch_t m_audioChannelsCount = 0; }; } diff --git a/src/framework/vst/internal/vstmodulesrepository.cpp b/src/framework/vst/internal/vstmodulesrepository.cpp index 8d7ceeb82c829..a80949b8ada09 100644 --- a/src/framework/vst/internal/vstmodulesrepository.cpp +++ b/src/framework/vst/internal/vstmodulesrepository.cpp @@ -104,7 +104,7 @@ muse::audio::AudioResourceMetaList VstModulesRepository::instrumentModulesMeta() std::lock_guard lock(m_mutex); - return modulesMetaList(muse::audio::AudioPluginType::Instrument); + return modulesMetaList(audioplugins::AudioPluginType::Instrument); } muse::audio::AudioResourceMetaList VstModulesRepository::fxModulesMeta() const @@ -113,23 +113,23 @@ muse::audio::AudioResourceMetaList VstModulesRepository::fxModulesMeta() const std::lock_guard lock(m_mutex); - return modulesMetaList(muse::audio::AudioPluginType::Fx); + return modulesMetaList(audioplugins::AudioPluginType::Fx); } void VstModulesRepository::refresh() { } -muse::audio::AudioResourceMetaList VstModulesRepository::modulesMetaList(const muse::audio::AudioPluginType& type) const +muse::audio::AudioResourceMetaList VstModulesRepository::modulesMetaList(const audioplugins::AudioPluginType& type) const { - auto infoAccepted = [type](const muse::audio::AudioPluginInfo& info) { + auto infoAccepted = [type](const audioplugins::AudioPluginInfo& info) { return info.type == type && info.meta.type == muse::audio::AudioResourceType::VstPlugin && info.enabled; }; - std::vector infoList = knownPlugins()->pluginInfoList(infoAccepted); + std::vector infoList = knownPlugins()->pluginInfoList(infoAccepted); muse::audio::AudioResourceMetaList result; - for (const muse::audio::AudioPluginInfo& info : infoList) { + for (const audioplugins::AudioPluginInfo& info : infoList) { result.push_back(info.meta); } diff --git a/src/framework/vst/internal/vstmodulesrepository.h b/src/framework/vst/internal/vstmodulesrepository.h index aa13035bbb75d..1d4a22ebe62d3 100644 --- a/src/framework/vst/internal/vstmodulesrepository.h +++ b/src/framework/vst/internal/vstmodulesrepository.h @@ -29,16 +29,16 @@ #include "ivstmodulesrepository.h" #include "modularity/ioc.h" -#include "audio/iknownaudiopluginsregister.h" +#include "audioplugins/iknownaudiopluginsregister.h" #include "audio/iaudiothreadsecurer.h" -#include "audio/audiotypes.h" +#include "audioplugins/audiopluginstypes.h" #include "vsttypes.h" namespace muse::vst { class VstModulesRepository : public IVstModulesRepository { - INJECT(muse::audio::IKnownAudioPluginsRegister, knownPlugins) + INJECT(audioplugins::IKnownAudioPluginsRegister, knownPlugins) INJECT_STATIC(muse::audio::IAudioThreadSecurer, threadSecurer) public: @@ -52,17 +52,17 @@ class VstModulesRepository : public IVstModulesRepository void addPluginModule(const muse::audio::AudioResourceId& resourceId) override; void removePluginModule(const muse::audio::AudioResourceId& resourceId) override; - muse::audio::AudioResourceMetaList instrumentModulesMeta() const override; - muse::audio::AudioResourceMetaList fxModulesMeta() const override; + audio::AudioResourceMetaList instrumentModulesMeta() const override; + audio::AudioResourceMetaList fxModulesMeta() const override; void refresh() override; private: - muse::audio::AudioResourceMetaList modulesMetaList(const muse::audio::AudioPluginType& type) const; + audio::AudioResourceMetaList modulesMetaList(const audioplugins::AudioPluginType& type) const; PluginContext m_pluginContext; mutable std::mutex m_mutex; - mutable std::unordered_map m_modules; + mutable std::unordered_map m_modules; }; } diff --git a/src/framework/vst/internal/vstpluginmetareader.h b/src/framework/vst/internal/vstpluginmetareader.h index 4bdba688eee95..b20f4b3269ee5 100644 --- a/src/framework/vst/internal/vstpluginmetareader.h +++ b/src/framework/vst/internal/vstpluginmetareader.h @@ -23,10 +23,10 @@ #ifndef MUSE_VST_VSTPLUGINMETAREADER_H #define MUSE_VST_VSTPLUGINMETAREADER_H -#include "audio/iaudiopluginmetareader.h" +#include "audioplugins/iaudiopluginmetareader.h" namespace muse::vst { -class VstPluginMetaReader : public muse::audio::IAudioPluginMetaReader +class VstPluginMetaReader : public audioplugins::IAudioPluginMetaReader { public: bool canReadMeta(const io::path_t& pluginPath) const override; diff --git a/src/framework/vst/internal/vstpluginsscanner.h b/src/framework/vst/internal/vstpluginsscanner.h index aaf0532959660..d5e91e1a66347 100644 --- a/src/framework/vst/internal/vstpluginsscanner.h +++ b/src/framework/vst/internal/vstpluginsscanner.h @@ -22,14 +22,14 @@ #ifndef MUSE_VST_VSTPLUGINSSCANNER_H #define MUSE_VST_VSTPLUGINSSCANNER_H -#include "audio/iaudiopluginsscanner.h" +#include "audioplugins/iaudiopluginsscanner.h" #include "modularity/ioc.h" #include "ivstconfiguration.h" #include "io/ifilesystem.h" namespace muse::vst { -class VstPluginsScanner : public muse::audio::IAudioPluginsScanner +class VstPluginsScanner : public audioplugins::IAudioPluginsScanner { INJECT(IVstConfiguration, configuration) INJECT(io::IFileSystem, fileSystem) diff --git a/src/framework/vst/vstmodule.cpp b/src/framework/vst/vstmodule.cpp index 0c201498f8d73..4b7125f72a44d 100644 --- a/src/framework/vst/vstmodule.cpp +++ b/src/framework/vst/vstmodule.cpp @@ -25,13 +25,13 @@ #include "ui/iinteractiveuriregister.h" #include "ui/iuiengine.h" -#include "log.h" -#include "settings.h" + #include "modularity/ioc.h" #include "audio/isynthresolver.h" #include "audio/ifxresolver.h" -#include "audio/iaudiopluginsscannerregister.h" -#include "audio/iaudiopluginmetareaderregister.h" + +#include "audioplugins/iaudiopluginsscannerregister.h" +#include "audioplugins/iaudiopluginmetareaderregister.h" #include "internal/vstconfiguration.h" #include "internal/vstpluginsregister.h" @@ -45,11 +45,14 @@ #include "view/vstieditorview.h" #include "view/vstfxeditorview.h" +#include "log.h" + using namespace muse::vst; using namespace muse::modularity; using namespace muse::audio::synth; using namespace muse::audio::fx; using namespace muse::audio; +using namespace muse::audioplugins; using namespace muse::ui; static std::shared_ptr s_configuration = std::make_shared();