Allolib  1.0
C++ Components For Interactive Multimedia
al::PositionedVoice Class Reference

A PositionedVoice is a rendering class that can have a position and size. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/scene/al_DynamicScene.hpp>

Inheritance diagram for al::PositionedVoice:
al::SynthVoice

Public Member Functions

const Pose pose ()
 
float size ()
 
void setPose (Pose pose)
 
void setSize (float size)
 
ParameterPoseparameterPose ()
 
ParameterparameterSize ()
 
bool useDistanceAttenuation ()
 
void useDistanceAttenuation (bool atten)
 
std::vector< Vec3f > & audioOutOffsets ()
 
void audioOutOffsets (const std::vector< Vec3f > &offsets)
 Set the position offset for each of the audio outputs for this voice. More...
 
virtual void preProcess (Graphics &)
 Override this function to apply transformations after the internal transformations of the voice has been applied.
 
virtual bool setTriggerParams (float *pFields, int numFields=-1) override
 For PositionedVoice, the pose (7 floats) and the size are appended to the pfields.
 
virtual bool setTriggerParams (std::vector< float > &pFields, bool noCalls=false) override
 Set parameter values. More...
 
virtual bool setTriggerParams (std::vector< ParameterField > pFields, bool noCalls=false) override
 Set parameter values. More...
 
virtual std::vector< ParameterFieldgetTriggerParams () override
 For PositionedVoice, the pose (7 floats) and the size are appended to the pfields.
 
bool active ()
 Returns true if voice is currently active.
 
virtual int getTriggerParams (float *pFields, int maxParams=-1)
 Get this instance's parameter fields. More...
 
virtual void onProcess (AudioIOData &)
 Override this function to define audio processing. More...
 
virtual void onProcess (Graphics &)
 Override this function to define graphics for this synth.
 
virtual void update (double dt=0)
 Override this function to update internal state, e.g. from an asynchronous simulator. More...
 
virtual void init ()
 Override this function to initialize internal data. More...
 
virtual void onTriggerOn ()
 Override this function to determine what needs to be done when note/event starts. More...
 
virtual void onTriggerOff ()
 determine what needs to be done when note/event ends Define this function to determine what needs to be done when note/event ends. e.g. trigger release in envelopes, etc.
 
virtual void onFree ()
 This function gets called after the voice is taken out of the processing chain. More...
 
void triggerOn (int offsetFrames=0)
 Trigger a note by calling onTriggerOn() and setting voice as active. More...
 
void triggerOff (int offsetFrames=0)
 Call the voice's onTriggerOff() function to begin note's deactivation. More...
 
void id (int idValue)
 Set the id for this voice. More...
 
int id ()
 Get the id for this voice. More...
 
int getStartOffsetFrames (unsigned int framesPerBuffer)
 returns the offset frames framesPerSecondand sets them to 0. More...
 
int getEndOffsetFrames (unsigned int framesPerBuffer)
 
void userData (void *ud)
 
void * userData ()
 
unsigned int numOutChannels ()
 Query the number of channels this voice generates. More...
 
std::shared_ptr< ParametercreateInternalTriggerParameter (std::string name, float defaultValue=0.0, float minValue=-9999.0, float maxValue=9999.0)
 A convenience function for quick creation of a managed parameter. More...
 
ParametergetInternalParameter (std::string name)
 Get reference to internal Parameter. More...
 
float getInternalParameterValue (std::string name)
 Get value for internal trigger parameter. More...
 
void setInternalParameterValue (std::string name, float value)
 Set value for internal trigger parameter.
 
virtual SynthVoiceregisterTriggerParameter (ParameterMeta &param)
 Register a parameter as a "trigger" parameter. More...
 
template<class... Args>
SynthVoiceregisterTriggerParameters (Args &... paramsArgs)
 
SynthVoiceoperator<< (ParameterMeta &param)
 
std::vector< ParameterMeta * > triggerParameters ()
 
virtual SynthVoiceregisterParameter (ParameterMeta &param)
 registerParameter More...
 
template<class... Args>
SynthVoiceregisterParameters (Args &... paramsArgs)
 
std::vector< ParameterMeta * > parameters ()
 Get the Voice's continuous (i.e. not "trigger") parameters. More...
 
void free ()
 Mark this voice as done. More...
 

Public Attributes

SynthVoicenext {nullptr}
 

Protected Member Functions

void markAsReplica ()
 Set voice as part of a replica distributed scene.
 
void setNumOutChannels (unsigned int numOutputs)
 Set the number of outputs this SynthVoice generates. More...
 

Protected Attributes

ParameterPose mPose {"_pose"}
 
Parameter mSize {"_size", "", 1.0}
 
std::vector< Vec3fmAudioOutPositionOffsets
 
bool mUseDistAtten {true}
 
bool mIsReplica {false}
 
std::vector< ParameterMeta * > mTriggerParams
 
std::vector< ParameterMeta * > mContinuousParameters
 
std::vector< std::shared_ptr< Parameter > > mInternalParameters
 

Detailed Description

A PositionedVoice is a rendering class that can have a position and size.

Definition at line 70 of file al_DynamicScene.hpp.

Member Function Documentation

◆ audioOutOffsets()

void al::PositionedVoice::audioOutOffsets ( const std::vector< Vec3f > &  offsets)
inline

Set the position offset for each of the audio outputs for this voice.

Parameters
offsetsThe size of offsets must be equal to the number of outputs

Definition at line 93 of file al_DynamicScene.hpp.

◆ createInternalTriggerParameter()

std::shared_ptr<Parameter> al::SynthVoice::createInternalTriggerParameter ( std::string  name,
float  defaultValue = 0.0,
float  minValue = -9999.0,
float  maxValue = 9999.0 
)
inherited

A convenience function for quick creation of a managed parameter.

Returns
a shared pointer to the created Parameter

This creates a float type Parameter. The parameters instantiated through this function can be queried and set quickly through getInternalParameter(), getInternalParameterValue() and setInternalParameterValue(). These functions provide a quick way to add trigger parameters to the synth. These parameters are registered automatically, so they will be used in automatic GUIs and with the SynthSequencer.

◆ free()

void al::SynthVoice::free ( )
inlineinherited

Mark this voice as done.

This should be set within one of the render() functions when envelope or time is done and no more processing for the note is needed. The voice will be considered ready for retriggering by PolySynth.

It can also be used to force removal of a voice from the rendering chain without going through the release phase.

Definition at line 397 of file al_PolySynth.hpp.

◆ getInternalParameter()

Parameter& al::SynthVoice::getInternalParameter ( std::string  name)
inherited

Get reference to internal Parameter.

Parameters
nameparameter name
Returns
reference to the parameter

Internal parameters are those registered through createInternalTriggerParameter()

◆ getInternalParameterValue()

float al::SynthVoice::getInternalParameterValue ( std::string  name)
inherited

Get value for internal trigger parameter.

Parameters
namename of the parameter
Returns
current float value of the parameter

◆ getStartOffsetFrames()

int al::SynthVoice::getStartOffsetFrames ( unsigned int  framesPerBuffer)
inherited

returns the offset frames framesPerSecondand sets them to 0.

Parameters
framesPerBuffernumber of frames per buffer
Returns
offset frames

Get the number of frames by which the start of this voice should be offset within a processing block. This value is decremented by framesPerBuffer once read.

◆ id() [1/2]

int al::SynthVoice::id ( )
inlineinherited

Get the id for this voice.

Returns

Definition at line 250 of file al_PolySynth.hpp.

◆ id() [2/2]

void al::SynthVoice::id ( int  idValue)
inlineinherited

Set the id for this voice.

Parameters
idValue

Definition at line 244 of file al_PolySynth.hpp.

◆ init()

virtual void al::SynthVoice::init ( )
inlinevirtualinherited

Override this function to initialize internal data.

This function should be called only once upon voice creation.

Definition at line 193 of file al_PolySynth.hpp.

◆ numOutChannels()

unsigned int al::SynthVoice::numOutChannels ( )
inlineinherited

Query the number of channels this voice generates.

Returns
number of output channels

Definition at line 274 of file al_PolySynth.hpp.

◆ onFree()

virtual void al::SynthVoice::onFree ( )
inlinevirtualinherited

This function gets called after the voice is taken out of the processing chain.

It can be used to store final states of a voice for example. This function is currently called in the time master domain, so it might be important to not do any blocking operations here.

Definition at line 219 of file al_PolySynth.hpp.

◆ onProcess()

virtual void al::SynthVoice::onProcess ( AudioIOData )
inlinevirtualinherited

Override this function to define audio processing.

Parameters
ioYou will need to mark this instance as done by calling the free() function when envelopes or processing is done. You should call free() from one of the render() functions.

Definition at line 173 of file al_PolySynth.hpp.

◆ onTriggerOn()

virtual void al::SynthVoice::onTriggerOn ( )
inlinevirtualinherited

Override this function to determine what needs to be done when note/event starts.

When a note starts, internal data within the algorithm usually needs to be reset, e.g. reset envelopes, oscillator phase, etc.

Definition at line 202 of file al_PolySynth.hpp.

◆ parameters()

std::vector<ParameterMeta *> al::SynthVoice::parameters ( )
inlineinherited

Get the Voice's continuous (i.e. not "trigger") parameters.

Returns
vector with pointers to parameters

Definition at line 384 of file al_PolySynth.hpp.

◆ registerParameter()

virtual SynthVoice& al::SynthVoice::registerParameter ( ParameterMeta param)
inlinevirtualinherited

registerParameter

Parameters
param
Returns

Parameters are values that are meant to be updated while the voice is running, as opposed to "trigger" parameters that are set at onTrigger(). "Trigger" parameters will be stored in sequence text files, while regular parameters are meant to be changing within the voice. In distributed scenes, to synchronize the internal values within voices, the parameters must be registered through this function.

Definition at line 363 of file al_PolySynth.hpp.

◆ registerParameters()

template<class... Args>
SynthVoice& al::SynthVoice::registerParameters ( Args &...  paramsArgs)
inlineinherited

Allows registering any number of parameters on a single line

Definition at line 372 of file al_PolySynth.hpp.

◆ registerTriggerParameter()

virtual SynthVoice& al::SynthVoice::registerTriggerParameter ( ParameterMeta param)
inlinevirtualinherited

Register a parameter as a "trigger" parameter.

Parameters
param
Returns
this SynthVoice object

Trigger parameters are parameters meant to be set prior to triggering the note and inserting it in the rendering chain. Trigger parameters are garanteed to be set synchronously right before the note starts. Additionally they are stored as values in a text file for the event sequencer and are sent as part of the /triggerOn message when running distributed.

Definition at line 328 of file al_PolySynth.hpp.

◆ registerTriggerParameters()

template<class... Args>
SynthVoice& al::SynthVoice::registerTriggerParameters ( Args &...  paramsArgs)
inlineinherited

Allows registering any number of trigger parameters on a single line

Definition at line 337 of file al_PolySynth.hpp.

◆ setNumOutChannels()

void al::SynthVoice::setNumOutChannels ( unsigned int  numOutputs)
inlineprotectedinherited

Set the number of outputs this SynthVoice generates.

Parameters
numOutputsIf you are using this voice within PolySynth, make sure this number is less or equal than the number of output channels opened for the audio device. If using in DynamicScene, make sure

Definition at line 410 of file al_PolySynth.hpp.

◆ setTriggerParams() [1/2]

virtual bool al::PositionedVoice::setTriggerParams ( std::vector< float > &  pFields,
bool  noCalls = false 
)
overridevirtual

Set parameter values.

Parameters
pFieldsstd::vector<float> containing the values
Returns
true if able to set the fields

Reimplemented from al::SynthVoice.

◆ setTriggerParams() [2/2]

virtual bool al::PositionedVoice::setTriggerParams ( std::vector< ParameterField pFields,
bool  noCalls = false 
)
overridevirtual

Set parameter values.

Parameters
pFieldsstd::vector<float> containing the values
Returns
true if able to set the fields

Reimplemented from al::SynthVoice.

◆ triggerOff()

void al::SynthVoice::triggerOff ( int  offsetFrames = 0)
inherited

Call the voice's onTriggerOff() function to begin note's deactivation.

Parameters
offsetFramesThis function can be called to programatically trigger the release of a voice

◆ triggerOn()

void al::SynthVoice::triggerOn ( int  offsetFrames = 0)
inherited

Trigger a note by calling onTriggerOn() and setting voice as active.

Parameters
offsetFramesThis function can be called to programatically trigger a voice. It is used for example in PolySynth to trigger a voice.

◆ update()

virtual void al::SynthVoice::update ( double  dt = 0)
inlinevirtualinherited

Override this function to update internal state, e.g. from an asynchronous simulator.

dt is the delta time elapsed since last update

Definition at line 186 of file al_PolySynth.hpp.


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