pub struct CommandReplay { /* private fields */ }
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
impl CommandReplay
Sourcepub fn get_userdata(&self) -> Result<*mut c_void>
pub fn get_userdata(&self) -> Result<*mut c_void>
Retrieves user data.
Sourcepub fn set_create_instance_callback<C: CreateInstanceCallback>(
&self,
) -> Result<()>
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.
Sourcepub fn set_frame_callback<C: FrameCallback>(&self) -> Result<()>
pub fn set_frame_callback<C: FrameCallback>(&self) -> Result<()>
Sets a callback that is issued each time the replay reaches a new frame.
Sourcepub fn set_load_bank_callback<C: LoadBankCallback>(&self) -> Result<()>
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
impl CommandReplay
Sourcepub fn start(&self) -> Result<()>
pub fn start(&self) -> Result<()>
Begins playback.
If the replay is already running then calling this function will restart replay from the beginning.
Sourcepub fn stop(&self) -> Result<()>
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.
Sourcepub fn get_current_command(&self) -> Result<(c_int, c_float)>
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.
Sourcepub fn get_playback_state(&self) -> Result<PlaybackState>
pub fn get_playback_state(&self) -> Result<PlaybackState>
Retrieves the playback state.
Sourcepub fn set_paused(&self, paused: bool) -> Result<()>
pub fn set_paused(&self, paused: bool) -> Result<()>
Sets the paused state.
Sourcepub fn get_paused(&self) -> Result<bool>
pub fn get_paused(&self) -> Result<bool>
Retrieves the paused state.
Sourcepub fn seek_to_command(&self, index: c_int) -> Result<()>
pub fn seek_to_command(&self, index: c_int) -> Result<()>
Seeks the playback position to a command.
Sourcepub fn seek_to_time(&self, time: c_float) -> Result<()>
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
impl CommandReplay
Sourcepub fn set_bank_path(&self, path: &Utf8CStr) -> Result<()>
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.
Sourcepub fn command_at_time(&self, time: c_float) -> Result<c_int>
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.
Sourcepub fn get_command_count(&self) -> Result<c_int>
pub fn get_command_count(&self) -> Result<c_int>
Retrieves the number of commands in the replay.
Sourcepub fn get_command_info(&self, index: c_int) -> Result<CommandInfo>
pub fn get_command_info(&self, index: c_int) -> Result<CommandInfo>
Retrieves command information.
Sourcepub fn get_command_string(&self, index: c_int) -> Result<Utf8CString>
pub fn get_command_string(&self, index: c_int) -> Result<Utf8CString>
Retrieves the string representation of a command.
Sourcepub fn get_length(&self) -> Result<c_float>
pub fn get_length(&self) -> Result<c_float>
Retrieves the total playback time.
Sourcepub fn get_system(&self) -> Result<System>
pub fn get_system(&self) -> Result<System>
Retrieves the Studio System object associated with this replay object.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Checks that the CommandReplay
reference is valid.
Source§impl CommandReplay
impl CommandReplay
Sourcepub unsafe fn from_ffi(value: *mut FMOD_STUDIO_COMMANDREPLAY) -> Self
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.
Sourcepub fn as_ptr(self) -> *mut FMOD_STUDIO_COMMANDREPLAY
pub fn as_ptr(self) -> *mut FMOD_STUDIO_COMMANDREPLAY
Converts self
into its raw representation.
Trait Implementations§
Source§impl Clone for CommandReplay
impl Clone for CommandReplay
Source§fn clone(&self) -> CommandReplay
fn clone(&self) -> CommandReplay
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CommandReplay
impl Debug for CommandReplay
Source§impl From<CommandReplay> for *mut FMOD_STUDIO_COMMANDREPLAY
impl From<CommandReplay> for *mut FMOD_STUDIO_COMMANDREPLAY
Source§fn from(value: CommandReplay) -> Self
fn from(value: CommandReplay) -> Self
Source§impl Hash for CommandReplay
impl Hash for CommandReplay
Source§impl PartialEq for CommandReplay
impl PartialEq for CommandReplay
impl Copy for CommandReplay
impl Eq for CommandReplay
impl Send for CommandReplay
thread-unsafe
only.impl StructuralPartialEq for CommandReplay
impl Sync for CommandReplay
thread-unsafe
only.