pub struct Bank { /* private fields */ }
studio
only.Expand description
Banks made in FMOD Studio contain the metadata and audio sample data required for runtime mixing and playback.
Audio sample data may be packed into the same bank as the event metadata which references it, or it may be packed into separate banks.
Implementations§
Source§impl Bank
impl Bank
Sourcepub fn get_path(&self) -> Result<Utf8CString>
pub fn get_path(&self) -> Result<Utf8CString>
Retrieves the path.
Sourcepub fn set_userdata(&self, userdata: *mut c_void) -> Result<()>
pub fn set_userdata(&self, userdata: *mut c_void) -> Result<()>
Sets the bank’s user data.
This function allows arbitrary user data to be attached to this object.
Sourcepub fn get_userdata(&self) -> Result<*mut c_void>
pub fn get_userdata(&self) -> Result<*mut c_void>
Retrieves the bank’s user data.
This function allows arbitrary user data to be retrieved from this object.
Source§impl Bank
impl Bank
Sourcepub fn get_loading_state(&self) -> Result<LoadingState>
pub fn get_loading_state(&self) -> Result<LoadingState>
This function may be used to check the loading state of a bank which has been loaded asynchronously using the LoadBankFlags::NONBLOCKING
flag,
or is pending unload following a call to Bank::unload
.
If an asynchronous load failed due to a file error state will contain LoadingState::Error
and the return code from this function will be the error code of the bank load function.
Sourcepub fn load_sample_data(&self) -> Result<()>
pub fn load_sample_data(&self) -> Result<()>
Use this function to preload sample data ahead of time so that the events in the bank can play immediately when started.
This function is equivalent to calling EventDescription::load_sample_data
for all events in the bank, including referenced events.
Sourcepub fn unload_sample_data(&self) -> Result<()>
pub fn unload_sample_data(&self) -> Result<()>
Unloads non-streaming sample data for all events in the bank.
Sample data loading is reference counted and the sample data will remain loaded until unload requests corresponding to all load requests are made, or until the bank is unloaded.
Sourcepub fn get_sample_loading_state(&self) -> Result<LoadingState>
pub fn get_sample_loading_state(&self) -> Result<LoadingState>
Retrieves the loading state of the samples in the bank.
May be used for tracking the status of the Bank::load_sample_data
operation.
If Bank::load_sample_data
has not been called for the bank then this function will return LoadingState::Unloaded
even though sample data may have been loaded by other API calls.
Sourcepub fn unload(self) -> Result<()>
pub fn unload(self) -> Result<()>
Unloads the bank.
This will destroy all objects created from the bank, unload all sample data inside the bank, and invalidate all API handles referring to the bank.
If the bank was loaded from user-managed memory, e.g. by System::load_bank_pointer
, then the memory must not be freed until the unload has completed.
Poll the loading state using Bank::get_loading_state
or use the FMOD_STUDIO_SYSTEM_CALLBACK_BANK_UNLOAD
system callback to determine when it is safe to free the memory.
Source§impl Bank
impl Bank
Sourcepub fn get_bus_list(&self) -> Result<Vec<Bus>>
pub fn get_bus_list(&self) -> Result<Vec<Bus>>
Retrieves a list of the buses in the bank.
Sourcepub fn get_bus_list_into(&self, slice: &mut [Option<Bus>]) -> Result<c_int>
pub fn get_bus_list_into(&self, slice: &mut [Option<Bus>]) -> Result<c_int>
Retrieves a list of the instances.
Fills in the provided slice instead of allocating a Vec
, like Bank::get_bus_list
does.
Any instances not filled in are left as None
.
Returns how many buses were fetched.
Sourcepub fn event_count(&self) -> Result<c_int>
pub fn event_count(&self) -> Result<c_int>
Retrives the number of event descriptions in the bank.
This function counts the events which were added to the bank by the sound designer. The bank may contain additional events which are referenced by event instruments but were not added to the bank, and those referenced events are not counted.
Sourcepub fn get_event_list(&self) -> Result<Vec<EventDescription>>
pub fn get_event_list(&self) -> Result<Vec<EventDescription>>
Retrieves a list of the event descriptions in the bank.
This function counts the events which were added to the bank by the sound designer. The bank may contain additional events which are referenced by event instruments but were not added to the bank, and those referenced events are not counted.
Sourcepub fn get_event_list_into(
&self,
slice: &mut [Option<EventDescription>],
) -> Result<c_int>
pub fn get_event_list_into( &self, slice: &mut [Option<EventDescription>], ) -> Result<c_int>
Retrieves a list of the instances.
Fills in the provided slice instead of allocating a Vec
, like Bank::get_event_list
does.
Any instances not filled in are left as None
.
Returns how many events were fetched.
Sourcepub fn string_count(&self) -> Result<c_int>
pub fn string_count(&self) -> Result<c_int>
Retrieves the number of string table entries in the bank.
Sourcepub fn get_string_info(&self, index: c_int) -> Result<(Guid, Utf8CString)>
pub fn get_string_info(&self, index: c_int) -> Result<(Guid, Utf8CString)>
Retrieves a string table entry.
May be used in conjunction with Bank::string_count
to enumerate the string table in a bank.
Sourcepub fn get_vca_list(&self) -> Result<Vec<Vca>>
pub fn get_vca_list(&self) -> Result<Vec<Vca>>
Retrieves a list of the VCAs in the bank.
Sourcepub fn get_vca_list_into(&self, slice: &mut [Option<Vca>]) -> Result<c_int>
pub fn get_vca_list_into(&self, slice: &mut [Option<Vca>]) -> Result<c_int>
Retrieves a list of the instances.
Fills in the provided slice instead of allocating a Vec
, like Bank::get_vca_list
does.
Any instances not filled in are left as None
.
Returns how many VCAs were fetched.
Source§impl Bank
impl Bank
Sourcepub unsafe fn from_ffi(value: *mut FMOD_STUDIO_BANK) -> Self
pub unsafe fn from_ffi(value: *mut FMOD_STUDIO_BANK) -> 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_BANK
pub fn as_ptr(self) -> *mut FMOD_STUDIO_BANK
Converts self
into its raw representation.
Trait Implementations§
impl Copy for Bank
impl Eq for Bank
impl Send for Bank
thread-unsafe
only.impl StructuralPartialEq for Bank
impl Sync for Bank
thread-unsafe
only.