pub struct Dsp { /* private fields */ }
Expand description
A digital signal processor is one node within a graph that transforms input audio signals into an output stream.
Create with System::create_dsp
, System::create_dsp_by_type
or System::create_dsp_by_plugin
.
Implementations§
Source§impl Dsp
impl Dsp
Sourcepub fn set_callback<C: DspCallback>(&self) -> Result<()>
pub fn set_callback<C: DspCallback>(&self) -> Result<()>
Sets the callback for DSP notifications.
Source§impl Dsp
impl Dsp
Sourcepub fn set_channel_format(
&self,
channel_mask: ChannelMask,
channel_count: c_int,
source_speaker_mode: SpeakerMode,
) -> Result<()>
pub fn set_channel_format( &self, channel_mask: ChannelMask, channel_count: c_int, source_speaker_mode: SpeakerMode, ) -> Result<()>
Sourcepub fn get_channel_format(&self) -> Result<(ChannelMask, c_int, SpeakerMode)>
pub fn get_channel_format(&self) -> Result<(ChannelMask, c_int, SpeakerMode)>
Retrieves the PCM input format this Dsp
will receive when processing.
Sourcepub fn get_output_channel_format(
&self,
in_mask: ChannelMask,
in_channels: c_int,
in_speaker_mode: SpeakerMode,
) -> Result<(ChannelMask, c_int, SpeakerMode)>
pub fn get_output_channel_format( &self, in_mask: ChannelMask, in_channels: c_int, in_speaker_mode: SpeakerMode, ) -> Result<(ChannelMask, c_int, SpeakerMode)>
Retrieves the output format this Dsp
will produce when processing based on the input specified.
Source§impl Dsp
impl Dsp
Sourcepub fn add_input(
&self,
input: Dsp,
kind: DspConnectionType,
) -> Result<DspConnection>
pub fn add_input( &self, input: Dsp, kind: DspConnectionType, ) -> Result<DspConnection>
Adds a Dsp
unit as an input to this object.
When a Dsp
has multiple inputs the signals are automatically mixed together, sent to the unit’s output(s).
The returned DspConnection
will remain valid until the units are disconnected.
Sourcepub fn get_input(&self, index: c_int) -> Result<(Dsp, DspConnection)>
pub fn get_input(&self, index: c_int) -> Result<(Dsp, DspConnection)>
Retrieves the Dsp
unit at the specified index in the input list.
This will flush the Dsp
queue (which blocks against the mixer) to ensure the input list is correct, avoid this during time sensitive operations.
The returned DspConnection
will remain valid until the units are disconnected.
Sourcepub fn get_output(&self, index: c_int) -> Result<(Dsp, DspConnection)>
pub fn get_output(&self, index: c_int) -> Result<(Dsp, DspConnection)>
Retrieves the Dsp
unit at the specified index in the output list.
This will flush the Dsp
queue (which blocks against the mixer) to ensure the output list is correct, avoid this during time sensitive operations.
The returned DspConnection
will remain valid until the units are disconnected.
Sourcepub fn get_input_count(&self) -> Result<c_int>
pub fn get_input_count(&self) -> Result<c_int>
Sourcepub fn get_output_count(&self) -> Result<c_int>
pub fn get_output_count(&self) -> Result<c_int>
Sourcepub fn disconnect_all(&self, inputs: bool, outputs: bool) -> Result<()>
pub fn disconnect_all(&self, inputs: bool, outputs: bool) -> Result<()>
Disconnects all inputs and/or outputs.
This is a convenience function that is faster than disconnecting all inputs and outputs individually.
Sourcepub fn disconnect_from(
&self,
target: Option<Dsp>,
connection: Option<DspConnection>,
) -> Result<()>
pub fn disconnect_from( &self, target: Option<Dsp>, connection: Option<DspConnection>, ) -> Result<()>
Source§impl Dsp
impl Dsp
Sourcepub unsafe fn show_config_dialogue(
&self,
hwnd: *mut c_void,
show: bool,
) -> Result<()>
pub unsafe fn show_config_dialogue( &self, hwnd: *mut c_void, show: bool, ) -> Result<()>
Display or hide a DSP unit configuration dialog box inside the target window.
Some DSP plug-ins (especially VST plug-ins) use dialog boxes to display graphical user interfaces for modifying their parameters,
rather than using the other method of enumerating their parameters and setting them
with Dsp::set_parameter
.
To find out what size window to create to store the configuration screen, use Dsp::get_info
where you can get the width and height.
§Safety
hwnd
must be a valid window pointer.
On Windows, this would be a HWND
, on X11 a window id, etc.
Sourcepub fn release(&self) -> Result<()>
pub fn release(&self) -> Result<()>
Frees a Dsp
object.
If Dsp
is not removed from the network with ChannelControl::removeDSP
after being added with ChannelControl::addDSP
,
it will not release and will instead return FMOD_RESULT::FMOD_ERR_DSP_INUSE
.
Sourcepub fn get_type(&self) -> Result<DspType>
pub fn get_type(&self) -> Result<DspType>
Retrieves the pre-defined type of a FMOD registered Dsp
unit.
Sourcepub fn get_cpu_usage(&self) -> Result<(c_uint, c_uint)>
pub fn get_cpu_usage(&self) -> Result<(c_uint, c_uint)>
Retrieves statistics on the mixer thread CPU usage for this unit.
crate::InitFlags::PROFILE_ENABLE
with crate::SystemBuilder::new
is required to call this function.
Sourcepub fn get_userdata(&self) -> Result<*mut c_void>
pub fn get_userdata(&self) -> Result<*mut c_void>
Retrieves user data.
Sourcepub fn get_system(&self) -> Result<System>
pub fn get_system(&self) -> Result<System>
Retrieves the parent System object.
Source§impl Dsp
impl Dsp
Sourcepub fn get_metering_info(&self) -> Result<(DspMeteringInfo, DspMeteringInfo)>
pub fn get_metering_info(&self) -> Result<(DspMeteringInfo, DspMeteringInfo)>
Retrieve the signal metering information.
Requesting metering information when it hasn’t been enabled will result in FMOD_RESULT::FMOD_ERR_BADCOMMAND
.
FMOD_INIT_PROFILE_METER_ALL
with SystemBuilder::build
will automatically enable metering for all Dsp
units.
Sourcepub fn set_metering_enabled(
&self,
input_enabled: bool,
output_enabled: bool,
) -> Result<()>
pub fn set_metering_enabled( &self, input_enabled: bool, output_enabled: bool, ) -> Result<()>
Sets the input and output signal metering enabled states.
Input metering is pre processing, while output metering is post processing.
Enabled metering allows Dsp::get_metering_info
to return metering information and allows FMOD profiling tools to visualize the levels.
FMOD_INIT_PROFILE_METER_ALL
with SystemBuilder::build
will automatically turn on metering for all Dsp
units inside the mixer graph.
This function must have inputEnabled and outputEnabled set to true if being used by the FMOD Studio API, such as in the Unity or Unreal Engine integrations, in order to avoid conflict with FMOD Studio’s live update feature.
Sourcepub fn get_metering_enabled(&self) -> Result<(bool, bool)>
pub fn get_metering_enabled(&self) -> Result<(bool, bool)>
Retrieves the input and output signal metering enabled states.
Input metering is pre processing, while output metering is post processing.
Enabled metering allows Dsp::get_metering_info
to return metering information and allows FMOD profiling tools to visualize the levels.
FMOD_INIT_PROFILE_METER_ALL
with SystemBuilder::build
will automatically turn on metering for all Dsp
units inside the mixer graph.
Source§impl Dsp
impl Dsp
Sourcepub fn get_data_parameter_index(
&self,
data_type: DspParameterDataType,
) -> Result<c_int>
pub fn get_data_parameter_index( &self, data_type: DspParameterDataType, ) -> Result<c_int>
Retrieve the index of the first data parameter of a particular data type.
This function returns Ok
if a parmeter of matching type is found and FMOD_RESULT::FMOD_ERR_INVALID_PARAM
if no matches were found.
The return code can be used to check whether the Dsp
supports specific functionality through data parameters of certain types without the need to provide index.
Sourcepub fn get_parameter_count(&self) -> Result<c_int>
pub fn get_parameter_count(&self) -> Result<c_int>
Retrieves the number of parameters exposed by this unit.
Use this to enumerate all parameters of a Dsp
unit with Dsp::get_parameter_info
.
Sourcepub fn get_parameter_info(
&self,
index: c_int,
) -> Result<DspParameterDescription>
pub fn get_parameter_info( &self, index: c_int, ) -> Result<DspParameterDescription>
Retrieve information about a specified parameter.
Sourcepub fn get_raw_parameter_info(
&self,
index: c_int,
) -> Result<FMOD_DSP_PARAMETER_DESC>
pub fn get_raw_parameter_info( &self, index: c_int, ) -> Result<FMOD_DSP_PARAMETER_DESC>
Retrieve information about a specified parameter.
Returns the raw struct, useful if you don’t want to pay for the expensive pointer copies
that converting a FMOD_DSP_PARAMETER_DESC
to a DspParameterDescription
would entail.
Sourcepub fn set_parameter<I, P>(&self, index: I, parameter: P) -> Result<()>where
I: WritableParameterIndex<P>,
P: WritableParameter,
pub fn set_parameter<I, P>(&self, index: I, parameter: P) -> Result<()>where
I: WritableParameterIndex<P>,
P: WritableParameter,
Sets a parameter by index.
The parameter must be writable and index must be a type that impls WritableParameterIndex<P>
.
Notably, c_int
impls WritableParameterIndex<T>
for any T
.
Sourcepub fn get_parameter<I, P>(&self, index: I) -> Result<P>where
I: ReadableParameterIndex<P>,
P: ReadableParameter,
pub fn get_parameter<I, P>(&self, index: I) -> Result<P>where
I: ReadableParameterIndex<P>,
P: ReadableParameter,
Gets a parameter by index.
The parameter must be readable and index must be a type that impls ReadableParameterIndex<P>
.
Notably, c_int
impls ReadableParameterIndex<T>
for any T
.
Sourcepub fn get_parameter_string<P, I>(&self, index: I) -> Result<Utf8CString>where
I: ReadableParameterIndex<P>,
P: ReadableParameter,
pub fn get_parameter_string<P, I>(&self, index: I) -> Result<Utf8CString>where
I: ReadableParameterIndex<P>,
P: ReadableParameter,
Gets a parameter by index.
The parameter must be readable and index must be a type that impls ReadableParameterIndex<P>
.
Notably, c_int
impls ReadableParameterIndex<T>
for any T
.
Source§impl Dsp
impl Dsp
Sourcepub fn set_active(&self, active: bool) -> Result<()>
pub fn set_active(&self, active: bool) -> Result<()>
Sets the processing active state.
If active is false, processing of this unit and its inputs are stopped.
When created a Dsp
is inactive. If ChannelControl::addDSP
is used it will automatically be activated, otherwise it must be set to active manually.
Sourcepub fn get_active(&self) -> Result<bool>
pub fn get_active(&self) -> Result<bool>
Retrieves the processing active state.
If active is False, processing of this unit and its inputs are stopped.
When created a Dsp
is inactive.
If ChannelControl::addDSP
is used it will automatically be activated, otherwise it must be set to active manually.
Sourcepub fn set_bypass(&self, bypass: bool) -> Result<()>
pub fn set_bypass(&self, bypass: bool) -> Result<()>
Sets the processing bypass state.
If bypass
is true, processing of this unit is skipped but it continues to process its inputs.
Sourcepub fn get_bypass(&self) -> Result<bool>
pub fn get_bypass(&self) -> Result<bool>
Retrieves the processing bypass state.
If bypass
is true, processing of this unit is skipped but it continues to process its inputs.
Sourcepub fn set_wet_dry_mix(
&self,
pre_wet: c_float,
post_wet: c_float,
dry: c_float,
) -> Result<()>
pub fn set_wet_dry_mix( &self, pre_wet: c_float, post_wet: c_float, dry: c_float, ) -> Result<()>
Sets the scale of the wet and dry signal components.
The dry signal path is silent by default, because dsp effects transform the input and pass the newly processed result to the output.
Sourcepub fn get_wet_dry_mix(&self) -> Result<(c_float, c_float, c_float)>
pub fn get_wet_dry_mix(&self) -> Result<(c_float, c_float, c_float)>
Retrieves the scale of the wet and dry signal components.
Sourcepub fn get_idle(&self) -> Result<bool>
pub fn get_idle(&self) -> Result<bool>
Retrieves the idle state.
A Dsp
is considered idle when it stops receiving input signal and all internal processing of stored input has been exhausted.
Each Dsp
type has the potential to have differing idle behaviour based on the type of effect.
A reverb or echo may take a longer time to go idle after it stops receiving a valid signal, compared to an effect with a shorter tail length like an EQ filter.
Trait Implementations§
impl Copy for Dsp
impl Eq for Dsp
impl Send for Dsp
thread-unsafe
only.impl StructuralPartialEq for Dsp
impl Sync for Dsp
thread-unsafe
only.