pub struct Bus { /* private fields */ }
studio
only.Expand description
Represents a global mixer bus.
Implementations§
Source§impl Bus
impl Bus
Sourcepub unsafe fn from_ffi(value: *mut FMOD_STUDIO_BUS) -> Self
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.
Sourcepub fn as_ptr(self) -> *mut FMOD_STUDIO_BUS
pub fn as_ptr(self) -> *mut FMOD_STUDIO_BUS
Converts self
into its raw representation.
Source§impl Bus
impl Bus
Sourcepub fn set_paused(&self, paused: bool) -> Result<()>
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.
Sourcepub fn get_paused(&self) -> Result<bool>
pub fn get_paused(&self) -> Result<bool>
Retrieves the pause state.
Sourcepub fn stop_all_events(&self, stop_mode: StopMode) -> Result<()>
pub fn stop_all_events(&self, stop_mode: StopMode) -> Result<()>
Stops all event instances that are routed into the bus.
Source§impl Bus
impl Bus
Sourcepub fn set_volume(&self, volume: c_float) -> Result<()>
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.
Sourcepub fn get_volume(&self) -> Result<(c_float, c_float)>
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::Vca
s 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.
Sourcepub fn set_mute(&self, mute: bool) -> Result<()>
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.
Sourcepub fn set_port_index(&self, index: FMOD_PORT_INDEX) -> Result<()>
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.
Sourcepub fn get_port_index(&self) -> Result<FMOD_PORT_INDEX>
pub fn get_port_index(&self) -> Result<FMOD_PORT_INDEX>
Retrieves the port index assigned to the bus.
Source§impl Bus
impl Bus
Sourcepub fn get_channel_group(&self) -> Result<ChannelGroup>
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
.
Sourcepub fn lock_channel_group(&self) -> Result<()>
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.
Sourcepub fn unlock_channel_group(&self) -> Result<()>
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
impl Bus
Sourcepub fn get_cpu_usage(&self) -> Result<(c_uint, c_uint)>
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.
Sourcepub fn get_memory_usage(&self) -> Result<MemoryUsage>
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
impl Bus
Sourcepub fn get_path(&self) -> Result<Utf8CString>
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.
Trait Implementations§
impl Copy for Bus
impl Eq for Bus
impl Send for Bus
thread-unsafe
only.impl StructuralPartialEq for Bus
impl Sync for Bus
thread-unsafe
only.