Skip to content

command_replay

Francisco Dias edited this page Nov 22, 2024 · 4 revisions

Command Replay

FMOD Object: Studio::CommandReplay


This module holds the functionality for the FMOD Studio command replay system, which allows API calls in a session to be recorded and later played back for debugging and performance purposes.

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.



Back To Top

fmod_studio_command_replay_set_bank_path

FMOD Function: Studio::CommandReplay::setBankPath


This function sets a path substition that will be used when loading banks with this replay.

fmod_studio_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.


Syntax:

fmod_studio_command_replay_set_bank_path(command_replay_ref, path)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
path String The path to use when loading banks.



Returns:

N/A




Back To Top

fmod_studio_command_replay_set_create_instance_callback

FMOD Function: Studio::CommandReplay::setCreateInstanceCallback


This function enables the create event instance callback, received in the Async Social event.

The create instance callback is invoked each time a fmod_studio_event_description_create_instance 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.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

fmod_studio_command_replay_set_create_instance_callback(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

N/A


Triggers:

Social Async Event

The Social Async event executed for the create event instance callback

Key Type Description
type String The value "fmod_studio_command_replay_set_create_instance_callback"
command_replay_ref Real The handle of the Command Replay triggering this event
event_description_ref Real The handle of the event description associated with the newly created instance
event_instance_ref Real The handle of the created instance



Back To Top

fmod_studio_command_replay_set_frame_callback

FMOD Function: Studio::CommandReplay::setFrameCallback


This function enables a callback that is issued each time the replay reaches a new frame. This is received in the Async Social event.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

fmod_studio_command_replay_set_frame_callback(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

N/A


Triggers:

Social Async Event

The Social Async event executed for the create event instance callback

Key Type Description
type String The value "fmod_studio_command_replay_set_frame_callback"
command_replay_ref Real The handle of the Command Replay triggering this event
command_index Real Current playback command index
current_time Real Current playback time



Back To Top

fmod_studio_command_replay_set_load_bank_callback

FMOD Function: Studio::CommandReplay::setLoadBankCallback


This function enables the bank loading callback, received in the Async Social event.

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 fmod_studio_system_load_bank_memory and fmod_studio_system_load_bank_custom 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 fmod_studio_system_load_bank_file commands and skip other load commands.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

fmod_studio_command_replay_set_load_bank_callback(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

N/A


Triggers:

Social Async Event

The Social Async event executed for the create event instance callback

Key Type Description
type String The value "fmod_studio_command_replay_set_load_bank_callback"
command_replay_ref Real The handle of the Command Replay triggering this event
command_index Real The command that involved this callback
bank_ref Real The bank loaded by this function
bank_guid Real The GUID of the bank that needs to be loaded
bank_filename Real The filename of the bank that needs to be loaded



Back To Top

fmod_studio_command_replay_start

FMOD Function: Studio::CommandReplay::start


This function begins playback.

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


Syntax:

fmod_studio_command_replay_start(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

N/A




Back To Top

fmod_studio_command_replay_stop

FMOD Function: Studio::CommandReplay::stop


This function stops playback.

If the FMOD_STUDIO_COMMANDREPLAY.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.


Syntax:

fmod_studio_command_replay_stop(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

N/A




Back To Top

fmod_studio_command_replay_get_current_command

FMOD Function: Studio::CommandReplay::getCurrentCommand


This function retrieves the progress through the command replay.

If this function is called before fmod_studio_command_replay_start then both commandindex and currenttime (in the returned struct) will be returned as 0. If this function is called after fmod_studio_command_replay_stop then the index and time of the last command which was replayed will be returned.


Syntax:

fmod_studio_command_replay_get_current_command(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

FmodCommandReplayCurrentCommand




Back To Top

fmod_studio_command_replay_get_playback_state

FMOD Function: Studio::CommandReplay::getPlaybackState


This function retrieves the playback state of the given CommandReplay.


Syntax:

fmod_studio_command_replay_get_playback_state(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

FMOD_STUDIO_PLAYBACK_STATE




Back To Top

fmod_studio_command_replay_set_paused

FMOD Function: Studio::CommandReplay::setPaused


This function sets the paused state of the given CommandReplay.


Syntax:

fmod_studio_command_replay_set_paused(command_replay_ref, pause)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
pause Boolean true to pause, false to unpause.



Returns:

N/A




Back To Top

fmod_studio_command_replay_get_paused

FMOD Function: Studio::CommandReplay::getPaused


This function retrieves the paused state of the given CommandReplay (true if paused, false if not).


Syntax:

fmod_studio_command_replay_get_paused(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Boolean




Back To Top

fmod_studio_command_replay_seek_to_command

FMOD Function: Studio::CommandReplay::seekToCommand


This function seeks the playback position to a command.


Syntax:

fmod_studio_command_replay_seek_to_command(command_replay_ref, command_index)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
command_index Real The command index to seek to.



Returns:

Real




Back To Top

fmod_studio_command_replay_seek_to_time

FMOD Function: Studio::CommandReplay::seekToTime


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.ERR_EVENT_NOTFOUND is returned (in the next fmod_last_result call).


Syntax:

fmod_studio_command_replay_seek_to_time(command_replay_ref, time)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
time Real The time to seek to.



Returns:

N/A




Back To Top

fmod_studio_command_replay_get_command_at_time

FMOD Function: Studio::CommandReplay::getCommandAtTime


This function retrieves the command index corresponding to the given playback time.

This will return an index for the first command at or after time. If time is greater than the total playback time then FMOD_RESULT.ERR_EVENT_NOTFOUND is returned (in the next fmod_last_result call).


Syntax:

fmod_studio_command_replay_get_command_at_time(command_replay_ref, time)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
time Real The time used to find a command index.



Returns:

Real




Back To Top

fmod_studio_command_replay_get_command_count

FMOD Function: Studio::CommandReplay::getCommandCount


This function retrieves the number of commands in the replay.

May be used in conjunction with fmod_studio_command_replay_get_command_info to enumerate the commands in the replay.


Syntax:

fmod_studio_command_replay_get_command_count(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Real




Back To Top

fmod_studio_command_replay_get_command_info

FMOD Function: Studio::CommandReplay::getCommandInfo


This function retrieves command information.

May be used in conjunction with fmod_studio_command_replay_get_command_count to enumerate the commands in the replay.


Syntax:

fmod_studio_command_replay_get_command_info(command_replay_ref, command_index)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
command_index Real The index of the command.



Returns:

FmodCommandReplayCommandInfo




Back To Top

fmod_studio_command_replay_get_command_string

FMOD Function: Studio::CommandReplay::getCommandString


This function returns the string representation of a command.

If the string representation of the command is too long to fit in the buffer it will be truncated and this function will return FMOD_RESULT.ERR_TRUNCATED (in the next fmod_last_result call).


Syntax:

fmod_studio_command_replay_get_command_string(command_replay_ref, command_index)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
command_index Real The index of the command.



Returns:

String




Back To Top

fmod_studio_command_replay_get_length

FMOD Function: Studio::CommandReplay::getLength


This function retrieves the total playback time.


Syntax:

fmod_studio_command_replay_get_length(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Real




Back To Top

fmod_studio_command_replay_get_system_object

FMOD Function: Studio::CommandReplay::getSystem


This function retrieves the Studio System object associated with this replay object.


Syntax:

fmod_studio_command_replay_get_system_object(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Real




Back To Top

fmod_studio_command_replay_is_valid

FMOD Function: Studio::CommandReplay::isValid


This function checks that the CommandReplay reference is valid.


Syntax:

fmod_studio_command_replay_is_valid(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Boolean




Back To Top

fmod_studio_command_replay_set_user_data

FMOD Function: Studio::CommandReplay::setUserData


This function sets user data.

This allows a real value to be attached to this object. See User Data for an example of how to get and set user data.


Syntax:

fmod_studio_command_replay_set_user_data(command_replay_ref, data)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.
data Real The real value to attach.



Returns:

N/A




Back To Top

fmod_studio_command_replay_get_user_data

FMOD Function: Studio::CommandReplay::getUserData


This function retrieves user data attached to this object (a real value, passed into fmod_studio_command_replay_set_user_data).

The function returns NaN if there is no user data attached to the bank.


Syntax:

fmod_studio_command_replay_get_user_data(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Real




Back To Top

fmod_studio_command_replay_release

FMOD Function: Studio::CommandReplay::release


This function releases the command replay.


Syntax:

fmod_studio_command_replay_release(command_replay_ref)
Argument Type Description
command_replay_ref Real A reference to a CommandReplay.



Returns:

Real



Clone this wiki locally