- cinder::Noncopyable
- cinder::audio::Node
- cinder::audio::InputNode
- cinder::audio::SamplePlayerNode
- cinder::audio::BufferPlayerNode
Buffer-based SamplePlayerNode , where all samples are loaded into memory before playback.
Enums
Public Member Functions
-
BufferPlayerNode (const Format &format=Format())
Constructs a BufferPlayerNode without a buffer, with the assumption one will be set later.
Format::channels() can still be used to allocate the expected channel count ahead of time.
-
BufferPlayerNode (const BufferRef &buffer, const Format &format=Format())
Constructs a BufferPlayerNode with buffer .
Channel mode is always ChannelMode::SPECIFIED and num channels matches buffer . Format::channels() is ignored.
-
~BufferPlayerNode ()
-
voidseek (size_t readPositionFrames) override
Seek the read position to readPositionFrames .
-
voidloadBuffer (const SourceFileRef &sourceFile)
Loads and stores a reference to a Buffer created from the entire contents of sourceFile . Resets the loop points to 0: getNumFrames() ).
-
voidsetBuffer (const BufferRef &buffer)
Sets the current Buffer . Safe to do while enabled. Resets the loop points to 0: getNumFrames() ).
-
const BufferRef &getBuffer () const
returns a shared_ptr to the current Buffer .
-
voidstart ()
Starts playing the sample from the beginning.
-
voidstart (double when)
Starts playing the sample at when seconds, measured against Context::getNumProcessedSeconds() .
-
voidstop ()
Stops playing the sample, returns the read position to the beginning and disables processing.
-
voidstop (double when)
Stops playing the sample at when seconds, measured against Context::getNumProcessedSeconds() .
-
voidseekToTime (double positionSeconds)
Seek to read position readPositionSeconds ,.
-
size_tgetReadPosition () const
Returns the current read position in frames.
-
doublegetReadPositionTime () const
Returns the current read position in seconds.
-
doublegetNumSeconds () const
Returns the total number of seconds this SamplePlayerNode will play from beginning to end.
-
size_tgetNumFrames () const
Returns the total number of frames this SamplePlayerNode will play from beginning to end.
-
boolisEof () const
Returns whether the SamplePlayerNode has reached EOF (end of file). If true, isEnabled() will also return false.
-
voidsetLoopEnabled (bool b=true)
Sets whether playing continues from beginning after the end is reached (default = false)
-
boolisLoopEnabled () const
Gets whether playing continues from beginning after the end is reached (default = false)
-
voidsetLoopBegin (size_t positionFrames)
Sets the begin loop marker in frames (default = 0, max = getNumFrames() ).
-
voidsetLoopBeginTime (double positionSeconds)
Sets the begin loop marker in seconds (default = 0, max = getNumSeconds() ).
-
voidsetLoopEnd (size_t positionFrames)
Sets the end loop marker in frames (default = getNumFrames() , max = getNumFrames() ).
-
voidsetLoopEndTime (double positionSeconds)
Sets the end loop marker in seconds (default = getNumSeconds() , max = getNumSeconds() ).
-
size_tgetLoopBegin () const
Returns the begin loop marker in frames.
-
doublegetLoopBeginTime () const
Returns the begin loop marker in seconds.
-
size_tgetLoopEnd () const
Returns the end loop marker in frames.
-
doublegetLoopEndTime () const
Returns the end loop marker in seconds.
-
voidenable ()
Enables this Node for processing. Same as
setEnabled( true )
. -
voidenable (double when)
Enables this Node for processing at when seconds, measured against Context::getNumProcessedSeconds() . Same as
setEnabled( true, when )
. -
voiddisable ()
Disables this Node for processing. Same as
setEnabled( false )
. -
voiddisable (double when)
Disables this Node for processing at when seconds, measured against Context::getNumProcessedSeconds() . Same as
setEnabled( false, when )
. -
voidsetEnabled (bool b)
Sets whether this Node is enabled for processing or not.
-
voidsetEnabled (bool b, double when)
Sets whether this Node is enabled for processing or not at when seconds, measured against Context::getNumProcessedSeconds() .
-
boolisEnabled () const
Returns whether this Node is enabled for processing or not.
-
voidconnect (const NodeRef &output)
Connects this Node to output .
-
voiddisconnect (const NodeRef &output)
Disconnects this Node from output .
-
voiddisconnectAll ()
Disconnects this Node from all inputs and outputs.
-
voiddisconnectAllOutputs ()
Disconnects this Node from all outputs.
-
voiddisconnectAllInputs ()
Disconnects all of this Node 's inputs.
-
size_tgetNumConnectedInputs () const
Returns the number of inputs connected to this Node .
-
size_tgetNumConnectedOutputs () const
Returns the number of outputs this Node is connected to.
-
boolisConnectedToInput (const NodeRef &input) const
Returns true if input is connected to this Node as an input, false otherwise.
-
boolisConnectedToOutput (const NodeRef &output) const
Returns true if output is connected to this Node as an output, false otherwise.
-
size_tgetNumChannels () const
Returns the number of channels this Node will process.
-
getChannelMode () const
Returns the channel mode.
- See Also
-
size_tgetMaxNumInputChannels () const
Returns the maximum number of channels any input has.
-
size_tgetSampleRate () const
Returns the samplerate of this Node , which is governed by the Context 's OutputNode .
-
size_tgetFramesPerBlock () const
Returns the number of frames processed in one block by this Node , which is governed by the Context 's OutputNode .
-
boolisAutoEnabled () const
Returns whether this Node is automatically enabled / disabled when connected.
-
voidsetAutoEnabled (bool b=true)
Sets whether this Node is automatically enabled / disabled when connected.
-
boolisInitialized () const
Returns whether this Node is in an initialized state and is capable of processing audio.
-
bool
-
bool
-
boolcheckCycle (const NodeRef &sourceNode, const NodeRef &destNode) const
Returns true if there is an unmanageable cycle betweeen sourceNode and destNode . If any Node 's in the traversal returns true for supportsCycles() , this method will return false.
-
const std::set< NodeRef > &getInputs () const
Returns an immutable reference to the inputs container.
-
std::vector< NodeRef >getOutputs () const
Returns a copy of the NodeRef's referenced by the this Node as outputs. The copy is necessary because outputs are stored internally with weak_ptr's.
-
std::stringgetName () const
Returns a string representing the name of this Node type. Default returns a demangled, compiler-specific class name.
-
voidsetName (const std::string &name)
Sets this Node 's name to a user-specified string.
-
Buffer *getInternalBuffer ()
Usually used internally by a Node subclass, returns a pointer to the internal buffer storage.
-
const Buffer *getInternalBuffer () const
Usually used internally by a Node subclass, returns a pointer to the internal buffer storage.
-
void
Protected Member Functions
-
voidenableProcessing () override
Callled when this Node should enable processing. Initiated from Node::enable() . Default implementation is empty.
-
voidprocess (Buffer *buffer) override
Override to perform audio processing on buffer. Default implementation is empty.
-
voidinitialize ()
Called before audio buffers need to be used. There is always a valid Context at this point. Default implementation is empty.
-
voiduninitialize ()
Called once the contents of initialize are no longer relevant, i.e. connections have changed. Default implementation is empty.
Not guaranteed to be called at Node destruction.
-
voiddisableProcessing ()
Callled when this Node should disable processing. Initiated from Node::disable() . Default implementation is empty.
-
voidsumInputs ()
Override to customize how input Nodes are summed into the internal summing buffer. You usually don't need to do this.
-
boolsupportsInputNumChannels (size_t numChannels) const
Default implementation returns true if numChannels matches our format.
-
boolsupportsCycles () const
Default implementation returns false, return true if it makes sense for the Node to be processed in a cycle (eg. Delay).
-
boolsupportsProcessInPlace () const
Default implementation returns true, subclasses should return false if they must process out-of-place (summing).
-
voiddisconnectInput (const NodeRef &input)
-
voiddisconnectOutput (const NodeRef &output)
-
voidconfigureConnections ()
-
voidsetupProcessWithSumming ()
-
voidnotifyConnectionsDidChange ()
-
boolinputChannelsAreUnequal () const
-
void
-
void
-
const std::pair< size_t, size_t > &getProcessFramesRange () const
Returns a pair of frame indices for Nodes that wish to support sample accurate enable and disable.
The first index is where processing should start, the second is where it should end. Should only be called on the audio thread from within a Node 's process() method. Unless scheduled (with Context::schedule() ), this will be [0, getFramesPerBlock() ]
-
voidinitializeImpl ()
-
voiduninitializeImpl ()
-
getSummingBuffer ()
-
const BufferDynamic *getSummingBuffer () const