Om  1.0.0
A universal framework for multimedia simulation
Public Types | Public Member Functions | Static Public Attributes | List of all members
om::sound::filters::Tremolo Class Reference

A class that periodically modulates the amplitude of an input signal. More...

#include <omSoundTremolo.h>

Inheritance diagram for om::sound::filters::Tremolo:
om::sound::filters::SoundFilter

Public Types

enum  WaveType { SINE = 0, SQUARE = 1, SAW = 2, TRIANGLE = 3 }
 An enum type which describes the various types of wave shapes that a Tremolo can use. More...
 

Public Member Functions

 Tremolo ()
 Create a default sine-based tremolo filter with a depth of 6dB and frequency of 1Hz. More...
 
 Tremolo (WaveType newType, Float newFrequency, Gain newDepth)
 Create a tremolo with the specified modulation wave type, output gain, and frequency. More...
 
WaveType getType () const
 Return the type of modulation wave that this tremolo is using. More...
 
void setType (WaveType newType)
 Set the type of modulation wave that this tremolo is using. More...
 
Float getFrequency () const
 Return the frequency of this tremolo's modulation wave in hertz. More...
 
void setFrequency (Float newFrequency)
 Set the frequency of this tremolo's modulation wave in hertz. More...
 
Float getDepth () const
 Return the maximum attenuation of the tremolo modulation in decibels. More...
 
void setDepth (Float newDepth)
 Set the maximum attenuation of the tremolo modulation in decibels. More...
 
Float getSmoothing () const
 Return the smoothing amount for the tremolo's modulation wave. More...
 
void setSmoothing (Float newSmoothing)
 Set the smoothing amount for the tremolo's modulation wave. More...
 
Float getChannelPhase (Index channelIndex) const
 Return the modulation phase offset of the channel with the specified index. More...
 
void setChannelPhase (Index channelIndex, Float newPhase)
 Set the modulation phase offset of the channel with the specified index. More...
 
void setChannelPhase (Float newPhase)
 Set the modulation phase offset for all channels. More...
 
virtual UTF8String getName () const
 Return a human-readable name for this tremolo. More...
 
virtual UTF8String getManufacturer () const
 Return the manufacturer name of this tremolo. More...
 
virtual FilterVersion getVersion () const
 Return an object representing the version of this tremolo. More...
 
virtual FilterCategory getCategory () const
 Return an object that describes the category of effect that this filter implements. More...
 
virtual Bool allowsInPlaceProcessing () const
 Return whether or not this tremolo can process audio data in-place. More...
 
virtual Size getParameterCount () const
 Return the total number of generic accessible parameters this tremolo has. More...
 
virtual Bool getParameterInfo (Index parameterIndex, FilterParameterInfo &info) const
 Get information about the tremolo parameter at the specified index. More...
 
virtual Bool getParameterValueName (Index parameterIndex, const FilterParameter &value, UTF8String &name) const
 Get any special name associated with the specified value of an indexed parameter. More...
 
- Public Member Functions inherited from om::sound::filters::SoundFilter
virtual ~SoundFilter ()
 Destroy this sound filter object. More...
 
SoundResult read (SoundBuffer &outputBuffer, Size numSamples)
 Fill the specified output buffer with the requested number of samples, based on internal filter state. More...
 
SoundResult read (SoundFrame &outputFrame, Size numSamples)
 Fill the specified output frame with the requested number of samples, based on internal filter state. More...
 
SoundResult write (const SoundBuffer &inputBuffer, Size numSamples)
 Process the specified input buffer samples and do something with them. More...
 
SoundResult write (const SoundFrame &inputFrame, Size numSamples)
 Process the specified input frame samples and do something with them. More...
 
SoundResult process (const SoundBuffer &inputBuffer, SoundBuffer &outputBuffer, Size numSamples)
 Apply this filter to the specified input buffer data, placing the result in the output buffer. More...
 
SoundResult process (const SoundBuffer &inputBuffer, SoundFrame &outputFrame, Size numSamples)
 Apply this filter to the specified input buffer data, placing the result in the output frame. More...
 
SoundResult process (const SoundFrame &inputFrame, SoundFrame &outputFrame, Size numSamples)
 Apply this filter to the specified input frame data, placing the result in the output frame. More...
 
SoundResult process (const SoundFrame &inputBuffer, SoundBuffer &outputBuffer, Size numSamples)
 Apply this filter to the specified input frame data, placing the result in the output buffer. More...
 
void reset ()
 Signal to the filter that the audio stream is restarting. More...
 
UInt64 getFrameIndex () const
 Return the index of the next frame to be processed (or the current one if currently processing). More...
 
Size getInputCount () const
 Return the current number of audio inputs that this filter has. More...
 
virtual UTF8String getInputName (Index inputIndex) const
 Return a human-readable name of the filter audio input at the specified index. More...
 
Size getOutputCount () const
 Return the current number of audio outputs that this filter has. More...
 
virtual UTF8String getOutputName (Index outputIndex) const
 Return a human-readable name of the filter audio output at the specified index. More...
 
Size getMIDIInputCount () const
 Return the current number of MIDI inputs that this filter has. More...
 
virtual UTF8String getMIDIInputName (Index inputIndex) const
 Return a human-readable name of the filter MIDI input at the specified index. More...
 
Size getMIDIOutputCount () const
 Return the current number of MIDI outputs that this filter has. More...
 
virtual UTF8String getMIDIOutputName (Index outputIndex) const
 Return a human-readable name of the filter MIDI output at the specified index. More...
 
virtual Time getLatency () const
 Return a Time value indicating the latency of this sound filter in seconds. More...
 
virtual Bool getParameterIndex (const UTF8String &parameterName, Index &parameterIndex) const
 Query the index of the parameter with the specified name. More...
 
Bool getParameter (Index parameterIndex, FilterParameter &value) const
 Place the value of the parameter at the specified index in the output parameter. More...
 
Bool getParameter (Index parameterIndex, Bool &value) const
 Place the value of the parameter at the specified index in the output parameter. More...
 
Bool getParameter (Index parameterIndex, Int64 &value) const
 Place the value of the parameter at the specified index in the output parameter. More...
 
Bool getParameter (Index parameterIndex, Float32 &value) const
 Place the value of the parameter at the specified index in the output parameter. More...
 
Bool getParameter (Index parameterIndex, Float64 &value) const
 Place the value of the parameter at the specified index in the output parameter. More...
 
template<typename ParameterType >
Bool getParameter (const UTF8String &name, ParameterType &value) const
 Place the value of the parameter with the specified name in the output parameter. More...
 
template<typename ParameterType >
Bool getParameter (const char *name, ParameterType &value) const
 Place the value of the parameter with the specified name in the output parameter. More...
 
Bool setParameter (Index parameterIndex, const FilterParameter &value)
 Attempt to set the parameter value at the specified index. More...
 
Bool setParameter (Index parameterIndex, Bool value)
 Attempt to set the parameter value at the specified index. More...
 
Bool setParameter (Index parameterIndex, Int64 value)
 Attempt to set the parameter value at the specified index. More...
 
Bool setParameter (Index parameterIndex, Float32 value)
 Attempt to set the parameter value at the specified index. More...
 
Bool setParameter (Index parameterIndex, Float64 value)
 Attempt to set the parameter value at the specified index. More...
 
template<typename ParameterType >
Bool setParameter (const UTF8String &name, ParameterType value)
 Attempt to set the parameter value with the specified name. More...
 
template<typename ParameterType >
Bool setParameter (const char *name, ParameterType value)
 Attempt to set the parameter value with the specified name. More...
 
virtual Bool writeState (DataOutputStream &stream) const
 Write the current state of this sound filter to a data output stream. More...
 
virtual Bool readState (DataInputStream &stream)
 Read a previously saved filter state from the specified data input stream and replace the filter's state. More...
 
virtual Size getPresetCount () const
 Return the number of standard configuration presets that this sound filter has. More...
 
virtual Bool getPreset (Index presetIndex, FilterPreset &preset) const
 Get the standard preset for this sound filter with the specified index. More...
 
Bool getIsSynchronized () const
 Return whether or not this sound filter performs thread synchronization. More...
 
void setIsSynchronized (Bool newIsSynchronized)
 Set whether or not this sound filter performs thread synchronization. More...
 

Static Public Attributes

static const UTF8String NAME
 A string indicating the human-readable name of this tremolo. More...
 
static const UTF8String MANUFACTURER
 A string indicating the manufacturer name of this tremolo. More...
 
static const FilterVersion VERSION
 An object indicating the version of this tremolo. More...
 
- Static Public Attributes inherited from om::sound::filters::SoundFilter
static const om::resources::ResourceType RESOURCE_TYPE
 The resource type for a sound filter. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from om::sound::filters::SoundFilter
static Size getMaximumNumberOfInputs ()
 Return the maximum number of audio inputs that a SoundFilter can support. More...
 
static Size getMaximumNumberOfOutputs ()
 Return the maximum number of audio outputs that a SoundFilter can support. More...
 
static Size getMaximumNumberOfMIDIInputs ()
 Return the maximum number of MIDI inputs that a SoundFilter can support. More...
 
static Size getMaximumNumberOfMIDIOutputs ()
 Return the maximum number of MIDI outputs that a SoundFilter can support. More...
 
- Protected Member Functions inherited from om::sound::filters::SoundFilter
 SoundFilter ()
 Create a new sound filter with 1 audio input and output, and no MIDI inputs or outputs. More...
 
 SoundFilter (Size numInputs, Size numOutputs)
 Create a new sound filter with the specified number of audio inputs and outputs. More...
 
 SoundFilter (Size numInputs, Size numOutputs, Size numMIDIInputs, Size numMIDIOutputs)
 Create a new sound filter with the specified number of audio inputs and outputs. More...
 
void setInputCount (Size newNumInputs)
 Set the number of inputs that this filter should have. More...
 
void setOutputCount (Size newNumOutputs)
 Set the number of outputs that this filter should have. More...
 
void setMIDIInputCount (Size newNumMIDIInputs)
 Set the number of MIDI inputs that this filter should have. More...
 
void setMIDIOutputCount (Size newNumMIDIOutputs)
 Set the number of MIDI outputs that this filter should have. More...
 
Bool isFirstFrame () const
 Return whether or not the filter's next frame to be processed is also its first frame. More...
 
void lockMutex () const
 Acquire a mutex which handles subclass rendering parameter synchronization. More...
 
void unlockMutex () const
 Release a mutex which handles subclass rendering parameter synchronization. More...
 

Detailed Description

A class that periodically modulates the amplitude of an input signal.

A Tremolo filter takes the input sound and modulates the amplitude of that sound with a repeating wave function. This class supports several tremolo wave types: sinusoidal, square, saw, and triangle.

Member Enumeration Documentation

An enum type which describes the various types of wave shapes that a Tremolo can use.

Enumerator
SINE 

A pure sinusoidal oscillation of the input sound's amplitude.

SQUARE 

A softened square-wave oscillation of the input sound's amplitude.

SAW 

A softened saw-wave oscillation of the input sound's amplitude.

TRIANGLE 

A triangle-wave oscillation of the input sound's amplitude.

Constructor & Destructor Documentation

om::sound::filters::Tremolo::Tremolo ( )

Create a default sine-based tremolo filter with a depth of 6dB and frequency of 1Hz.

om::sound::filters::Tremolo::Tremolo ( WaveType  newType,
Float  newFrequency,
Gain  newDepth 
)

Create a tremolo with the specified modulation wave type, output gain, and frequency.

Member Function Documentation

WaveType om::sound::filters::Tremolo::getType ( ) const
inline

Return the type of modulation wave that this tremolo is using.

The wave type can be one of several types of audio test tones (sine waves, square waves, saw waves, triangle waves).

void om::sound::filters::Tremolo::setType ( WaveType  newType)
inline

Set the type of modulation wave that this tremolo is using.

The wave type can be one of several types of audio test tones (sine wave, square wave, saw wave, triangle wave). The tremolo filter switches wave types at the beginning of the next wave period so that it avoids discontinuities between the waves.

Float om::sound::filters::Tremolo::getFrequency ( ) const
inline

Return the frequency of this tremolo's modulation wave in hertz.

void om::sound::filters::Tremolo::setFrequency ( Float  newFrequency)
inline

Set the frequency of this tremolo's modulation wave in hertz.

Float om::sound::filters::Tremolo::getDepth ( ) const
inline

Return the maximum attenuation of the tremolo modulation in decibels.

This is the amount that the input signal is attenuated by whenever the modulation wave is at its lowest point. At the wave's peaks, the gain reduction is 0dB.

void om::sound::filters::Tremolo::setDepth ( Float  newDepth)
inline

Set the maximum attenuation of the tremolo modulation in decibels.

This is the amount that the input signal is attenuated by whenever the modulation wave is at its lowest point. At the wave's peaks, the gain reduction is 0dB.

The new depth value is clamped to the range of [0,+infinity].

Float om::sound::filters::Tremolo::getSmoothing ( ) const
inline

Return the smoothing amount for the tremolo's modulation wave.

This parameter is used to smooth abrupt amplitude transitions that are present for square and saw modulation waves. It has the range [0,1], where 0 indicates no smoothing and 1 indicates full smoothing. The smoothing value can be interpreted as the time (expressed as a fraction of a full modulation period) that it takes for the gain reduction stage to react to a change in the modulation wave.

void om::sound::filters::Tremolo::setSmoothing ( Float  newSmoothing)
inline

Set the smoothing amount for the tremolo's modulation wave.

This parameter is used to smooth abrupt amplitude transitions that are present for square and saw modulation waves. It has the range [0,1], where 0 indicates no smoothing and 1 indicates full smoothing. The smoothing value can be interpreted as the time (expressed as a fraction of a full modulation period) that it takes for the gain reduction stage to react to a change in the modulation wave.

The new smoothing amount is clamped to the valid range of [0,1].

Float om::sound::filters::Tremolo::getChannelPhase ( Index  channelIndex) const
inline

Return the modulation phase offset of the channel with the specified index.

This value, specified in degrees, indicates how much the phase of the channel should be shifted by. This parameter allows the creation of stereo (or higher) modulation effects. For example, if the phase of the left channel is 0 and the phase of the right channel is 180, the channels' modulation will be completely out-of-phase.

void om::sound::filters::Tremolo::setChannelPhase ( Index  channelIndex,
Float  newPhase 
)

Set the modulation phase offset of the channel with the specified index.

This value, specified in degrees, indicates how much the phase of the channel should be shifted by. This parameter allows the creation of stereo (or higher) modulation effects. For example, if the phase of the left channel is 0 and the phase of the right channel is 180, the channels' modulation will be completely out-of-phase.

The input phase value is clamped so that the new phase value lies between -180 and 180 degrees.

void om::sound::filters::Tremolo::setChannelPhase ( Float  newPhase)

Set the modulation phase offset for all channels.

Doing this brings all channels into phase with each other (regardless of what phase that is).

The input phase value is clamped so that the new phase value lies between -180 and 180 degrees.

virtual UTF8String om::sound::filters::Tremolo::getName ( ) const
virtual

Return a human-readable name for this tremolo.

The method returns the string "Tremolo".

Reimplemented from om::sound::filters::SoundFilter.

virtual UTF8String om::sound::filters::Tremolo::getManufacturer ( ) const
virtual

Return the manufacturer name of this tremolo.

The method returns the string "Om Sound".

Reimplemented from om::sound::filters::SoundFilter.

virtual FilterVersion om::sound::filters::Tremolo::getVersion ( ) const
virtual

Return an object representing the version of this tremolo.

Reimplemented from om::sound::filters::SoundFilter.

virtual FilterCategory om::sound::filters::Tremolo::getCategory ( ) const
virtual

Return an object that describes the category of effect that this filter implements.

This method returns the value FilterCategory::MODULATION.

Reimplemented from om::sound::filters::SoundFilter.

virtual Bool om::sound::filters::Tremolo::allowsInPlaceProcessing ( ) const
virtual

Return whether or not this tremolo can process audio data in-place.

This method always returns TRUE, tremolos can process audio data in-place.

Reimplemented from om::sound::filters::SoundFilter.

virtual Size om::sound::filters::Tremolo::getParameterCount ( ) const
virtual

Return the total number of generic accessible parameters this tremolo has.

Reimplemented from om::sound::filters::SoundFilter.

virtual Bool om::sound::filters::Tremolo::getParameterInfo ( Index  parameterIndex,
FilterParameterInfo info 
) const
virtual

Get information about the tremolo parameter at the specified index.

Reimplemented from om::sound::filters::SoundFilter.

virtual Bool om::sound::filters::Tremolo::getParameterValueName ( Index  parameterIndex,
const FilterParameter value,
UTF8String &  name 
) const
virtual

Get any special name associated with the specified value of an indexed parameter.

Reimplemented from om::sound::filters::SoundFilter.

Member Data Documentation

const UTF8String om::sound::filters::Tremolo::NAME
static

A string indicating the human-readable name of this tremolo.

const UTF8String om::sound::filters::Tremolo::MANUFACTURER
static

A string indicating the manufacturer name of this tremolo.

const FilterVersion om::sound::filters::Tremolo::VERSION
static

An object indicating the version of this tremolo.


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