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

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
tracktion::engine::WaveNodeRealTime Class Referencefinal

An Node that plays back a wave file. More...

#include "tracktion_WaveNode.h"

Inheritance diagram for tracktion::engine::WaveNodeRealTime:
tracktion::graph::Node tracktion::engine::TracktionEngineNode tracktion::engine::DynamicallyOffsettableNodeBase

Public Types

enum class  ReadAhead : bool { no , yes }
 Whether or not to use a background thread to read ahead the time-stretch buffer. More...
 
enum class  SyncTempo : bool { no , yes }
 Represets whether the file should try and match Edit tempo changes. More...
 
enum class  SyncPitch : bool { no , yes }
 Represets whether the file should try and match Edit pitch changes. More...
 

Public Member Functions

 WaveNodeRealTime (const AudioFile &, TimeRange editTime, TimeDuration offset, TimeRange loopSection, LiveClipLevel, double speedRatio, const juce::AudioChannelSet &sourceChannelsToUse, const juce::AudioChannelSet &destChannelsToFill, ProcessState &, EditItemID, bool isOfflineRender, ResamplingQuality=ResamplingQuality::lagrange, SpeedFadeDescription={}, std::optional< tempo::Sequence::Position > editTempoSequence={}, TimeStretcher::Mode=TimeStretcher::Mode::defaultMode, TimeStretcher::ElastiqueProOptions={}, float pitchChangeSemitones=0.0f, ReadAhead=ReadAhead::no)
 offset is a time added to the start of the file, e.g.
 
 WaveNodeRealTime (const AudioFile &, TimeStretcher::Mode, TimeStretcher::ElastiqueProOptions, BeatRange editTime, BeatDuration offset, BeatRange loopSection, LiveClipLevel, const juce::AudioChannelSet &sourceChannelsToUse, const juce::AudioChannelSet &destChannelsToFill, ProcessState &, EditItemID, bool isOfflineRender, ResamplingQuality, SpeedFadeDescription, std::optional< tempo::Sequence::Position > editTempoSequence, std::optional< WarpMap >, tempo::Sequence sourceFileTempoMap, SyncTempo, SyncPitch, std::optional< tempo::Sequence > chordPitchSequence, float pitchChangeSemitones=1.0f, ReadAhead=ReadAhead::no)
 
void setDynamicOffsetBeats (BeatDuration) override
 Sets an offset to be applied to all times in this node, effectively shifting it forwards or backwards in time.
 
graph::NodeProperties getNodeProperties () override
 Should return the properties of the node.
 
void prepareToPlay (const graph::PlaybackInitialisationInfo &) override
 Called once before playback begins for each node.
 
bool isReadyToProcess () override
 Should return true when this node is ready to be processed.
 
void process (ProcessContext &) override
 Called when the node is to be processed.
 
- Public Member Functions inherited from tracktion::graph::Node
void initialise (const PlaybackInitialisationInfo &)
 Call once after the graph has been constructed to initialise buffers etc.
 
void prepareForNextBlock (juce::Range< int64_t > referenceSampleRange)
 Call before processing the next block, used to reset the process status.
 
void process (choc::buffer::FrameCount numSamples, juce::Range< int64_t > referenceSampleRange)
 Call to process the node, which will in turn call the process method with the buffers to fill.
 
bool hasProcessed () const
 Returns true if this node has processed and its outputs can be retrieved.
 
AudioAndMidiBuffer getProcessedOutput ()
 Returns the processed audio and MIDI output.
 
virtual TransformResult transform (Node &, const std::vector< Node * > &, TransformCache &)
 Called after construction to give the node a chance to modify its topology.
 
virtual std::vector< Node * > getDirectInputNodes ()
 Should return all the inputs directly feeding in to this node.
 
virtual std::vector< Node * > getInternalNodes ()
 Can return Nodes that are internal to this Node but don't make up the main graph constructed from getDirectInputNodes().
 
void retain ()
 Retains the buffers so they won't be deallocated after the Node has processed.
 
void release ()
 Releases the buffers allowing internal storage to be deallocated.
 
virtual size_t getAllocatedBytes () const
 
void enablePreProcess (bool)
 
- Public Member Functions inherited from tracktion::engine::TracktionEngineNode
 TracktionEngineNode (ProcessState &)
 Creates a TracktionEngineNode.
 
virtual ~TracktionEngineNode ()=default
 Destructor.
 
int getNumSamples () const
 Returns the number of samples in the current process block.
 
double getSampleRate () const
 Returns the sample rate of the current process block.
 
juce::Range< int64_tgetTimelineSampleRange () const
 Returns the timeline sample range of the current process block.
 
TimeRange getEditTimeRange () const
 Returns the edit time range of the current process block.
 
BeatRange getEditBeatRange () const
 Returns the edit beat range of the current process block.
 
juce::Range< int64_tgetReferenceSampleRange () const
 Returns the reference sample range (from the DeviceManager) of the current process block.
 
tempo::Key getKey () const
 Returns the key of the current process block.
 
double getPlaybackSpeedRatio () const
 Returns the playback speed ratio of the current process block.
 
std::optional< TimePositiongetTimeOfNextChange () const
 May return the time of the next tempo or time sig change.
 
std::optional< BeatPositiongetBeatOfNextChange () const
 May return the time of the next tempo or time sig change.
 
tracktion::graph::PlayHeadStategetPlayHeadState ()
 Returns the PlayHeadState in use.
 
tracktion::graph::PlayHeadgetPlayHead ()
 Returns the PlayHead in use.
 
ProcessStategetProcessState ()
 Returns the ProcessState in use.
 
void setProcessState (ProcessState &)
 
- Public Member Functions inherited from tracktion::engine::DynamicallyOffsettableNodeBase
virtual void setDynamicOffsetTime (TimeDuration)
 Sets an offset to be applied to all times in this node, effectively shifting it forwards or backwards in time.
 

Additional Inherited Members

- Public Attributes inherited from tracktion::graph::Node
void * internal
 
int numOutputNodes
 
- Protected Member Functions inherited from tracktion::graph::Node
virtual void prefetchBlock (juce::Range< int64_t >)
 Called before once on all Nodes before they are processed.
 
virtual void preProcess (choc::buffer::FrameCount, juce::Range< int64_t >)
 Called when the node is to be processed, just before process.
 
void setOptimisations (NodeOptimisations)
 This can be called to provide some hints about allocating or playing back a Node to improve efficiency.
 
void setBufferViewToUse (Node *sourceNode, const choc::buffer::ChannelArrayView< float > &)
 This can be called during prepareToPlay to set a BufferView to use which can improve efficiency.
 
void setAudioOutput (Node *sourceNode, const choc::buffer::ChannelArrayView< float > &)
 This can be called during your process function to set a view to the output.
 

Detailed Description

An Node that plays back a wave file.

Definition at line 99 of file tracktion_WaveNode.h.

Member Enumeration Documentation

◆ ReadAhead

Whether or not to use a background thread to read ahead the time-stretch buffer.

Definition at line 106 of file tracktion_WaveNode.h.

◆ SyncPitch

Represets whether the file should try and match Edit pitch changes.

Definition at line 136 of file tracktion_WaveNode.h.

◆ SyncTempo

Represets whether the file should try and match Edit tempo changes.

Definition at line 133 of file tracktion_WaveNode.h.

Constructor & Destructor Documentation

◆ WaveNodeRealTime() [1/2]

tracktion::engine::WaveNodeRealTime::WaveNodeRealTime ( const AudioFile af,
TimeRange  editTime,
TimeDuration  offset,
TimeRange  loopSection,
LiveClipLevel  level,
double  speedRatio,
const juce::AudioChannelSet sourceChannelsToUse,
const juce::AudioChannelSet destChannelsToFill,
ProcessState ps,
EditItemID  itemIDToUse,
bool  isOfflineRender,
ResamplingQuality  resamplingQualityToUse = ResamplingQuality::lagrange,
SpeedFadeDescription  speedDesc = {},
std::optional< tempo::Sequence::Position editTempoSequence = {},
TimeStretcher::Mode  mode = TimeStretcher::Mode::defaultMode,
TimeStretcher::ElastiqueProOptions  options = {},
float  pitchChangeSemitones = 0.0f,
ReadAhead  readAhead_ = ReadAhead::no 
)

offset is a time added to the start of the file, e.g.

an offset of 10.0 would produce ten seconds of silence followed by the file.

Definition at line 1757 of file tracktion_WaveNode.cpp.

◆ WaveNodeRealTime() [2/2]

tracktion::engine::WaveNodeRealTime::WaveNodeRealTime ( const AudioFile af,
TimeStretcher::Mode  mode,
TimeStretcher::ElastiqueProOptions  options,
BeatRange  editTime,
BeatDuration  offset,
BeatRange  loopSection,
LiveClipLevel  level,
const juce::AudioChannelSet sourceChannelsToUse,
const juce::AudioChannelSet destChannelsToFill,
ProcessState ps,
EditItemID  itemIDToUse,
bool  isOfflineRender,
ResamplingQuality  resamplingQualityToUse,
SpeedFadeDescription  speedDesc,
std::optional< tempo::Sequence::Position editTempoSequence,
std::optional< WarpMap warp,
tempo::Sequence  sourceFileTempoMap,
SyncTempo  syncTempo_,
SyncPitch  syncPitch_,
std::optional< tempo::Sequence >  chordPitchSequence,
float  pitchChangeSemitones = 1.0f,
ReadAhead  readAhead_ = ReadAhead::no 
)
Parameters
sourceFileTempoMapA tempo map describing the changes in the source file. This is relative to the start of the file, not the positioning in the Edit. This map is also used to describe a single tempo/time sig for the file with a pair of changes at position 0. With this, the file playback will match tempo changes in the Edit.
chordPitchSequenceIf this is supplied and SyncPitch == yes, rather than syncing to the Edit's pitch sequence, it will sync to this pitch sequence.
pitchChangeSemitonesIs SyncPitch == no, then this can be used to change the pitch of the source

Definition at line 1815 of file tracktion_WaveNode.cpp.

Member Function Documentation

◆ getNodeProperties()

tracktion::graph::NodeProperties tracktion::engine::WaveNodeRealTime::getNodeProperties ( )
overridevirtual

Should return the properties of the node.

This should not be called until after initialise.

Implements tracktion::graph::Node.

Definition at line 1911 of file tracktion_WaveNode.cpp.

◆ isReadyToProcess()

bool tracktion::engine::WaveNodeRealTime::isReadyToProcess ( )
overridevirtual

Should return true when this node is ready to be processed.

This is usually when its input's output buffers are ready.

Implements tracktion::graph::Node.

Definition at line 1931 of file tracktion_WaveNode.cpp.

◆ prepareToPlay()

void tracktion::engine::WaveNodeRealTime::prepareToPlay ( const graph::PlaybackInitialisationInfo )
overridevirtual

Called once before playback begins for each node.

Use this to allocate buffers etc. This step can be used to modify the topology of the graph (i.e. add/remove nodes). However, if you do this, you must make sure to call initialise on them so they are fully prepared for processing.

Reimplemented from tracktion::graph::Node.

Definition at line 1922 of file tracktion_WaveNode.cpp.

◆ process()

void tracktion::engine::WaveNodeRealTime::process ( ProcessContext )
overridevirtual

Called when the node is to be processed.

This should add in to the buffers available making sure not to change their size at all.

Implements tracktion::graph::Node.

Definition at line 1945 of file tracktion_WaveNode.cpp.

◆ setDynamicOffsetBeats()

void tracktion::engine::WaveNodeRealTime::setDynamicOffsetBeats ( BeatDuration  newOffset)
overridevirtual

Sets an offset to be applied to all times in this node, effectively shifting it forwards or backwards in time.

Reimplemented from tracktion::engine::DynamicallyOffsettableNodeBase.

Definition at line 1901 of file tracktion_WaveNode.cpp.


The documentation for this class was generated from the following files: