#include <iso_synth_wavetable_envelope.h>
Inherits iso::synth::ProcessUnit, and iso::synth::PortConnectListener.
Inheritance diagram for iso::synth::WaveTableEnvelope:
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 | |
Channel * | waveTable () |
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 | |
ControlPort * | mTrigger |
default wavetable size envelope trigger port | |
ControlPort * | mDuration |
duration control port | |
ControlPort * | mAmplitude |
amplitude control port | |
ControlPort * | mOffset |
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 | |
Frame * | mPhaseOffsetFrame |
current phase offsets | |
String | mWaveTableName |
wave table name | |
Channel * | mWaveTable |
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 |
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.
WaveTableEnvelope::WaveTableEnvelope | ( | Frame | pEnvelope, | |
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | FunctionType | pFunctionType, | |
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pFunctionType | function type | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | FunctionType | pFunctionType, | |
Frame | pEnvelope, | |||
sample | pParameter, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameter | envelope control parameter | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | FunctionType | pFunctionType, | |
Frame | pEnvelope, | |||
Frame | pParameters, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameters | envelope control parameters | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | unsigned int | pChannelCount, | |
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pChannelCount | number of channels | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | unsigned int | pChannelCount, | |
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pChannelCount | number of channels | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | unsigned int | pChannelCount, | |
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
sample | pParameter, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pChannelCount | number of channels | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameter | envelope control parameter | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | unsigned int | pChannelCount, | |
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
Frame | pParameters, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pChannelCount | number of channels | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameters | envelope control parameters | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pName | unit name | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pName | unit name | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
sample | pParameter, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pName | unit name | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameter | envelope control parameter | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
Frame | pParameters, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pName | unit name | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameters | envelope control parameters | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
unsigned int | pChannelCount, | |||
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pName | unit name | |
pChannelCount | number of channels | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
unsigned int | pChannelCount, | |||
FunctionType | pFunctionType, | |||
Frame | pEnvelope, | |||
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) | throw (SynthException) |
parameter based contructor
pName | unit name | |
pChannelCount | number of channels | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pInterpolationType | wavetable interpolation type |
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
pName | unit name | |
pChannelCount | number of channels | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameter | envelope control parameter | |
pInterpolationType | wavetable interpolation type |
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
pName | unit name | |
pChannelCount | number of channels | |
pFunctionType | function type | |
pEnvelope | envelope control points | |
pParameters | envelope control parameters | |
pInterpolationType | wavetable interpolation type |
failed | to create wavetablenevelope |
WaveTableEnvelope::WaveTableEnvelope | ( | String | pWaveTableName, | |
InterpolationType | pInterpolationType = TRUNCATEINTERPOL | |||
) |
parameter based contructor
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
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
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
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
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
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
pUnit | unit to copy properties from |
WaveTableEnvelope::WaveTableEnvelope | ( | const String & | pName, | |
const WaveTableEnvelope & | pUnit | |||
) |
name & copy constructor
pName | unit name | |
pUnit | unit to copy properties from |
WaveTableEnvelope::WaveTableEnvelope | ( | const data::Values & | pValues | ) | throw (SynthException) |
values based constructor
pValues | unit values |
SynthException | failed to create unit |
WaveTableEnvelope::~WaveTableEnvelope | ( | ) |
destructor
WaveTableEnvelope::WaveTableEnvelope | ( | ) | [protected] |
default constructor
Channel * WaveTableEnvelope::waveTable | ( | ) |
returns wave table
void WaveTableEnvelope::play | ( | bool | pPlay | ) |
trigger envelope playback or stop
pPlay | ( true: start playback, false: stop playback ) |
void WaveTableEnvelope::setLooping | ( | bool | pLooping | ) |
turn envelope looping on or off
pLooping | ( true: envelope looping on, false: envelope looping off ) |
void WaveTableEnvelope::setBlocking | ( | bool | pBlocking | ) |
turn envelope blocking on or off
pBlocking | ( true: envelope blocking on, false: envelope blocking off ) |
void WaveTableEnvelope::process | ( | Buffer * | pBuffer | ) | throw (SynthException) [virtual] |
processes buffer
pBuffer | buffer to process |
Reimplemented from iso::synth::ProcessUnit.
port connect notification
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
pPropagate | if true, the unit calls the info methods of its input ports | |
pShowPorts | print port 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
std::ostream& operator<< | ( | std::ostream & | pOstream, | |
const WaveTableEnvelope & | pUnit | |||
) | [friend] |
print unit information
const base::String WaveTableEnvelope::sClassName [static] |
unsigned int WaveTableEnvelope::sUnitCount [static, protected] |
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
interpolation type
previous trigger value
helper for detecting when an envelope trigger just started