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 : #include "trackchain.h"
24 :
25 : using namespace muse;
26 : using namespace muse::audio;
27 : using namespace muse::audio::engine;
28 :
29 0 : TrackChain::TrackChain(TrackId trackId, const std::string& trackName)
30 0 : : m_trackId(trackId), m_trackName(trackName)
31 : {
32 0 : setName(std::string(TrackChainTag::name) + "[" + m_trackName + "]");
33 0 : }
34 :
35 0 : void TrackChain::rebuild()
36 : {
37 0 : clear();
38 :
39 0 : if (m_signal) {
40 0 : doAdd(m_signal);
41 : }
42 0 : if (m_control) {
43 0 : doAdd(m_control);
44 : }
45 0 : if (m_fxChain) {
46 0 : doAdd(m_fxChain);
47 : }
48 0 : if (m_source) {
49 0 : doAdd(m_source);
50 : }
51 :
52 0 : ChainNode<TrackChainTag>::rebuild();
53 0 : }
54 :
55 0 : TrackId TrackChain::trackId() const
56 : {
57 0 : return m_trackId;
58 : }
59 :
60 0 : const std::string& TrackChain::trackName() const
61 : {
62 0 : return m_trackName;
63 : }
64 :
65 0 : void TrackChain::setSource(IAudioNodePtr source)
66 : {
67 0 : clear();
68 0 : m_source = source;
69 0 : }
70 :
71 0 : IAudioNodePtr TrackChain::source() const
72 : {
73 0 : return m_source;
74 : }
75 :
76 0 : void TrackChain::setFxChain(FxChainPtr fxChain)
77 : {
78 0 : clear();
79 0 : m_fxChain = fxChain;
80 0 : }
81 :
82 0 : FxChainPtr TrackChain::fxChain() const
83 : {
84 0 : return m_fxChain;
85 : }
86 :
87 0 : void TrackChain::setControl(AutomationControlNodePtr controlNode)
88 : {
89 0 : clear();
90 0 : m_control = controlNode;
91 0 : }
92 :
93 0 : AutomationControlNodePtr TrackChain::control() const
94 : {
95 0 : return m_control;
96 : }
97 :
98 0 : void TrackChain::setSignal(SignalNodePtr signalNode)
99 : {
100 0 : clear();
101 0 : m_signal = signalNode;
102 0 : }
103 :
104 0 : SignalNodePtr TrackChain::signal() const
105 : {
106 0 : return m_signal;
107 : }
|