Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #pragma once
24 :
25 : #include "global/modularity/ioc.h"
26 : #include "global/io/ifilesystem.h"
27 : #include "global/iglobalconfiguration.h"
28 : #include "global/serialization/json.h"
29 :
30 : #include "../iknownaudiopluginsregister.h"
31 : #include "../iknownaudiopluginsmigrationregister.h"
32 : #include "../iaudiopluginsconfiguration.h"
33 :
34 : namespace muse::audioplugins {
35 : class KnownAudioPluginsRegister : public IKnownAudioPluginsRegister
36 : {
37 : GlobalInject<IAudioPluginsConfiguration> configuration;
38 : GlobalInject<IKnownAudioPluginsMigrationRegister> migrations;
39 : GlobalInject<io::IFileSystem> fileSystem;
40 : GlobalInject<IGlobalConfiguration> globalConfiguration;
41 :
42 : friend class AudioPlugins_KnownAudioPluginsRegisterTest;
43 :
44 : public:
45 8 : KnownAudioPluginsRegister() = default;
46 :
47 : Ret load() override;
48 : Ret clear() override;
49 :
50 : AudioPluginInfoList pluginInfoList(PluginInfoAccepted accepted = PluginInfoAccepted()) const override;
51 : muse::async::Notification pluginInfoListChanged() const override;
52 :
53 : const io::path_t& pluginPath(const PluginResourceId& resourceId) const override;
54 :
55 : bool exists(const io::path_t& pluginPath) const override;
56 : bool exists(const PluginResourceId& resourceId) const override;
57 :
58 : Ret registerPlugins(const AudioPluginInfoList& list) override;
59 : Ret unregisterPlugins(const PluginResourceIdList& resourceIds) override;
60 :
61 : Ret setPluginsState(const io::paths_t& paths, AudioPluginState state) override;
62 :
63 : Ret removePluginsAtPath(const io::path_t& path) override;
64 :
65 : Ret writePluginsTo(const io::path_t& file, const AudioPluginInfoList& list) const override;
66 : RetVal<AudioPluginInfoList> readPluginsFrom(const io::path_t& file) const override;
67 :
68 : private:
69 : Ret writePluginsInfo();
70 : async::Notification m_pluginInfoListChanged;
71 : bool m_loaded = false;
72 : std::multimap<PluginResourceId, AudioPluginInfo> m_pluginInfoMap;
73 : std::set<io::path_t> m_pluginPaths;
74 : std::vector<JsonObject> m_ignoredEntries;
75 : };
76 : }
|