Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PanNode.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 Pan2dNode> Pan2dNodeRef;
32 
34 class Pan2dNode : public Node {
35  public:
37  Pan2dNode( const Format &format = Format() );
38  virtual ~Pan2dNode() {}
39 
41  void setPos( float pos );
43  float getPos() const { return mPos; }
44 
49  void setStereoInputModeEnabled( bool enable = true ) { mStereoInputMode = enable; }
51  bool isStereoInputModeEnabled() const { return mStereoInputMode; }
52 
53 protected:
54  void process( Buffer *buffer ) override;
55 
56  private:
57  std::atomic<float> mPos;
58  bool mStereoInputMode;
59 };
60 
61 } } // namespace cinder::audio
void setStereoInputModeEnabled(bool enable=true)
Definition: PanNode.h:49
void setPos(float pos)
Sets the panning position in range of [0:1]: 0 = left, 1 = right, and 0.5 = center.
Definition: PanNode.cpp:136
std::shared_ptr< class Pan2dNode > Pan2dNodeRef
Definition: PanNode.h:31
bool isStereoInputModeEnabled() const
Returns whether 'stereo input mode' is enabled or not (disabled by default).
Definition: PanNode.h:51
Simple stereo panning using an equal power cross-fade. The panning position is specified by a single ...
Definition: PanNode.h:34
void process(Buffer *buffer) override
Override to perform audio processing on buffer.
Definition: PanNode.cpp:102
GLuint buffer
Definition: GLee.h:2065
float getPos() const
Gets the current.
Definition: PanNode.h:43
Definition: Node.h:72
Fundamental building block for creating an audio processing graph.
Definition: Node.h:59
void enable()
Enables this Node for processing. Same as setEnabled( true ).
Definition: Node.cpp:165
GLenum GLsizei GLenum format
Definition: GLee.h:969
Pan2dNode(const Format &format=Format())
Constructs a Pan2dNode.
Definition: PanNode.cpp:33
virtual ~Pan2dNode()
Definition: PanNode.h:38