16namespace tracktion {
inline namespace engine
51 AudioNode* audioNodeToBeReplaced =
nullptr;
52 bool forRendering =
false;
53 bool includePlugins =
true;
54 bool addAntiDenormalisationNoise =
false;
76 int bufferStart,
int bufferSize,
78 int continuityFlags,
bool rendering) noexcept
131 lastBlockBeforeLoop = 4,
140 bool isContiguousWithPreviousBlock() const noexcept {
return (
continuity & contiguous) != 0; }
141 bool isFirstBlockOfLoop() const noexcept {
return (
continuity & firstBlockOfLoop) != 0; }
142 bool isLastBlockOfLoop() const noexcept {
return (
continuity & lastBlockBeforeLoop) != 0; }
143 bool didPlayheadJump() const noexcept {
return (
continuity & playheadJumped) != 0; }
199 virtual void visitNodes (
const VisitorFn&) = 0;
205 virtual bool isReadyToRender() = 0;
214 template <
typename CallbackType>
217 const PlayHead::EditTimeWindow editTime (rc.
getEditTime());
219 if (editTime.isSplit)
223 auto firstLen = editTime.editRange1.getLength();
227 rc2.streamTime = rc2.streamTime.withLength (firstLen);
228 rc2.bufferNumSamples = firstSamps;
229 rc2.continuity |= AudioRenderContext::lastBlockBeforeLoop;
231 target.renderSection (rc2, editTime.editRange1);
233 rc2.streamTime = { rc2.streamTime.getEnd(), rc.
streamTime.getEnd() };
234 rc2.bufferStartSample += firstSamps;
236 rc2.midiBufferOffset += firstLen;
237 rc2.continuity = AudioRenderContext::firstBlockOfLoop;
239 target.renderSection (rc2, editTime.editRange2);
245 AudioRenderContext rc2(rc);
247 auto loop = rc.
playhead.getLoopTimes();
249 auto s = editTime.editRange1.getStart();
250 auto e = editTime.editRange1.getEnd();
252 if (e >= loop.getEnd() - 0.000001)
253 rc2.continuity |= AudioRenderContext::lastBlockBeforeLoop;
254 if (s <= loop.getStart() + 0.000001)
255 rc2.continuity = AudioRenderContext::firstBlockOfLoop;
257 target.renderSection (rc2, editTime.editRange1);
261 target.renderSection (rc, editTime.editRange1);
266 void callRenderOverForMidi (
const AudioRenderContext&);
278 void visitNodes (
const VisitorFn&)
override;
281 bool isReadyToRender()
override;
302 input->renderAdding (rc);
Base class for nodes in an audio playback graph.
virtual void releaseAudioNodeResources()=0
tells the node that play has stopped, and it can free up anything it no longer needs.
virtual bool purgeSubNodes(bool keepAudio, bool keepMidi)=0
Tells the node to delete any sub-nodes that don't produce the required type of output.
virtual void prepareAudioNodeToPlay(const PlaybackInitialisationInfo &)=0
tells the node to initialise itself ready for playing from the given time.
constexpr Type jmin(Type a, Type b)
Holds some really basic properties of a node.
A collection of settings that are generally needed when asking edit model objects to create AudioNode...
Passed into AudioNodes when they are being initialised, to give them useful contextual information th...
juce::AudioChannelSet destBufferChannels
A description of the type of channels in each of the channels in destBuffer.
bool isRendering
True if the rendering is happening as part of an offline render rather than live playback.
int bufferNumSamples
The number of samples to write into the audio buffer.
void addAntiDenormalisationNoise() const noexcept
Applies low-level noise to the audio buffer.
MidiMessageArray * bufferForMidiMessages
A buffer of MIDI events to process.
void clearAll() const noexcept
Clears the active section of all channels in the audio and MIDI buffers.
int bufferStartSample
The index of the start point in the audio buffer from which data must be written.
void sanityCheck() const
Does a quick check on the bounds of various values in the structure.
PlayHead & playhead
The playhead provides information about current time, tempo etc at the block being rendered.
juce::AudioBuffer< float > * destBuffer
The target audio buffer which needs to be filled.
void clearAudioBuffer() const noexcept
Clears the active section of all channels in the audio buffer.
double midiBufferOffset
A time offset to add to the timestamp of any events in the MIDI buffer.
PlayHead::EditTimeWindow getEditTime() const
Returns the section of the edit that needs to be rendered by this block.
void clearMidiBuffer() const noexcept
Clears the active section of the MIDI buffer.
int continuity
A set of flags to indicate what the relationship is between this block and the previous one.
ContinuityFlags
Values used in the AudioRenderContext::continuity variable.
legacy::EditTimeRange streamTime
The time window which needs to be rendered into the current block.