tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_AuxSendNode.cpp
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11#pragma once
12
13namespace tracktion { inline namespace engine
14{
15
17 AuxSendPlugin& sourceSendPlugin, tracktion::graph::PlayHeadState& phs,
18 const TrackMuteState* trackMuteState, bool processAuxSendsWhenTrackIsMuted)
19 : SendNode (std::move (inputNode), busIDToUse,
20 [&sourceSendPlugin, trackMuteState, processAuxSendsWhenTrackIsMuted]
21 {
22 if (processAuxSendsWhenTrackIsMuted)
23 {
24 if (trackMuteState
25 && ! trackMuteState->shouldTrackBeAudible()
26 && ! trackMuteState->shouldTrackContentsBeProcessed())
27 return 0.0f;
28 }
29 else
30 {
31 if (trackMuteState
32 && (! trackMuteState->shouldTrackBeAudible()
33 || ! trackMuteState->shouldTrackContentsBeProcessed()))
34 return 0.0f;
35 }
36
37 auto gain = volumeFaderPositionToGain (sourceSendPlugin.gain->getCurrentValue());
38 if (sourceSendPlugin.invertPhase)
39 gain *= -1.0f;
40
41 return gain;
42 }),
43 playHeadState (phs),
44 pluginPtr (sourceSendPlugin),
45 sendPlugin (sourceSendPlugin)
46{
47 jassert (pluginPtr != nullptr);
48}
49
50//==============================================================================
52{
53 if (cachedNodeProperties)
54 return *cachedNodeProperties;
55
56 auto props = SendNode::getNodeProperties();
57
58 if (isPrepared)
59 cachedNodeProperties = props;
60
61 return props;
62}
63
65{
66 sampleRate = info.sampleRate;
67
68 if (auto props = getNodeProperties(); props.latencyNumSamples > 0)
69 automationAdjustmentTime = TimeDuration::fromSamples (-props.latencyNumSamples, sampleRate);
70
71 isPrepared = true;
72}
73
75{
76 if (sendPlugin.isAutomationNeeded()
78 {
79 const auto editSamplePos = playHeadState.playHead.referenceSamplePositionToTimelinePosition (pc.referenceSampleRange.getStart());
80 const auto editTime = TimePosition::fromSamples (editSamplePos, sampleRate) + automationAdjustmentTime;
81 sendPlugin.updateParameterStreams (editTime);
82 }
83
85}
86
87}} // namespace tracktion { inline namespace engine
constexpr ValueType getStart() const noexcept
void updateParameterStreams(TimePosition)
Updates all the parameter streams to their positions at this time.
bool isReadingAutomation() const noexcept
Toggles automation playback Matches the auto play button on the transport controls.
NodeProperties getNodeProperties() override
Should return the properties of the node.
AuxSendNode(std::unique_ptr< Node > inputNode, int busIDToUse, AuxSendPlugin &, tracktion::graph::PlayHeadState &, const TrackMuteState *, bool processAuxSendsWhenTrackIsMuted)
Creates a AuxSendNode to process an aux send.
void process(ProcessContext &) override
Called when the node is to be processed.
void prepareToPlay(const tracktion::graph::PlaybackInitialisationInfo &) override
Called once before playback begins for each node.
AutomationRecordManager & getAutomationRecordManager() noexcept
Returns the AutomationRecordManager for the Edit.
Holds the state of a Track and if its contents/plugins should be played or not.
bool shouldTrackBeAudible() const
Returns true if the track's mix bus should be audible.
bool shouldTrackContentsBeProcessed() const
Returns true if the track's contents should be processed e.g.
Struct to describe a single iteration of a process call.
Determines how this block releates to other previous render blocks and if the play head has jumped in...
int64_t referenceSamplePositionToTimelinePosition(int64_t referenceSamplePosition) const
Converts a reference sample position to a timeline position.
void process(ProcessContext &pc) override
Called when the node is to be processed.
NodeProperties getNodeProperties() override
Should return the properties of the node.
#define jassert(expression)
Holds some really basic properties of a node.
Passed into Nodes when they are being initialised, to give them useful contextual information that th...