pub struct Dsp { /* private fields */ }Implementations§
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 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.
pub fn set_raw_userdata(&self, userdata: *mut c_void) -> Result<()>
pub fn get_raw_userdata(&self) -> Result<*mut c_void>
Sourcepub fn get_system(&self) -> Result<System>
pub fn get_system(&self) -> Result<System>
Retrieves the parent System object.
Source§impl Dsp
impl Dsp
pub fn set_userdata(&self, userdata: Userdata) -> Result<()>
pub fn get_userdata(&self) -> Result<Option<Userdata>>
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 System::init 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 System::init 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 System::init 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 set_parameter_bool(&self, index: c_int, value: bool) -> Result<()>
pub fn set_parameter_bool(&self, index: c_int, value: bool) -> Result<()>
Sets a boolean parameter by index.
Sourcepub fn get_parameter_bool(&self, index: c_int) -> Result<bool>
pub fn get_parameter_bool(&self, index: c_int) -> Result<bool>
Retrieves a boolean parameter by index.
Note: FMOD also returns a string representation of the parameter value, but this is not currently exposed.
You can just use ToString instead.
Sourcepub unsafe fn set_parameter_data(&self, index: c_int, data: &[u8]) -> Result<()>
pub unsafe fn set_parameter_data(&self, index: c_int, data: &[u8]) -> Result<()>
Sets a binary data parameter by index.
Certain data types are predefined by the system and can be specified via the FMOD_DSP_PARAMETER_DESC_DATA, see DspParameterDataType
§Safety
You must ensure that the data type passed in via data matches the data type expected by the Dsp unit.
Sourcepub fn get_parameter_data(&self, index: c_int) -> Result<Vec<u8>>
pub fn get_parameter_data(&self, index: c_int) -> Result<Vec<u8>>
Retrieves a binary data parameter by index.
Note: FMOD also returns a string representation of the parameter value, but this is not currently exposed.
Sourcepub fn set_parameter_float(&self, index: c_int, value: c_float) -> Result<()>
pub fn set_parameter_float(&self, index: c_int, value: c_float) -> Result<()>
Sets a floating point parameter by index.
Sourcepub fn get_parameter_float(&self, index: c_int) -> Result<c_float>
pub fn get_parameter_float(&self, index: c_int) -> Result<c_float>
Retrieves a floating point parameter by index.
Note: FMOD also returns a string representation of the parameter value, but this is not currently exposed.
You can just use ToString instead.
Sourcepub fn set_parameter_int(&self, index: c_int, value: c_int) -> Result<()>
pub fn set_parameter_int(&self, index: c_int, value: c_int) -> Result<()>
Sets an integer parameter by index.
Sourcepub fn get_parameter_int(&self, index: c_int) -> Result<c_int>
pub fn get_parameter_int(&self, index: c_int) -> Result<c_int>
Retrieves an integer parameter by index.
Note: FMOD also returns a string representation of the parameter value, but this is not currently exposed.
You can just use ToString instead.
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.
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.