Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
cinder::audio::Voice Class Referenceabstract

Interface for performing high-level audio playback tasks. More...

#include <Voice.h>

Inheritance diagram for cinder::audio::Voice:
[legend]

Classes

struct  Options
 Optional parameters passed into Voice::create() methods. More...
 

Public Member Functions

virtual ~Voice ()
 
virtual void start ()
 Starts the Voice. Does nothing if currently playing. More...
 
virtual void stop ()
 Stops the Voice, resetting its state to the same as when it was created. More...
 
virtual void pause ()
 Pauses the Voice inits current state. start() will resume from here. More...
 
virtual bool isPlaying () const
 Returns whether the Voice is currently playing or not. More...
 
virtual NodeRef getInputNode () const =0
 Returns the Node that is the source of this Voice's audio production. The Node type is determined by the Voice subclassed. More...
 
virtual NodeRef getOutputNode () const
 Returns the Node that is used for connected the Voice to the greater audio graph (by default, it is connected to Context::master()). More...
 
void setVolume (float volume)
 
void setPan (float pos)
 
float getVolume () const
 
float getPan () const
 

Static Public Member Functions

static VoiceSamplePlayerNodeRef create (const SourceFileRef &sourceFile, const Options &options=Options())
 Creates a Voice that manages sample playback of an audio file pointed at with sourceFile. More...
 
static VoiceRef create (const CallbackProcessorFn &callbackFn, const Options &options=Options())
 Creates a Voice that continuously calls callbackFn to process a Buffer of samples. More...
 

Protected Member Functions

 Voice ()
 

Friends

class MixerImpl
 

Detailed Description

Interface for performing high-level audio playback tasks.

A Voice is an abstraction of something you can hear, and as such they send audio to your computers output device. Currently supports file playback and processing audio with a callback function. Each Voice has controls for setting the volume and pan of its signal, and supports start(), stop(), and pause() functionality.

Underneath, playback is managed by a Node, which can be retrieved via the virtual getNode() method to perform more complex tasks.

Constructor & Destructor Documentation

cinder::audio::Voice::~Voice ( )
virtual
cinder::audio::Voice::Voice ( )
protected

Member Function Documentation

VoiceSamplePlayerNodeRef cinder::audio::Voice::create ( const SourceFileRef sourceFile,
const Options options = Options() 
)
static

Creates a Voice that manages sample playback of an audio file pointed at with sourceFile.

VoiceRef cinder::audio::Voice::create ( const CallbackProcessorFn callbackFn,
const Options options = Options() 
)
static

Creates a Voice that continuously calls callbackFn to process a Buffer of samples.

void cinder::audio::Voice::start ( )
virtual

Starts the Voice. Does nothing if currently playing.

Note
In the case of a VoiceSamplePlayerNode and the sample has reached EOF, start() will start from the beginning.

Reimplemented in cinder::audio::VoiceSamplePlayerNode.

void cinder::audio::Voice::stop ( )
virtual

Stops the Voice, resetting its state to the same as when it was created.

Reimplemented in cinder::audio::VoiceSamplePlayerNode.

void cinder::audio::Voice::pause ( )
virtual

Pauses the Voice inits current state. start() will resume from here.

bool cinder::audio::Voice::isPlaying ( ) const
virtual

Returns whether the Voice is currently playing or not.

virtual NodeRef cinder::audio::Voice::getInputNode ( ) const
pure virtual

Returns the Node that is the source of this Voice's audio production. The Node type is determined by the Voice subclassed.

Implemented in cinder::audio::VoiceCallbackProcessor, and cinder::audio::VoiceSamplePlayerNode.

NodeRef cinder::audio::Voice::getOutputNode ( ) const
virtual

Returns the Node that is used for connected the Voice to the greater audio graph (by default, it is connected to Context::master()).

void cinder::audio::Voice::setVolume ( float  volume)
void cinder::audio::Voice::setPan ( float  pos)
float cinder::audio::Voice::getVolume ( ) const
float cinder::audio::Voice::getPan ( ) const

Friends And Related Function Documentation

friend class MixerImpl
friend

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