19 #define thisTTClass TTAdsr
20 #define thisTTClassName "adsr"
21 #define thisTTClassTags "dspGeneratorLib, audio, generator, envelope"
25 , output(0.), output_db(NOISE_FLOOR), eg_state(k_eg_inactive), trigger(
false), attrMode(
"linear")
38 setAttributeValue(
TT(
"attack"), 50.);
39 setAttributeValue(
TT(
"decay"), 100.);
40 setAttributeValue(
TT(
"sustain"), -6.);
41 setAttributeValue(
TT(
"release"), 500.);
42 setAttributeValue(
TT(
"mode"),
TT(
"hybrid"));
62 if (schema ==
TT(
"MidiNoteEvent")) {
154 if (attrMode ==
TT(
"exponential"))
156 else if (attrMode ==
TT(
"hybrid"))
171 TTUInt16 vs = out.getVectorSizeAsInt();
172 bool checkAudioTrigger =
false;
176 checkAudioTrigger =
true;
182 if (checkAudioTrigger)
183 trigger = (
TTBoolean)(*inSample++ > 0.5);
233 TTUInt16 vs = out.getVectorSizeAsInt();
234 bool checkAudioTrigger =
false;
238 checkAudioTrigger =
true;
244 if (checkAudioTrigger)
245 trigger = (
TTBoolean)(*inSample++ > 0.5);
301 TTUInt16 vs = out.getVectorSizeAsInt();
302 bool checkAudioTrigger =
false;
306 checkAudioTrigger =
true;
312 if (checkAudioTrigger)
313 trigger = (
TTBoolean)(*inSample++ > 0.5);
TTFloat64 TTDecibelsToLinearGain(TTFloat64 value)
Convert decibels into linear ampliude.
TTErr(TTObjectBase::* TTSetterMethod)(const TTAttribute &attribute, const TTValue &value)
A type that can be used to store a pointer to a message for an object.
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
std::uint16_t TTUInt16
16 bit unsigned integer
TTFloat64 TTLinearGainToDecibels(const TTFloat64 value)
Convert linear amplitude into deciBels.
TTSampleValue output
Current envelope value as linear amplitude.
TTErr updateSampleRate(const TTValue &, TTValue &)
This method must be called when the sample rate change.
TTErr setAttack(const TTValue &newValue)
Set the attack time for the enevelope.
TTErr setSustainDb(const TTValue &newValue)
Set the signal level to use for the sustain, expressed in decibels.
TTErr processAudioLinear(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
The Linear audio processing method use linear amplitude curves for all parts of the envelope...
TTFloat64 release_ms
Release duration in milliseconds.
TTErr processAudioHybrid(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
The Hybrid processing method combines a linear attack with an exponential release.
Bad DataType for the context.
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
TTInt32 attack_samples
Attack duration in total number of samples.
TTInt16 eg_state
The current state of the envelope. Tracks what envelope phase that we are currently in...
TTFloat64 decay_ms
Decay duration in milliseconds.
TTErr getValue(T &aReturnedValue) const
Get the dictionary's primary value.
double TTFloat64
64 bit floating point number
TTErr dictionary(const TTValue &input, TTValue &output)
Send a dictionary from Jamoma Graph to this object in order to pass a MidiNoteEvent or set attributes...
TTFloat64 decay_step_db
Stepsize in decibels for each sample during the decay phase.
A type that represents the key as a C-String and the value as a pointer to the matching TTSymbol obje...
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
TTFloat64 decay_step
Stepsize for each sample during the decay phase.
The envelope is currently inactive (not being executed).
TTErr processAudioExponential(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
The Exponential processing methods use exponential curves for all sections of the envelope...
TTFloat64 attack_ms
Attack duration in milliseconds.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
const TTSymbol getSchema() const
TODO: Add documentation.
TTSampleValue output_db
Current envelope value as decibel value.
TTFloat64 sustain_db
Sustain level as decibel value.
Boolean (1/0) or (true/false) flag.
TTErr getSustainDb(TTValue &returnedValue)
Get the signal level currently used for the sustain, measured in decibels.
The TTAudioSignal class represents N vectors of audio samples for M channels.
#define addMessageWithArguments(name)
A convenience macro to be used by subclasses for registering messages.
TTSampleValue ** mSampleVectors
An array of pointers to the first sample in each vector. Declared Public for fast access...
The envelope is currently in the release phase.
TTFloat64 attack_step
Stepsize for each sample in the attack phase.
A simple container for an array of TTAudioSignal pointers.
TTInt32 release_samples
Release duration in total number of samples.
TTErr setSustainAmp(const TTValue &newValue)
Set the signal level to use for the sustain, expressed as linear amplitude.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
The envelope is currently in the decay phase.
TTErr setMode(const TTValue &newValue)
Set the performance mode to use for the envelope.
The envelope is currently in the sustain phase.
TTFloat64 sustain_amp
Sustain level as linear amplitude.
TTFloat64 release_step_db
Stepsize in decibels for each sample during the release phase.
The envelope is currently in the attack phase.
TTFloat64 attack_step_db
Stepasize in decibels for each sample in the attack phase.
GeneratorLib: Generate classic ADSR envelope (attack, decay, sustain, release).
TTErr(TTObjectBase::* TTGetterMethod)(const TTAttribute &attribute, TTValue &value)
A type that can be used to store a pointer to a message for an object.
TTInt32 decay_samples
Decay duration in total number of samples.
TTFloat64 TTSampleValue
A value representing a single audio sample.
[doxygenAppendixC_copyExample]
TTErr setDecay(const TTValue &newValue)
Set the decay time for the envelope.
TTChannelCount numAudioSignals
The number of audio signal pointers which are actually valid.
TTFloat64 release_step
Stepsize for each sample during the release phase.
#define addUpdates(updateName)
An 'update' is a message sent to a subclass instance from its parent class.
unsigned char TTUInt8
8 bit unsigned integer (char)
TTUInt32 sr
Current sample rate being used by this object.
TTErr setRelease(const TTValue &newValue)
Set the release time in milliseconds.