iso::synth::WaveTableEnvelope Class Reference

wavetable envelope class More...

#include <iso_synth_wavetable_envelope.h>

Inherits iso::synth::ProcessUnit, and iso::synth::PortConnectListener.

Inheritance diagram for iso::synth::WaveTableEnvelope:

Inheritance graph
[legend]
Collaboration diagram for iso::synth::WaveTableEnvelope:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 WaveTableEnvelope (Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (FunctionType pFunctionType, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (FunctionType pFunctionType, Frame pEnvelope, sample pParameter, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (FunctionType pFunctionType, Frame pEnvelope, Frame pParameters, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (unsigned int pChannelCount, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (unsigned int pChannelCount, FunctionType pFunctionType, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (unsigned int pChannelCount, FunctionType pFunctionType, Frame pEnvelope, sample pParameter, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (unsigned int pChannelCount, FunctionType pFunctionType, Frame pEnvelope, Frame pParameters, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, FunctionType pFunctionType, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, FunctionType pFunctionType, Frame pEnvelope, sample pParameter, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, FunctionType pFunctionType, Frame pEnvelope, Frame pParameters, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, unsigned int pChannelCount, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, unsigned int pChannelCount, FunctionType pFunctionType, Frame pEnvelope, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, unsigned int pChannelCount, FunctionType pFunctionType, Frame pEnvelope, sample pParameter, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, unsigned int pChannelCount, FunctionType pFunctionType, Frame pEnvelope, Frame pParameters, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (String pWaveTableName, InterpolationType pInterpolationType=TRUNCATEINTERPOL)
 parameter based contructor
 WaveTableEnvelope (const String &pName, String pWaveTableName, InterpolationType pInterpolationType=TRUNCATEINTERPOL)
 parameter based contructor
 WaveTableEnvelope (unsigned int pChannelCount, String pWaveTableName, InterpolationType pInterpolationType=TRUNCATEINTERPOL)
 parameter based contructor
 WaveTableEnvelope (const String &pName, unsigned int pChannelCount, String pWaveTableName, InterpolationType pInterpolationType=TRUNCATEINTERPOL)
 parameter based contructor
 WaveTableEnvelope (unsigned int pFrameCount, unsigned int pChannelCount, unsigned int pRate, String pWaveTableName, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 parameter based contructor
 WaveTableEnvelope (const String &pName, unsigned int pFrameCount, unsigned int pChannelCount, unsigned int pRate, String pWaveTableName, InterpolationType pInterpolationType=TRUNCATEINTERPOL) throw (SynthException)
 name and parameter based contructor
 WaveTableEnvelope (const WaveTableEnvelope &pUnit)
 copy constructor
 WaveTableEnvelope (const String &pName, const WaveTableEnvelope &pUnit)
 name & copy constructor
 WaveTableEnvelope (const data::Values &pValues) throw (SynthException)
 values based constructor
 ~WaveTableEnvelope ()
 destructor
ChannelwaveTable ()
 returns wave table
void play (bool pPlay)
 trigger envelope playback or stop
void setLooping (bool pLooping)
 turn envelope looping on or off
void setBlocking (bool pBlocking)
 turn envelope blocking on or off
virtual void process (Buffer *pBuffer) throw (SynthException)
 processes buffer
virtual void portConnectNotify (AudioPort &pPort1, AudioPort &pPort2)
 port connect notification
virtual String info (bool pPropagate=false, bool pShowPorts=true) const
 obtain textual unit information

Static Public Attributes

static const String sClassName
 default name

Protected Member Functions

 WaveTableEnvelope ()
 default constructor
void init ()
 initializes wavetable and control ports
void processE (Buffer *pBuffer) throw (SynthException)
 event based envelope control
void processS (Buffer *pBuffer) throw (SynthException)
 control stream envelope control

Protected Attributes

ControlPortmTrigger
 default wavetable size envelope trigger port
ControlPortmDuration
 duration control port
ControlPortmAmplitude
 amplitude control port
ControlPortmOffset
 offset control port
bool mPlaying
 flag whether envelope is currently playing
bool mLooping
 flag whether envelope automatically loops
bool mBlocking
 flag whether envelope can be triggered again before it stopped playing
FramemPhaseOffsetFrame
 current phase offsets
String mWaveTableName
 wave table name
ChannelmWaveTable
 wave table buffer
sample mBaseDuration
 duration of wave in wave table at mRate
InterpolationType mInterpolationType
 interpolation type
sample mPrevTriggerValue
 previous trigger value

Static Protected Attributes

static unsigned int sUnitCount
 total number of units created so far
static FunctionType sFunctionType
static unsigned int sWaveTableSize
 default function type

Friends

std::ostream & operator<< (std::ostream &pOstream, const WaveTableEnvelope &pUnit)
 print unit information

Detailed Description

wavetable envelope class

class

A wavetable envelope produces sample values by scanning through a stored wavetable.
The wavetable can be scanned at arbitrary speeds.
The unit creates samples either by truncating or interpolating values from the wavetable.
The unit can act either as an input unit or as a process unit.
When acting as an input unit, it directly sends out the values from the wavetable.
When acting as a process unit, it multiplies the sample values it receives at it's input port by the wavetable values.
In order to apply envelopes, the envelopes need to be triggered.
Triggering can either happen via an event based switch port ("play") or by conntinuous control of a control port("trigger").
These two methods are mutually exclusive.
The event based triggering system is inactive when the trigger control port is connected to a unit or
when this unit is in looping mode.
The envelope is triggered by sending a 1.0 value to the play switch port.
Once the envelope played in this mode, the unit turns itself automatically off.
It turns on again when it receives the next event.
In continuous mode the envelope is typically triggered by the output of a pulse unit, which is connected to the trigger control port.
Depending on this unit's settings, the envelope gets triggered whenever the values at the trigger control port
change from a negative or zero value to a positive value or whenever the trigger control port values are positive.
In this mode, the unit never turns off automatically.
Envelope control via control port is sample accurate.
Envelope control via switch port happens only at the beginning of a new process call.
This unit can be configured in the following ways: Looping can be turned on or off via the "looping" switch port.
When looping is on, envelopes get triggered again and again right after each other as long as the trigger control port delivers positive values
When looping is off, envelopes get only triggered when the trigger control port values change from negative (or zero) to positive.
Blocking can be turned on or off via the "blocking" switch port.
When blocking is on, an envelope can only be triggered again when the envelope has completely finished playing.
When blocking is off, an envelope can always be triggered. This can of course cause discontinuities.


Issues: The behavior of this unit is different when in switch port controlled event mode than in control port controlled continuous mode.
When the unit is event controlled, it sends out zero values whenever an enevelope is not playing.
This is the standard behavior of units. which are inactive.
In continuous mode, it sends out the last wavetable value * sample values arriving at the input port.
For this reason, the unit doesn't necessarily procude zero values when envelopes are not triggered.

ControlPorts
name: trigger defaultValue: 0.0
name: amplitude defaultValue: 1.0
name: duration defaultValue: 1000.0
name: offset defaultValue: 0.0

SwitchPorts:
name: active channelCount: 1 defaultValue: 0.0 resizable: false function: setActive
name: play channelCount: 1 defaultValue: 0.0 resizable: false function: play
name: looping channelCount: 1 defaultValue: 0.0 resizable: false function: setLooping
name: blocking channelCount: 1 defaultValue: 0.0 resizable: false function: setBlocking

Created by Daniel Bisig on 7/17/06. Copyright 2006 Daniel Bisig All rights reserved.


Constructor & Destructor Documentation

WaveTableEnvelope::WaveTableEnvelope ( Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( FunctionType  pFunctionType,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pFunctionType function type
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( FunctionType  pFunctionType,
Frame  pEnvelope,
sample  pParameter,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pFunctionType function type
pEnvelope envelope control points
pParameter envelope control parameter
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( FunctionType  pFunctionType,
Frame  pEnvelope,
Frame  pParameters,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pFunctionType function type
pEnvelope envelope control points
pParameters envelope control parameters
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( unsigned int  pChannelCount,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pChannelCount number of channels
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( unsigned int  pChannelCount,
FunctionType  pFunctionType,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pChannelCount number of channels
pFunctionType function type
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( unsigned int  pChannelCount,
FunctionType  pFunctionType,
Frame  pEnvelope,
sample  pParameter,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pChannelCount number of channels
pFunctionType function type
pEnvelope envelope control points
pParameter envelope control parameter
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( unsigned int  pChannelCount,
FunctionType  pFunctionType,
Frame  pEnvelope,
Frame  pParameters,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pChannelCount number of channels
pFunctionType function type
pEnvelope envelope control points
pParameters envelope control parameters
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
FunctionType  pFunctionType,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pFunctionType function type
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
FunctionType  pFunctionType,
Frame  pEnvelope,
sample  pParameter,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pFunctionType function type
pEnvelope envelope control points
pParameter envelope control parameter
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
FunctionType  pFunctionType,
Frame  pEnvelope,
Frame  pParameters,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pFunctionType function type
pEnvelope envelope control points
pParameters envelope control parameters
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
unsigned int  pChannelCount,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pChannelCount number of channels
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
unsigned int  pChannelCount,
FunctionType  pFunctionType,
Frame  pEnvelope,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pChannelCount number of channels
pFunctionType function type
pEnvelope envelope control points
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
unsigned int  pChannelCount,
FunctionType  pFunctionType,
Frame  pEnvelope,
sample  pParameter,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pChannelCount number of channels
pFunctionType function type
pEnvelope envelope control points
pParameter envelope control parameter
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
unsigned int  pChannelCount,
FunctionType  pFunctionType,
Frame  pEnvelope,
Frame  pParameters,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pName unit name
pChannelCount number of channels
pFunctionType function type
pEnvelope envelope control points
pParameters envelope control parameters
pInterpolationType wavetable interpolation type
Exceptions:
failed to create wavetablenevelope

WaveTableEnvelope::WaveTableEnvelope ( String  pWaveTableName,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
)

parameter based contructor

Parameters:
pWaveTableName name of existing wavetable or wavetable file
pInterpolationType wavetable interpolation type

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
String  pWaveTableName,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
)

parameter based contructor

Parameters:
pName unit name
pWaveTableName name of existing wavetable or wavetable file
pInterpolationType wavetable interpolation type

WaveTableEnvelope::WaveTableEnvelope ( unsigned int  pChannelCount,
String  pWaveTableName,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
)

parameter based contructor

Parameters:
pChannelCount number of channels
pWaveTableName name of existing wavetable or wavetable file
pInterpolationType wavetable interpolation type

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
unsigned int  pChannelCount,
String  pWaveTableName,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
)

parameter based contructor

Parameters:
pName unit name
pChannelCount number of channels
pWaveTableName name of existing wavetable or wavetable file
pInterpolationType wavetable interpolation type

WaveTableEnvelope::WaveTableEnvelope ( unsigned int  pFrameCount,
unsigned int  pChannelCount,
unsigned int  pRate,
String  pWaveTableName,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

parameter based contructor

Parameters:
pFrameCount number of frames
pChannelCount number of channels
pRate samping rate
pWaveTableName name of existing wavetable or wavetable file
pInterpolationType wavetable interpolation type

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
unsigned int  pFrameCount,
unsigned int  pChannelCount,
unsigned int  pRate,
String  pWaveTableName,
InterpolationType  pInterpolationType = TRUNCATEINTERPOL 
) throw (SynthException)

name and parameter based contructor

Parameters:
pName unit name
pFrameCount number of frames
pChannelCount number of channels
pRate samping rate
pWaveTableName name of existing wavetable or wavetable file
pInterpolationType wavetable interpolation type

WaveTableEnvelope::WaveTableEnvelope ( const WaveTableEnvelope pUnit  ) 

copy constructor

Parameters:
pUnit unit to copy properties from
constructor copies frameCount, channelCount and rate but not unit name

WaveTableEnvelope::WaveTableEnvelope ( const String pName,
const WaveTableEnvelope pUnit 
)

name & copy constructor

Parameters:
pName unit name
pUnit unit to copy properties from
constructor copies frameCount, channelCount and rate but not unit name

WaveTableEnvelope::WaveTableEnvelope ( const data::Values &  pValues  )  throw (SynthException)

values based constructor

Parameters:
pValues unit values
Exceptions:
SynthException failed to create unit
pValues structure & data types: 0: const String& : unit name 1: unsigned int : number of frames 2: unsigned int : number of channels 3: unsigned int : samping rate 4: const String : name of existing wavetable or wavetable file 5: InterpolationType : wavetable interpolation type

WaveTableEnvelope::~WaveTableEnvelope (  ) 

destructor

WaveTableEnvelope::WaveTableEnvelope (  )  [protected]

default constructor


Member Function Documentation

Channel * WaveTableEnvelope::waveTable (  ) 

returns wave table

Returns:
wave table

void WaveTableEnvelope::play ( bool  pPlay  ) 

trigger envelope playback or stop

Parameters:
pPlay ( true: start playback, false: stop playback )

void WaveTableEnvelope::setLooping ( bool  pLooping  ) 

turn envelope looping on or off

Parameters:
pLooping ( true: envelope looping on, false: envelope looping off )

void WaveTableEnvelope::setBlocking ( bool  pBlocking  ) 

turn envelope blocking on or off

Parameters:
pBlocking ( true: envelope blocking on, false: envelope blocking off )

void WaveTableEnvelope::process ( Buffer pBuffer  )  throw (SynthException) [virtual]

processes buffer

Parameters:
pBuffer buffer to process
two step processing procedure:
1. calls process function of all it's input ports
2. as soon as these other processing functions return, it changes the buffer according to it's function

Reimplemented from iso::synth::ProcessUnit.

void WaveTableEnvelope::portConnectNotify ( AudioPort pPort1,
AudioPort pPort2 
) [virtual]

port connect notification

Parameters:
pPort1 port 1
pPort2 port 2

Implements iso::synth::PortConnectListener.

base::String WaveTableEnvelope::info ( bool  pPropagate = false,
bool  pShowPorts = true 
) const [virtual]

obtain textual unit information

Parameters:
pPropagate if true, the unit calls the info methods of its input ports
pShowPorts print port information
Returns:
String containing unit information

Reimplemented from iso::synth::ProcessUnit.

void WaveTableEnvelope::init (  )  [protected]

initializes wavetable and control ports

void WaveTableEnvelope::processE ( Buffer pBuffer  )  throw (SynthException) [protected]

event based envelope control

void WaveTableEnvelope::processS ( Buffer pBuffer  )  throw (SynthException) [protected]

control stream envelope control


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  pOstream,
const WaveTableEnvelope pUnit 
) [friend]

print unit information


Member Data Documentation

const base::String WaveTableEnvelope::sClassName [static]

default name

Reimplemented from iso::synth::ProcessUnit.

unsigned int WaveTableEnvelope::sUnitCount [static, protected]

total number of units created so far

Reimplemented from iso::synth::ProcessUnit.

FunctionType WaveTableEnvelope::sFunctionType [static, protected]

unsigned int WaveTableEnvelope::sWaveTableSize [static, protected]

default function type

ControlPort* iso::synth::WaveTableEnvelope::mTrigger [protected]

default wavetable size envelope trigger port

ControlPort* iso::synth::WaveTableEnvelope::mDuration [protected]

duration control port

ControlPort* iso::synth::WaveTableEnvelope::mAmplitude [protected]

amplitude control port

ControlPort* iso::synth::WaveTableEnvelope::mOffset [protected]

offset control port

bool iso::synth::WaveTableEnvelope::mPlaying [protected]

flag whether envelope is currently playing

bool iso::synth::WaveTableEnvelope::mLooping [protected]

flag whether envelope automatically loops

bool iso::synth::WaveTableEnvelope::mBlocking [protected]

flag whether envelope can be triggered again before it stopped playing

Frame* iso::synth::WaveTableEnvelope::mPhaseOffsetFrame [protected]

current phase offsets

String iso::synth::WaveTableEnvelope::mWaveTableName [protected]

wave table name

Channel* iso::synth::WaveTableEnvelope::mWaveTable [protected]

wave table buffer

sample iso::synth::WaveTableEnvelope::mBaseDuration [protected]

duration of wave in wave table at mRate

InterpolationType iso::synth::WaveTableEnvelope::mInterpolationType [protected]

interpolation type

sample iso::synth::WaveTableEnvelope::mPrevTriggerValue [protected]

previous trigger value

helper for detecting when an envelope trigger just started


The documentation for this class was generated from the following files:
Generated on Fri Feb 25 14:18:44 2011 for synth by  doxygen 1.5.1