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 <memory>
26 :
27 : #include "modularity/imodulesetup.h"
28 : #include "global/ticker.h"
29 :
30 : namespace muse::audio::engine {
31 : class EngineGlobalSetup;
32 : }
33 :
34 : namespace muse::audio::rpc {
35 : class IRpcChannel;
36 : }
37 :
38 : namespace muse::audio {
39 : class AudioConfiguration;
40 : class AudioActionsController;
41 : class TransportEventsController;
42 : class StartAudioController;
43 : class Playback;
44 : class ISoundFontController;
45 : class AudioDriverController;
46 : class AudioModule : public modularity::IModuleSetup
47 : {
48 : public:
49 : AudioModule();
50 :
51 : std::string moduleName() const override;
52 :
53 : void registerExports() override;
54 : void resolveImports() override;
55 :
56 : void onInit(const IApplication::RunMode& mode) override;
57 : void onDeinit() override;
58 :
59 : modularity::IContextSetup* newContext(const muse::modularity::ContextPtr& ctx) const override;
60 :
61 : private:
62 : std::shared_ptr<AudioConfiguration> m_configuration;
63 : std::shared_ptr<engine::EngineGlobalSetup> m_engineGlobalSetup;
64 : std::shared_ptr<AudioDriverController> m_audioDriverController;
65 : std::shared_ptr<ISoundFontController> m_soundFontController;
66 : std::shared_ptr<StartAudioController> m_startAudioController;
67 : std::shared_ptr<rpc::IRpcChannel> m_rpcChannel;
68 : Ticker m_rpcTicker;
69 : };
70 :
71 : class AudioContext : public modularity::IContextSetup
72 : {
73 : public:
74 0 : AudioContext(const muse::modularity::ContextPtr& ctx)
75 0 : : modularity::IContextSetup(ctx) {}
76 :
77 : void registerExports() override;
78 : void resolveImports() override;
79 : void onInit(const IApplication::RunMode& mode) override;
80 : void onDeinit() override;
81 :
82 : private:
83 : std::shared_ptr<AudioActionsController> m_actionsController;
84 : std::shared_ptr<TransportEventsController> m_transportEventsController;
85 :
86 : bool m_audioInited = false;
87 : };
88 : }
|