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) 2026 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/imoduleinterface.h"
26 : #include "global/types/retval.h"
27 : #include "mpe/events.h"
28 : #include "../isynthesizer.h"
29 : #include "nodes/audiosourcenode.h"
30 : #include "nodes/fxchain.h"
31 :
32 : namespace muse::audio::engine {
33 : class IAudioFactory : MODULE_GLOBAL_INTERFACE
34 : {
35 0 : INTERFACE_ID(IAudioFactory)
36 :
37 : public:
38 0 : virtual ~IAudioFactory() = default;
39 :
40 : // Available resources
41 : virtual AudioResourceMetaList availableInputResources() const = 0;
42 : virtual SoundPresetList availableSoundPresets(const AudioResourceMeta& resourceMeta) const = 0;
43 : virtual AudioResourceMetaList availableOutputResources() const = 0;
44 :
45 : // Make audio sources
46 : virtual RetVal<synth::ISynthesizerPtr> makeSynth(const TrackId trackId, const AudioInputParams& params,
47 : const PlaybackSetupData& setupData) const = 0;
48 :
49 : virtual RetVal<synth::ISynthesizerPtr> makeDefaultSynth(const TrackId trackId) const = 0;
50 :
51 : //! NOTE For internal purposes,
52 : // created synth instances are registered in an internal registry (see VST).
53 : // This method clears this registry.
54 : virtual void clearSynthSources() = 0;
55 :
56 : virtual RetVal<AudioSourceNodePtr> makeEventSource(const TrackId trackId, const mpe::PlaybackData& playbackData,
57 : const AudioInputParams& params,
58 : const std::function<void()> onOffStreamReceived = nullptr) const = 0;
59 : // Make FX
60 : virtual FxChainPtr makeMasterFxChain(const AudioFxChain& fxChain) const = 0;
61 : virtual FxChainPtr makeTrackFxChain(const TrackId trackId, const AudioFxChain& fxChain) const = 0;
62 :
63 : //! NOTE For internal purposes,
64 : // created effect instances are registered in an internal registry (see VST).
65 : // This method clears this registry.
66 : virtual void clearAllFx() = 0;
67 : };
68 : }
|