Cinder  0.9.1
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
cinder::audio::Voice Class Referenceabstract

#include <Voice.h>

Inherited by cinder::audio::VoiceCallbackProcessor, and cinder::audio::VoiceSamplePlayerNode.

Classes

struct  Options
 

Public Member Functions

virtual ~Voice ()
 
virtual void start ()
 
virtual void stop ()
 
virtual void pause ()
 
virtual bool isPlaying () const
 
virtual NodeRef getInputNode () const =0
 
virtual NodeRef getOutputNode () const
 
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())
 
static VoiceRef create (const CallbackProcessorFn &callbackFn, const Options &options=Options())
 
static void clearBufferCache ()
 

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::clearBufferCache ( )
static

Clears all audio file buffers that that are cached in the Mixer.

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: