Om
1.0.0
A universal framework for multimedia simulation
|
A class that is used to filter input audio data into an arbitrary number of frequency band outputs. More...
#include <omSoundCrossover.h>
Public Member Functions | |
Crossover () | |
Create a default crossover with no split frequencies and one full-range frequency band output. More... | |
Crossover (const Crossover &newCrossover) | |
Create an exact copy of the specified crossover. More... | |
~Crossover () | |
Destroy a crossover and release all of its resources. More... | |
Crossover & | operator= (const Crossover &other) |
Assign the state of the specified crossover object to this crossover. More... | |
Size | getFilterCount () const |
Return the total number of crossover frequencies that this crossover has. More... | |
Bool | addFilter (Float newFrequency, Size newFilterOrder=Size(4)) |
Add a new crossover frequency to this Crossover, specifying the filter order. More... | |
void | removeFilter (Index filterIndex) |
Remove the crossover point filter at the specified index in this Crossover. More... | |
void | clearFilters () |
Remove all crossover filters from this Crossover. More... | |
Size | getBandCount () const |
Return the total number of frequency bands that this crossover produces. More... | |
AABB1f | getBandRange (Index bandIndex) const |
Return a 1D range value indicating the range of frequencies for the specified frequency band index. More... | |
Float | getFilterFrequency (Index filterIndex) const |
Return the frequency in hertz of the crossover filter at the specified index. More... | |
Bool | setFilterFrequency (Index filterIndex, Float newFrequency) |
Set the frequency in hertz of the crossover filter at the specified index. More... | |
Size | getFilterOrder (Index filterIndex) const |
Return the order of the crossover filter at the specified index. More... | |
Bool | setFilterOrder (Index filterIndex, Size newOrder) |
Set the order of the crossover filter at the specified index. More... | |
Bool | getIsMultiInput () const |
Return a boolean value indicating whether or not the crossover is given a multiband multi-input format. More... | |
Bool | setIsMultiInput (Bool newIsMultiInput) |
Return a boolean value indicating whether or not the crossover is given a multiband multi-input format. More... | |
virtual UTF8String | getOutputName (Index outputIndex) const |
Return a human-readable name of the crossover filter output at the specified index. More... | |
virtual UTF8String | getName () const |
Return a human-readable name for this cutoff filter. More... | |
virtual UTF8String | getManufacturer () const |
Return the manufacturer name of this crossover filter. More... | |
virtual FilterVersion | getVersion () const |
Return an object representing the version of this crossover filter. More... | |
virtual FilterCategory | getCategory () const |
Return an object that describes the category of effect that this filter implements. 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... | |
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 Size | getParameterCount () const |
Return the total number of generic accessible parameters this filter has. More... | |
virtual Bool | getParameterIndex (const UTF8String ¶meterName, Index ¶meterIndex) const |
Query the index of the parameter with the specified name. 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... | |
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... | |
virtual Bool | allowsInPlaceProcessing () const |
Return whether or not this sound filter can process audio data in-place. More... | |
Static Public Attributes | |
static const UTF8String | NAME |
A string indicating the human-readable name of this crossover filter. More... | |
static const UTF8String | MANUFACTURER |
A string indicating the manufacturer name of this crossover filter. More... | |
static const FilterVersion | VERSION |
An object indicating the version of this crossover filter. 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... | |
virtual Bool | getParameterValue (Index parameterIndex, FilterParameter &value) const |
Place the value of the parameter at the specified index in the output parameter. More... | |
virtual Bool | setParameterValue (Index parameterIndex, const FilterParameter &value) |
Attempt to set the parameter value at the specified index. 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 is used to filter input audio data into an arbitrary number of frequency band outputs.
The Crossover class uses a series of Linkwitz-Riley order crossover filters to split a stream of input audio into an arbitrary number of frequency bands whose corner frequencies can be between 0Hz and the Nyquist Frequency for the current operating sample rate.
Each crossover filter (a high-pass, low-pass pair) can have any even order N. Special care is taken to keep the outputs of the crossover in phase and all-pass at all frequencies.
The crossover keeps an internal list of the crossover filters, sorted by frequency. Therefore, if you add filters to the crossover in arbitrary order, they are automatically sorted, so don't expect the filters to be stored in the order in which they were added.
om::sound::filters::Crossover::Crossover | ( | ) |
Create a default crossover with no split frequencies and one full-range frequency band output.
om::sound::filters::Crossover::Crossover | ( | const Crossover & | newCrossover | ) |
Create an exact copy of the specified crossover.
om::sound::filters::Crossover::~Crossover | ( | ) |
Destroy a crossover and release all of its resources.
Assign the state of the specified crossover object to this crossover.
|
inline |
Return the total number of crossover frequencies that this crossover has.
This value is 0 for a crossover with no crossover points and is equal to (n-1) for a crossover with (n) frequency bands.
Add a new crossover frequency to this Crossover, specifying the filter order.
If the specified frequency is not within the valid range of 0 to the Nyquist Frequency, this method has no effect and FALSE is returned. Otherwise, the frequency is added to the Crossover and TRUE is returned. If the method succeeds, the resulting Crossover will have one more output frequency band than it had before.
This version of this method allows the user to specify the filter order used for the new crossover filter. Order values are clamped to the range [2,8]. Since Linkwitz-Riley crossover filters are used, the actual filter order will be the next even number greater than or equal to the specified filter order.
newFrequency | - the crossover frequency to add to this Crossover. |
newFilterOrder | - the crossover filter order to use. |
void om::sound::filters::Crossover::removeFilter | ( | Index | filterIndex | ) |
Remove the crossover point filter at the specified index in this Crossover.
If the specified filter index is valid, the crossover filter at that index is removed and the number of output frequency bands for the crossover is reduced by one. Otherwise, the method has no effect.
void om::sound::filters::Crossover::clearFilters | ( | ) |
|
inline |
Return the total number of frequency bands that this crossover produces.
This value is 1 for a crossover with no crossover points, with one additional band for each crossover split frequency.
|
inline |
Return a 1D range value indicating the range of frequencies for the specified frequency band index.
Return the frequency in hertz of the crossover filter at the specified index.
Set the frequency in hertz of the crossover filter at the specified index.
This method resorts the crossover points based on the specified frequency change so that they remain sorted.
The method returns whether or not the filter frequency was able to be changed. It can fail if the given filter index or frequency is invalid.
Return the order of the crossover filter at the specified index.
Set the order of the crossover filter at the specified index.
|
inline |
Return a boolean value indicating whether or not the crossover is given a multiband multi-input format.
If this value is TRUE, the crossover will use the audio from each input for the corresponding output, rather than using only the first input. The number of inputs in this case will be the same as the number of outputs. If this value is FALSE, the first input is used to feed all frequency band outputs.
Return a boolean value indicating whether or not the crossover is given a multiband multi-input format.
If this value is TRUE, the crossover will use the audio from each input for the corresponding output, rather than using only the first input. The number of inputs in this case will be the same as the number of outputs. If this value is FALSE, the first input is used to feed all frequency band outputs.
|
virtual |
Return a human-readable name of the crossover filter output at the specified index.
This method returns the string "Output N" where N is the index of the frequency band, starting at 0.
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return a human-readable name for this cutoff filter.
The method returns the string "Crossover".
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return the manufacturer name of this crossover filter.
The method returns the string "Om Sound".
Reimplemented from om::sound::filters::SoundFilter.
|
virtual |
Return an object representing the version of this crossover filter.
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::EQUALIZER.
Reimplemented from om::sound::filters::SoundFilter.
|
static |
A string indicating the human-readable name of this crossover filter.
|
static |
A string indicating the manufacturer name of this crossover filter.
|
static |
An object indicating the version of this crossover filter.