CommandReplay

Struct CommandReplay 

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

The FMOD Studio command replay system allows API calls in a session to be recorded and later played back for debugging and performance purposes.

Implementations§

Source§

impl CommandReplay

Source

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

Sets user data.

Source

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

Retrieves user data.

Source

pub fn set_create_instance_callback<C: CreateInstanceCallback>( &self, ) -> Result<()>

Sets the create event instance callback.

The create instance callback is invoked each time a EventDescription::createInstance command is processed.

The callback can either create a new event instance based on the callback parameters or skip creating the instance. If the instance is not created then subsequent commands for the event instance will be ignored in the replay.

If this callback is not set then the system will always create an event instance.

Source

pub fn set_frame_callback<C: FrameCallback>(&self) -> Result<()>

Sets a callback that is issued each time the replay reaches a new frame.

Source

pub fn set_load_bank_callback<C: LoadBankCallback>(&self) -> Result<()>

Sets the bank loading callback.

The load bank callback is invoked whenever any of the Studio load bank functions are reached.

This callback is required to be implemented to successfully replay Studio::System::loadBankMemory and Studio::System::loadBankCustom commands.

The callback is responsible for loading the bank based on the callback parameters. If the bank is not loaded subsequent commands which reference objects in the bank will fail.

If this callback is not set then the system will attempt to load banks from file according to recorded Studio::System::loadBankFile commands and skip other load commands.

Source§

impl CommandReplay

Source

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

Releases the command replay.

Source§

impl CommandReplay

Source

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

Begins playback.

If the replay is already running then calling this function will restart replay from the beginning.

Source

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

Stops playback.

If the CommandReplayFlags::SKIP_CLEANUP flag has been used then the system state is left as it was at the end of the playback, otherwise all resources that were created as part of the replay will be cleaned up.

Source

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

Retrieves the progress through the command replay.

If this function is called before CommandReplay::start then both tuple fields will be 0. If this function is called after CommandReplay::stop then the index and time of the last command which was replayed will be returned.

Source

pub fn get_playback_state(&self) -> Result<PlaybackState>

Retrieves the playback state.

Source

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

Sets the paused state.

Source

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

Retrieves the paused state.

Source

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

Seeks the playback position to a command.

Source

pub fn seek_to_time(&self, time: c_float) -> Result<()>

Seeks the playback position to a time.

This function moves the playback position to the the first command at or after time. If no command exists at or after time then FMOD_RESULT::FMOD_ERR_EVENT_NOTFOUND is returned.

Source§

impl CommandReplay

Source

pub fn set_bank_path(&self, path: &Utf8CStr) -> Result<()>

Sets a path substition that will be used when loading banks with this replay.

System::load_bank_file commands in the replay are redirected to load banks from the specified directory, instead of using the directory recorded in the captured commands.

Source

pub fn command_at_time(&self, time: c_float) -> Result<c_int>

Retrieves the command index corresponding to the given playback time.

This function will return an index for the first command at or after time. If time is greater than the total playback time then FMOD_RESULT::FMOD_ERR_EVENT_NOTFOUND is returned.

Source

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

Retrieves the number of commands in the replay.

Source

pub fn get_command_info(&self, index: c_int) -> Result<CommandInfo>

Retrieves command information.

Source

pub fn get_command_string(&self, index: c_int) -> Result<Utf8CString>

Retrieves the string representation of a command.

Source

pub fn get_length(&self) -> Result<c_float>

Retrieves the total playback time.

Source

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

Retrieves the Studio System object associated with this replay object.

Source

pub fn is_valid(&self) -> bool

Checks that the CommandReplay reference is valid.

Source§

impl CommandReplay

Source

pub unsafe fn from_ffi(value: *mut FMOD_STUDIO_COMMANDREPLAY) -> 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_COMMANDREPLAY

Converts self into its raw representation.

Trait Implementations§

Source§

impl Clone for CommandReplay

Source§

fn clone(&self) -> CommandReplay

Returns a duplicate 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 CommandReplay

Source§

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

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

impl From<CommandReplay> for *mut FMOD_STUDIO_COMMANDREPLAY

Source§

fn from(value: CommandReplay) -> Self

Converts to this type from the input type.
Source§

impl Hash for CommandReplay

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 CommandReplay

Source§

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

Source§

impl Eq for CommandReplay

Source§

impl Send for CommandReplay

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

impl StructuralPartialEq for CommandReplay

Source§

impl Sync for CommandReplay

Available on non-crate feature thread-unsafe only.

Auto Trait Implementations§

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.