Om
1.0.0
A universal framework for multimedia simulation
|
A class that generates different types of test tones. More...
#include <omSoundToneGenerator.h>
Public Types | |
enum | ToneType { SINE = 0, SQUARE = 1, SAW = 2, TRIANGLE = 3, WHITE_NOISE = 4, PINK_NOISE = 5, PINK_NOISE_BAND = 6 } |
An enum type which describes the various types of tones that a ToneGenerator can produce. More... | |
Public Member Functions | |
ToneGenerator () | |
Create a tone generator which generates a sine wave at 1000 Hz. More... | |
ToneGenerator (ToneType newType) | |
Create a tone generator with the specified tone type at 1000 Hz. More... | |
ToneGenerator (ToneType newType, Gain newOutputGain) | |
Create a tone generator with the specified tone type and output gain with frequency at 1000Hz. More... | |
ToneGenerator (ToneType newType, Gain newOutputGain, Float newFrequency) | |
Create a tone generator with the specified tone type, output gain, and frequency. More... | |
ToneGenerator (const ToneGenerator &other) | |
Create a copy of the specified tone generator. More... | |
~ToneGenerator () | |
Destory this tone generator and release all of its resources. More... | |
ToneGenerator & | operator= (const ToneGenerator &other) |
Assign the state of one tone generator to this one. More... | |
ToneType | getType () const |
Return the type of tone that this tone generator is generating. More... | |
void | setType (ToneType newType) |
Set the type of tone that this tone generator is generating. More... | |
Float | getFrequency () const |
Return the frequency of this tone generator in hertz. More... | |
void | setFrequency (Float newFrequency) |
Set the frequency of this tone generator in hertz. More... | |
Float | getBandwidth () const |
Return the frequency bandwidth of this tone generator in octaves. More... | |
void | setBandwidth (Float newBandwidth) |
Return the frequency bandwidth of this tone generator in octaves. More... | |
Gain | getOutputGain () const |
Return the linear output gain of this tone generator. More... | |
Gain | getOutputGainDB () const |
Return the output gain of this tone generator in decibels. More... | |
void | setOutputGain (Gain newOutputGain) |
Set the linear output gain of this tone generator. More... | |
void | setOutputGainDB (Gain newDBOutputGain) |
Set the output gain of this tone generator in decibels. More... | |
virtual UTF8String | getName () const |
Return a human-readable name for this tone generator. More... | |
virtual UTF8String | getManufacturer () const |
Return the manufacturer name of this tone generator. More... | |
virtual FilterVersion | getVersion () const |
Return an object representing the version of this tone generator. 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 tone generator can process audio data in-place. More... | |
virtual Size | getParameterCount () const |
Return the total number of generic accessible parameters this filter has. More... | |
virtual Bool | getParameterInfo (Index parameterIndex, FilterParameterInfo &info) const |
Get information about the filter 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 ¶meterName, Index ¶meterIndex) 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 tone generator. More... | |
static const UTF8String | MANUFACTURER |
A string indicating the manufacturer name of this tone generator. More... | |
static const FilterVersion | VERSION |
An object indicating the version of this tone generator. 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... | |
A class that generates different types of test tones.
These tones are common signals used in testing audio equipment such as white noise, pink noise, sine waves, and other types of repeating waves. These tones can also be used as an oscilation source for a synthesizer or other virtual instrument.
All of the tones that are generated by a ToneGenerator are peak-normalized to just under 0dBFS when the output gain of the generator is 0dB.
An enum type which describes the various types of tones that a ToneGenerator can produce.
om::sound::filters::ToneGenerator::ToneGenerator | ( | ) |
Create a tone generator which generates a sine wave at 1000 Hz.
om::sound::filters::ToneGenerator::ToneGenerator | ( | ToneType | newType | ) |
Create a tone generator with the specified tone type at 1000 Hz.
This constructor can be used to create tone generators for tone types that don't specify a frequency (white noise, pink noise).
om::sound::filters::ToneGenerator::ToneGenerator | ( | ToneType | newType, |
Gain | newOutputGain | ||
) |
Create a tone generator with the specified tone type and output gain with frequency at 1000Hz.
This constructor can be used to create tone generators for tone types that don't specify a frequency (white noise, pink noise).
om::sound::filters::ToneGenerator::ToneGenerator | ( | ToneType | newType, |
Gain | newOutputGain, | ||
Float | newFrequency | ||
) |
Create a tone generator with the specified tone type, output gain, and frequency.
om::sound::filters::ToneGenerator::ToneGenerator | ( | const ToneGenerator & | other | ) |
Create a copy of the specified tone generator.
om::sound::filters::ToneGenerator::~ToneGenerator | ( | ) |
Destory this tone generator and release all of its resources.
ToneGenerator& om::sound::filters::ToneGenerator::operator= | ( | const ToneGenerator & | other | ) |
Assign the state of one tone generator to this one.
|
inline |
Return the type of tone that this tone generator is generating.
The tone type can be one of several types of audio test tones (sine waves, square waves, saw waves, triangle waves, white noise, pink noise, etc.).
|
inline |
Set the type of tone that this tone generator is generating.
The tone type can be one of several types of audio test tones (sine waves, square waves, saw waves, triangle waves, white noise, pink noise, etc.).
|
inline |
Return the frequency of this tone generator in hertz.
For frequency-local tones (i.e. not full-spectrum noise), this value indicates the dominant frequency of the generated tone. For most wave types (sine, square, saw, triangle) this is the frequency of the generated wave.
This value has no effect for other noise types that contain information across the entire frequency spectrum (pink noise, white noise, etc.).
|
inline |
Set the frequency of this tone generator in hertz.
For frequency-local tones (i.e. not full-spectrum noise), this value indicates the dominant frequency of the generated tone. For most wave types (sine, square, saw, triangle) this is the frequency of the generated wave.
This value has no effect for other noise types that contain information across the entire frequency spectrum (pink noise, white noise, etc.).
|
inline |
Return the frequency bandwidth of this tone generator in octaves.
This value is used to determine the width of the tone generator's noise band pass filter. The default value is 0.33333, or 1/3 of an octave.
|
inline |
Return the frequency bandwidth of this tone generator in octaves.
This value is used to determine the width of the tone generator's noise band pass filter. The default value is 0.33333, or 1/3 of an octave.
The new bandwidth is clamped to the range [0,10].
|
inline |
Return the linear output gain of this tone generator.
This is gain scaling factor that is applied to the output of whatever tone is being currently generated. The different tones are normalized to 0 dBFS, or as close as is possible. This factor adjusts their output level relative to that baseline. The default value is 0.5.
|
inline |
Return the output gain of this tone generator in decibels.
This is gain scaling factor that is applied to the output of whatever tone is being currently generated. The different tones are normalized to 0 dBFS, or as close as is possible. This factor adjusts their output level relative to that baseline. The default value is -6dB.
|
inline |
Set the linear output gain of this tone generator.
This is gain scaling factor that is applied to the output of whatever tone is being currently generated. The different tones are normalized to 0 dBFS, or as close as is possible. This factor adjusts their output level relative to that baseline. The default value is 0.5.
|
inline |
Set the output gain of this tone generator in decibels.
This is gain scaling factor that is applied to the output of whatever tone is being currently generated. The different tones are normalized to 0 dBFS, or as close as is possible. This factor adjusts their output level relative to that baseline. The default value is -6dB.
|
virtual |
Return a human-readable name for this tone generator.
The method returns the string "Tone Generator".
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return the manufacturer name of this tone generator.
The method returns the string "Om Sound".
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return an object representing the version of this tone generator.
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return an object that describes the category of effect that this filter implements.
This method returns the value FilterCategory::ANALYSIS.
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return whether or not this tone generator can process audio data in-place.
This method always returns TRUE, tone generators can process audio data in-place.
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return the total number of generic accessible parameters this filter has.
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Get information about the filter parameter at the specified index.
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Get any special name associated with the specified value of an indexed parameter.
Reimplemented from om::sound::filters::SoundFilter.
|
static |
A string indicating the human-readable name of this tone generator.
|
static |
A string indicating the manufacturer name of this tone generator.
|
static |
An object indicating the version of this tone generator.