Struct Dsp

Source
pub struct Dsp { /* private fields */ }

Implementations§

Source§

impl Dsp

Source

pub fn set_channel_format( &self, channel_mask: ChannelMask, channel_count: c_int, source_speaker_mode: SpeakerMode, ) -> Result<()>

Sets the PCM input format this Dsp will receive when processing.

Setting the number of channels on a unit will force either a down or up mix to that channel count before processing the Dsp read/process callback.

Source

pub fn get_channel_format(&self) -> Result<(ChannelMask, c_int, SpeakerMode)>

Retrieves the PCM input format this Dsp will receive when processing.

Source

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

Source

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.

Source

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.

Source

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.

Source

pub fn get_input_count(&self) -> Result<c_int>

Retrieves the number of Dsp units 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.

Source

pub fn get_output_count(&self) -> Result<c_int>

Retrieves the number of Dsp units 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.

Source

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.

Source

pub fn disconnect_from( &self, target: Option<Dsp>, connection: Option<DspConnection>, ) -> Result<()>

Disconnect the specified input Dsp.

If target had only one output, after this operation that entire sub graph will no longer be connected to the Dsp network.

After this operation connection is no longer valid.

Source§

impl Dsp

Source

pub fn reset(&self) -> Result<()>

Reset a DSPs internal state ready for new input signal.

This will clear all internal state derived from input signal while retaining any set parameter values. The intended use of the function is to avoid audible artifacts if moving the Dsp from one part of the Dsp network to another.

Source

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.

Source

pub fn get_type(&self) -> Result<DspType>

Retrieves the pre-defined type of a FMOD registered Dsp unit.

Source

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.

Source

pub fn set_raw_userdata(&self, userdata: *mut c_void) -> Result<()>

Source

pub fn get_raw_userdata(&self) -> Result<*mut c_void>

Source

pub fn get_system(&self) -> Result<System>

Retrieves the parent System object.

Source§

impl Dsp

Source

pub fn set_userdata(&self, userdata: Userdata) -> Result<()>

Source

pub fn get_userdata(&self) -> Result<Option<Userdata>>

Source§

impl Dsp

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

pub fn set_parameter_bool(&self, index: c_int, value: bool) -> Result<()>

Sets a boolean parameter by index.

Source

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.

Source

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.

Source

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.

Source

pub fn set_parameter_float(&self, index: c_int, value: c_float) -> Result<()>

Sets a floating point parameter by index.

Source

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.

Source

pub fn set_parameter_int(&self, index: c_int, value: c_int) -> Result<()>

Sets an integer parameter by index.

Source

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.

Source

pub fn get_parameter_info( &self, index: c_int, ) -> Result<DspParameterDescription>

Retrieve information about a specified parameter.

Source§

impl Dsp

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn get_wet_dry_mix(&self) -> Result<(c_float, c_float, c_float)>

Retrieves the scale of the wet and dry signal components.

Source

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§

Source§

impl Clone for Dsp

Source§

fn clone(&self) -> Dsp

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dsp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<*mut FMOD_DSP> for Dsp

Source§

fn from(value: *mut FMOD_DSP) -> Self

Converts to this type from the input type.
Source§

impl From<Dsp> for *mut FMOD_DSP

Source§

fn from(value: Dsp) -> Self

Converts to this type from the input type.
Source§

impl Hash for Dsp

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Dsp

Source§

fn eq(&self, other: &Dsp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Dsp

Source§

impl Eq for Dsp

Source§

impl Send for Dsp

Source§

impl StructuralPartialEq for Dsp

Source§

impl Sync for Dsp

Auto Trait Implementations§

§

impl Freeze for Dsp

§

impl RefUnwindSafe for Dsp

§

impl Unpin for Dsp

§

impl UnwindSafe for Dsp

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Shareable for T
where T: Send + Sync + 'static,