Struct Bus

Source
pub struct Bus { /* private fields */ }
Available on crate feature studio only.
Expand description

Represents a global mixer bus.

Implementations§

Source§

impl Bus

Source

pub unsafe fn from_ffi(value: *mut FMOD_STUDIO_BUS) -> Self

§Safety

value must be a valid pointer either aquired from Self::as_ptr or FMOD.

§Panics

Panics if value is null.

Source

pub fn as_ptr(self) -> *mut FMOD_STUDIO_BUS

Converts self into its raw representation.

Source§

impl Bus

Source

pub fn set_paused(&self, paused: bool) -> Result<()>

Sets the pause state.

This function allows pausing/unpausing of all audio routed into the bus.

An individual pause state is kept for each bus. Pausing a bus will override the pause state of its inputs (meaning they return true from Bus::get_paused), while unpausing a bus will cause its inputs to obey their individual pause state. The pause state is processed in the Studio system update, so Bus::get_paused will return the state as determined by the last update.

Source

pub fn get_paused(&self) -> Result<bool>

Retrieves the pause state.

Source

pub fn stop_all_events(&self, stop_mode: StopMode) -> Result<()>

Stops all event instances that are routed into the bus.

Source§

impl Bus

Source

pub fn set_volume(&self, volume: c_float) -> Result<()>

Sets the volume level.

This volume is applied as a scaling factor to the volume level set in FMOD Studio.

Source

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

Retrieves the volume level.

The second tuple field is calculated by combining the volume set via Bus::set_volume with the bus’s default volume and any snapshots or super::Vcas that affect the bus. Volume changes are processed in the Studio system update, so second field will be the value calculated by the last update.

Source

pub fn set_mute(&self, mute: bool) -> Result<()>

Sets the mute state.

Mute is an additional control for volume, the effect of which is equivalent to setting the volume to zero.

An individual mute state is kept for each bus. Muting a bus will override the mute state of its inputs (meaning they return true from Bus::get_mute), while unmuting a bus will cause its inputs to obey their individual mute state. The mute state is processed in the Studio system update, so Bus::get_mute will return the state as determined by the last update.

Source

pub fn get_mute(&self) -> Result<bool>

Retrieves the mute state.

Source

pub fn set_port_index(&self, index: FMOD_PORT_INDEX) -> Result<()>

Sets the port index to use when attaching to an output port.

When a bus which is an output port is instantiated it will be connected to an output port based on the port type set in Studio. For some port types a platform specific port index is required to connect to the correct output port. For example, if the output port type is a speaker in a controller then a platform specific port index may be required to specify which controller the bus is to attach to. In such a case call this function passing the platform specific port index.

There is no need to call this function for port types which do not require an index.

This function may be called at any time after a bank containing the bus has been loaded.

Source

pub fn get_port_index(&self) -> Result<FMOD_PORT_INDEX>

Retrieves the port index assigned to the bus.

Source§

impl Bus

Source

pub fn get_channel_group(&self) -> Result<ChannelGroup>

Retrieves the core ChannelGroup.

By default the ChannelGroup will only exist when it is needed; see Signal Paths in the FMOD documentation for details. If the ChannelGroup does not exist, this function will return FMOD_RESULT::FMOD_ERR_STUDIO_NOT_LOADED.

Source

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

Locks the core ChannelGroup.

This function forces the system to create the ChannelGroup and keep it available until Bus::unlock_channel_group is called. See Signal Paths in the FMOD documentation for details.

The ChannelGroup may not be available immediately after calling this function. When Studio has been initialized in asynchronous mode, the ChannelGroup will not be created until the command has been executed in the async thread. When Studio has been initialized with super::InitFlags::SYNCHRONOUS_UPDATE, the ChannelGroup will be created in the next super::System::update call.

You can call super::System::flush_commands to ensure the ChannelGroup has been created. Alternatively you can keep trying to obtain the ChannelGroup via Bus::get_channel_group until it is ready.

Source

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

Unlocks the core ChannelGroup.

This function allows the system to destroy the ChannelGroup when it is not needed. See Signal Paths in the FMOD documentation for details.

Source§

impl Bus

Source

pub fn get_cpu_usage(&self) -> Result<(c_uint, c_uint)>

Retrieves the bus CPU usage data.

The first tuple field is the CPU time spent processing the events of this bus, in microseconds.

The second tuple field is the CPU time spent processing the events and all input buses of this bus, in microseconds.

crate::InitFlags::PROFILE_ENABLE with crate::SystemBuilder::build is required to call this function.

Source

pub fn get_memory_usage(&self) -> Result<MemoryUsage>

Retrieves memory usage statistics.

Memory usage statistics are only available in logging builds, in release builds the return value will contain zero for all values after calling this function.

Source§

impl Bus

Source

pub fn get_id(&self) -> Result<Guid>

Retrieves the GUID.

Source

pub fn get_path(&self) -> Result<Utf8CString>

Retrieves the path.

The strings bank must be loaded prior to calling this function, otherwise FMOD_RESULT::FMOD_ERR_EVENT_NOTFOUND is returned.

Source

pub fn is_valid(&self) -> bool

Checks that the Bus reference is valid.

Trait Implementations§

Source§

impl Clone for Bus

Source§

fn clone(&self) -> Bus

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 Bus

Source§

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

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

impl From<Bus> for *mut FMOD_STUDIO_BUS

Source§

fn from(value: Bus) -> Self

Converts to this type from the input type.
Source§

impl Hash for Bus

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 Bus

Source§

fn eq(&self, other: &Bus) -> 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 Bus

Source§

impl Eq for Bus

Source§

impl Send for Bus

Available on non-crate feature thread-unsafe only.
Source§

impl StructuralPartialEq for Bus

Source§

impl Sync for Bus

Available on non-crate feature thread-unsafe only.

Auto Trait Implementations§

§

impl Freeze for Bus

§

impl RefUnwindSafe for Bus

§

impl Unpin for Bus

§

impl UnwindSafe for Bus

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.