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 : #pragma once
23 :
24 : #include "audionode.h"
25 :
26 : #include "audiosourcenode.h"
27 : #include "fxchain.h"
28 : #include "automationcontrolnode.h"
29 : #include "signalnode.h"
30 :
31 : namespace muse::audio {
32 : struct TrackChainTag
33 : {
34 : static constexpr const char* name = "TrackChain";
35 : };
36 : }
37 :
38 : namespace muse::audio::engine {
39 : //! NOTE A typical node chain for processing a track:
40 : //! signalnode <- controlnode <- fxnode[] <- audiosource
41 : class TrackChain : public ChainNode<TrackChainTag>
42 : {
43 : public:
44 :
45 : TrackChain(TrackId trackId, const std::string& trackName);
46 :
47 : TrackId trackId() const;
48 : const std::string& trackName() const;
49 :
50 : void setSource(IAudioNodePtr source);
51 : IAudioNodePtr source() const;
52 :
53 : void setFxChain(FxChainPtr fxChain);
54 : FxChainPtr fxChain() const;
55 :
56 : void setControl(AutomationControlNodePtr controlNode);
57 : AutomationControlNodePtr control() const;
58 :
59 : void setSignal(SignalNodePtr signalNode);
60 : SignalNodePtr signal() const;
61 :
62 : void rebuild() override;
63 :
64 : protected:
65 :
66 0 : void doSelfProcess(float*, samples_t) override {}
67 :
68 : TrackId m_trackId = INVALID_TRACK_ID;
69 : std::string m_trackName;
70 :
71 : IAudioNodePtr m_source;
72 : FxChainPtr m_fxChain;
73 : AutomationControlNodePtr m_control;
74 : SignalNodePtr m_signal;
75 : };
76 :
77 : using TrackChainPtr = std::shared_ptr<TrackChain>;
78 : }
|