Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DelayNode.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2014, The Cinder Project
3 
4 This code is intended to be used with the Cinder C++ library, http://libcinder.org
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that
7 the following conditions are met:
8 
9 * Redistributions of source code must retain the above copyright notice, this list of conditions and
10 the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12 the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
15 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
16 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
17 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
18 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21 POSSIBILITY OF SUCH DAMAGE.
22 */
23 
24 #pragma once
25 
26 #include "cinder/audio/Node.h"
27 #include "cinder/audio/Param.h"
28 
29 namespace cinder { namespace audio {
30 
31 typedef std::shared_ptr<class DelayNode> DelayNodeRef;
32 
37 class DelayNode : public Node {
38  public:
40  DelayNode( const Format &format = Format() );
41 
43  void setMaxDelaySeconds( float seconds );
45  float getMaxDelaySeconds() const { return mMaxDelaySeconds; }
46 
48  void setDelaySeconds( float seconds );
50  float getDelaySeconds() const { return mParamDelaySeconds.getValue(); }
51 
54 
55  protected:
56  void initialize() override;
57  void process( Buffer *buffer ) override;
58  bool supportsCycles() const override { return true; }
59 
60  size_t mWriteIndex;
64 };
65 
66 } } // namespace cinder::audio
float getValue() const
Returns the current value of the Param.
Definition: Param.h:109
Param * getParamDelaySeconds()
Returns the Param used to automate the delay seconds.
Definition: DelayNode.h:53
Param mParamDelaySeconds
Definition: DelayNode.h:62
std::shared_ptr< class DelayNode > DelayNodeRef
Definition: DelayNode.h:31
void setMaxDelaySeconds(float seconds)
Sets the maximimum delay in seconds.
Definition: DelayNode.cpp:67
float mSampleRate
Definition: DelayNode.h:61
size_t mWriteIndex
Definition: DelayNode.h:60
DelayNode(const Format &format=Format())
Constructs a DelayNode with an optional format.
Definition: DelayNode.cpp:50
float getMaxDelaySeconds() const
Returns the maximum delay in seconds.
Definition: DelayNode.h:45
float mMaxDelaySeconds
Definition: DelayNode.h:61
bool supportsCycles() const override
Default implementation returns false, return true if it makes sense for the Node to be processed in a...
Definition: DelayNode.h:58
void setDelaySeconds(float seconds)
Sets the delay value in seconds. Must be at least at least the length of one processing block...
Definition: DelayNode.cpp:57
GLuint buffer
Definition: GLee.h:2065
float getDelaySeconds() const
Returns the delay value in seconds.
Definition: DelayNode.h:50
General purpose delay line, supporting variable delay with linear interpolation.
Definition: DelayNode.h:37
Definition: Node.h:72
Fundamental building block for creating an audio processing graph.
Definition: Node.h:59
GLenum GLsizei GLenum format
Definition: GLee.h:969
void initialize() override
Called before audio buffers need to be used. There is always a valid Context at this point...
Definition: DelayNode.cpp:79
Allows an audio parameter to be controlled over time with sample accuracate curves.
Definition: Param.h:81
BufferDynamic mDelayBuffer
Definition: DelayNode.h:63
void process(Buffer *buffer) override
Override to perform audio processing on buffer.
Definition: DelayNode.cpp:88