- cinder::Noncopyable
- cinder::audio::Node
- cinder::audio::NodeAutoPullable
- cinder::audio::SampleRecorderNode
- cinder::audio::BufferRecorderNode
Enums
Public Member Functions
-
BufferRecorderNode (const Format &format=Format())
-
BufferRecorderNode (size_t numFrames, const Format &format=Format())
Constructs a BufferRecordNode and initializes its buffer to be large enough to hold numFrames frames.
-
voidstart ()
Starts recording. Resets the write position to zero (call disable() to pause recording).
-
voidstop ()
Stops recording. Same as calling disable() .
-
voidsetNumFrames (size_t numFrames, bool shrinkToFit=false)
Sets the length of the recording buffer in frames.
If the write position is non-zero, the old contents will be preserved (by copying it to the newly allocated Buffer ). If shrinkToFit is set to
true
, the internal Buffer will be down-sized if necessary, otherwise it will only re-allocate when growing while changing its dimensions to match numFrames (default shrinkToFit = false). -
voidsetNumSeconds (double numSeconds, bool shrinkToFit=false)
Sets the length of the recording buffer in seconds.
- See Also
-
size_tgetNumFrames () const
Returns the length of the recording buffer in frames.
-
doublegetNumSeconds () const
Returns the length of the recording buffer in seconds.
-
getRecordedCopy () const
Returns a copy of the recored samples, up to the current write position.
This method is non locking, and as such any resizing calls must be performed on the same thread or be otherwise synchronized.
-
voidwriteToFile (const cinder::fs::path &filePath, SampleType sampleType=SampleType::INT_16)
Writes the currently recorded samples to a file at filePath .
The encoding format is derived from filePath's extension and sampleType (default = SampleType::INT_16 ).
throws AudioFileExc if the write request cannot be completed.
-
uint64_tgetLastOverrun ()
Returns the frame of the last buffer overrun or 0 if none since the last time this method was called. When this happens, it means the recorded buffer probably has skipped some frames.
-
size_tgetWritePosition () const
Returns the current write position, which represents how many samples are currently recorded.
-
voidconnect (const NodeRef &output) override
Connects this Node to output .
-
voidconnectInput (const NodeRef &input) override
Connection methods be called on a non-audio thread and synchronized with the Context 's mutex.
-
voiddisconnectInput (const NodeRef &input) override
-
voiddisconnectOutput (const NodeRef &output) override
Overridden to remove from Context 's auto-pulled list if there are no more outputs.
-
voiddisconnectAllOutputs () override
Overridden to also remove from Context 's auto-pulled list.
-
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.
-
voiddisconnect (const NodeRef &output)
Disconnects this Node from output .
-
voiddisconnectAll ()
Disconnects this Node from all inputs and 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
-
voidinitialize () override
Called before audio buffers need to be used. There is always a valid Context at this point. Default implementation is empty.
-
voidprocess (Buffer *buffer) override
Override to perform audio processing on buffer. Default implementation is empty.
-
voidinitBuffers (size_t numFrames)
-
voidupdatePullMethod ()
-
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.
-
voidenableProcessing ()
Callled when this Node should enable processing. Initiated from Node::enable() . Default implementation is empty.
-
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).
-
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