6. Studio API Reference | Studio::CommandReplay
The FMOD Studio command replay system allows API calls in a session to be recorded and later played back for debugging and performance purposes.
Setup:
Playback:
Query:
Lifetime:
See also:
Callback for command replay event instance creation.
FMOD_RESULT F_CALLBACK FMOD_STUDIO_COMMANDREPLAY_CREATE_INSTANCE_CALLBACK(
FMOD_STUDIO_COMMANDREPLAY *replay,
int commandindex,
FMOD_STUDIO_EVENTDESCRIPTION *eventdescription,
FMOD_STUDIO_EVENTINSTANCE **instance,
void *userdata
);
delegate RESULT Studio.COMMANDREPLAY_CREATE_INSTANCE_CALLBACK(
IntPtr replay,
int commandindex,
IntPtr eventdescription,
out IntPtr instance,
IntPtr userdata
);
Not supported for JavaScript.
- replay
- Command replay. (Studio::CommandReplay)
- commandindex
- Current playback command index.
- eventdescription
- Event description to use. (Studio::EventDescription)
- instance OutOpt
- The event instance created by this function. (Studio::EventInstance)
- userdata
- The userdata set with Studio::CommandReplay::setUserData
The replay argument can be cast to FMOD::Studio::CommandReplay *.
The eventdescription argument can be cast to FMOD::Studio::EventDescription *.
The instance argument can be cast to FMOD::Studio::EventInstance *.
See Also: Studio::CommandReplay::setCreateInstanceCallback
Callback for when the command replay goes to the next frame.
FMOD_RESULT F_CALLBACK FMOD_STUDIO_COMMANDREPLAY_FRAME_CALLBACK(
FMOD_STUDIO_COMMANDREPLAY *replay,
int commandindex,
float currenttime,
void *userdata
);
delegate RESULT Studio.COMMANDREPLAY_FRAME_CALLBACK(
IntPtr replay,
int commandindex,
float currenttime,
IntPtr userdata
);
Currently not supported for JavaScript.
- replay
- Command replay. (Studio::CommandReplay)
- commandindex
- Current playback command index.
- currenttime
- Current playback time.
- userdata
- The userdata set with Studio::CommandReplay::setUserData
The replay argument can be cast to FMOD::Studio::CommandReplay *.
See Also: Studio::CommandReplay::setFrameCallback
Retrieves the command index corresponding to the given playback time.
FMOD_RESULT Studio::CommandReplay::getCommandAtTime(
float time,
int *commandindex
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetCommandAtTime(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
float time,
int *commandindex
);
RESULT Studio.CommandReplay.getCommandAtTime(
float time,
out int commandindex
);
Studio.CommandReplay.getCommandAtTime(
time,
commandindex
);
- time
- The time used to find a command index.
- commandindex Out
- Command index.
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_ERR_EVENT_NOTFOUND is returned.
See Also: Studio::CommandReplay::getLength
Retrieves the number of commands in the replay.
FMOD_RESULT Studio::CommandReplay::getCommandCount(
int *count
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetCommandCount(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
int *count
);
RESULT Studio.CommandReplay.getCommandCount(
out int count
);
Studio.CommandReplay.getCommandCount(
count
);
- count Out
- Number of commands in the replay.
May be used in conjunction with Studio::CommandReplay::getCommandInfo to enumerate the commands in the replay.
Retrieves command information.
FMOD_RESULT Studio::CommandReplay::getCommandInfo(
int commandindex,
FMOD_STUDIO_COMMAND_INFO *info
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetCommandInfo(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
int commandindex,
FMOD_STUDIO_COMMAND_INFO *info
);
RESULT Studio.CommandReplay.getCommandInfo(
int commandindex,
out COMMAND_INFO info
);
Studio.CommandReplay.getCommandInfo(
commandindex,
info
);
- commandindex
- The index of the command.
- info Out
- Command info structure. (FMOD_STUDIO_COMMAND_INFO)
May be used in conjunction with Studio::CommandReplay::getCommandCount to enumerate the commands in the replay.
Retrieves the string representation of a command.
FMOD_RESULT Studio::CommandReplay::getCommandString(
int commandindex,
char *buffer,
int length
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetCommandString(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
int commandindex,
char *buffer,
int length
);
RESULT Studio.CommandReplay.getCommandString(
int commandindex,
out string buffer
);
Studio.CommandReplay.getCommandString(
commandindex,
buffer
);
- commandindex
- The index of the command.
- buffer
- Buffer to receive the string.
- length
- The capacity of the buffer.
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_ERR_TRUNCATED.
Retrieves the progress through the command replay.
FMOD_RESULT Studio::CommandReplay::getCurrentCommand(
int *commandindex,
float *currenttime
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetCurrentCommand(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
int *commandindex,
float *currenttime
);
RESULT Studio.CommandReplay.getCurrentCommand(
out int commandindex,
out float currenttime
);
Studio.CommandReplay.getCurrentCommand(
commandindex,
currenttime
);
- commandindex OutOpt
- The current command index.
- currenttime OutOpt
- The current playback time.
If this function is called before Studio::CommandReplay::start then both commandindex and currenttime will be returned as 0. If this function is called after Studio::CommandReplay::stop then the index and time of the last command which was replayed will be returned.
Retrieves the total playback time.
FMOD_RESULT Studio::CommandReplay::getLength(
float *length
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetLength(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
float *length
);
RESULT Studio.CommandReplay.getLength(
out float length
);
Studio.CommandReplay.getLength(
length
);
- length Out
- The total playback time.
Retrieves the paused state.
FMOD_RESULT Studio::CommandReplay::getPaused(
bool *paused
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetPaused(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_BOOL *paused
);
RESULT Studio.CommandReplay.getPaused(
out bool paused
);
Studio.CommandReplay.getPaused(
paused
);
- paused
-
Paused state.
See Also: Studio::CommandReplay::setPaused
Retrieves the playback state.
FMOD_RESULT Studio::CommandReplay::getPlaybackState(
FMOD_STUDIO_PLAYBACK_STATE *state
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetPlaybackState(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_STUDIO_PLAYBACK_STATE *state
);
RESULT Studio.CommandReplay.getPlaybackState(
out PLAYBACK_STATE state
);
Studio.CommandReplay.getPlaybackState(
state
);
- state Out
- Playback state. (FMOD_STUDIO_PLAYBACK_STATE)
Retrieves the Studio System object associated with this replay object.
FMOD_RESULT Studio::CommandReplay::getSystem(
Studio::System **system
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetSystem(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_STUDIO_SYSTEM **system
);
RESULT Studio.CommandReplay.getSystem(
out System system
);
Studio.CommandReplay.getSystem(
system
);
- system
- Studio system object. (Studio::System)
Retrieves user data.
FMOD_RESULT Studio::CommandReplay::getUserData(
void **userdata
);
FMOD_RESULT FMOD_Studio_CommandReplay_GetUserData(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
void **userdata
);
RESULT Studio.CommandReplay.getUserData(
out IntPtr userdata
);
Studio.CommandReplay.getUserData(
userdata
);
- userdata
- User data.
See Also: Studio::CommandReplay::setUserData
Checks that the CommandReplay reference is valid.
bool Studio::CommandReplay::isValid()
bool FMOD_Studio_CommandReplay_IsValid(FMOD_STUDIO_COMMANDREPLAY *commandreplay)
bool Studio.CommandReplay.isValid()
Studio.CommandReplay.isValid()
Callback for command replay bank loading.
FMOD_RESULT F_CALLBACK FMOD_STUDIO_COMMANDREPLAY_LOAD_BANK_CALLBACK(
FMOD_STUDIO_COMMANDREPLAY *replay,
int commandindex,
const FMOD_GUID *bankguid,
const char *bankfilename,
FMOD_STUDIO_LOAD_BANK_FLAGS flags,
FMOD_STUDIO_BANK **bank,
void *userdata
);
delegate RESULT Studio.COMMANDREPLAY_LOAD_BANK_CALLBACK(
IntPtr replay,
int commandindex,
ref Guid bankguid,
StringWrapper bankfilename,
LOAD_BANK_FLAGS flags,
out IntPtr bank,
IntPtr userdata
);
Not supported for JavaScript.
- replay
- Command replay. (Studio::CommandReplay)
- commandindex
- The command that invoked this callback.
- bankguid Opt
- The guid of the bank that needs to be loaded. (FMOD_GUID)
- bankfilename Opt
- The filename of the bank that needs to be loaded. (UTF-8 string)
- flags
- The flags to load the bank with. (FMOD_STUDIO_LOAD_BANK_FLAGS)
- bank OutOpt
- The bank loaded by this function. (Studio::Bank)
- userdata
- The userdata set with Studio::CommandReplay::setUserData
The replay argument can be cast to FMOD::Studio::CommandReplay *.
The bank argument can be cast to FMOD::Studio::Bank *.
See Also: Studio::CommandReplay::setLoadBankCallback
Releases the command replay.
FMOD_RESULT Studio::CommandReplay::release();
FMOD_RESULT FMOD_Studio_CommandReplay_Release(FMOD_STUDIO_COMMANDREPLAY *commandreplay);
RESULT Studio.CommandReplay.release();
Studio.CommandReplay.release();
Seeks the playback position to a command.
FMOD_RESULT Studio::CommandReplay::seekToCommand(
int commandindex
);
FMOD_RESULT FMOD_Studio_CommandReplay_SeekToCommand(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
int commandindex
);
RESULT Studio.CommandReplay.seekToCommand(
int commandindex
);
Studio.CommandReplay.seekToCommand(
commandindex
);
- commandindex
- Command index to seek to.
See Also: Studio::CommandReplay::seekToTime
Seeks the playback position to a time.
FMOD_RESULT Studio::CommandReplay::seekToTime(
float time
);
FMOD_RESULT FMOD_Studio_CommandReplay_SeekToTime(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
float time
);
RESULT Studio.CommandReplay.seekToTime(
float time
);
Studio.CommandReplay.seekToTime(
time
);
- time
- Time to seek to.
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_ERR_EVENT_NOTFOUND is returned.
See Also: Studio::CommandReplay::seekToCommand
Sets a path substition that will be used when loading banks with this replay.
FMOD_RESULT Studio::CommandReplay::setBankPath(
const char *bankPath
);
FMOD_RESULT FMOD_Studio_CommandReplay_SetBankPath(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
const char *bankPath
);
RESULT Studio.CommandReplay.setBankPath(
string bankPath
);
Studio.CommandReplay.setBankPath(
bankPath
);
- bankPath
- The path to use when loading banks. (UTF-8 string)
Studio::System::loadBankFile commands in the replay are redirected to load banks from the specified directory, instead of using the directory recorded in the captured commands.
See Also: Studio::CommandReplay::setLoadBankCallback
Sets the create event instance callback.
FMOD_RESULT Studio::CommandReplay::setCreateInstanceCallback(
FMOD_STUDIO_COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback
);
FMOD_RESULT FMOD_Studio_CommandReplay_SetCreateInstanceCallback(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_STUDIO_COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback
);
RESULT Studio.CommandReplay.setCreateInstanceCallback(
COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback
);
Not supported for JavaScript.
- callback
- Callback function. (FMOD_STUDIO_COMMANDREPLAY_CREATE_INSTANCE_CALLBACK)
The create instance callback is invoked each time a Studio::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.
See Also: Studio::CommandReplay::setUserData
Sets a callback that is issued each time the replay reaches a new frame.
FMOD_RESULT Studio::CommandReplay::setFrameCallback(
FMOD_STUDIO_COMMANDREPLAY_FRAME_CALLBACK callback
);
FMOD_RESULT FMOD_Studio_CommandReplay_SetFrameCallback(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_STUDIO_COMMANDREPLAY_FRAME_CALLBACK callback
);
RESULT Studio.CommandReplay.setFrameCallback(
COMMANDREPLAY_FRAME_CALLBACK callback
);
Not supported for JavaScript.
- callback
- Callback function. (FMOD_STUDIO_COMMANDREPLAY_FRAME_CALLBACK)
See Also: Studio::CommandReplay::setUserData
Sets the bank loading callback.
FMOD_RESULT Studio::CommandReplay::setLoadBankCallback(
FMOD_STUDIO_COMMANDREPLAY_LOAD_BANK_CALLBACK callback
);
FMOD_RESULT FMOD_Studio_CommandReplay_SetLoadBankCallback(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_STUDIO_COMMANDREPLAY_LOAD_BANK_CALLBACK callback
);
RESULT Studio.CommandReplay.setLoadBankCallback(
COMMANDREPLAY_LOAD_BANK_CALLBACK callback
);
Not supported for JavaScript.
- callback
- Callback function. (FMOD_STUDIO_COMMANDREPLAY_LOAD_BANK_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.
See Also: Studio::CommandReplay::setUserData
Sets the paused state.
FMOD_RESULT Studio::CommandReplay::setPaused(
bool paused
);
FMOD_RESULT FMOD_Studio_CommandReplay_SetPaused(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
FMOD_BOOL paused
);
RESULT Studio.CommandReplay.setPaused(
bool paused
);
Studio.CommandReplay.setPaused(
paused
);
- paused
-
Paused state.
See Also: Studio::CommandReplay::getPaused
Sets user data.
FMOD_RESULT Studio::CommandReplay::setUserData(
void *userdata
);
FMOD_RESULT FMOD_Studio_CommandReplay_SetUserData(
FMOD_STUDIO_COMMANDREPLAY *commandreplay,
void *userdata
);
RESULT Studio.CommandReplay.setUserData(
IntPtr userdata
);
Studio.CommandReplay.setUserData(
userdata
);
- userdata
- User data.
The user data is passed to the callback functions used by the replay system.
See Also: Studio::CommandReplay::getUserData, Studio::CommandReplay::setCreateInstanceCallback, Studio::CommandReplay::setFrameCallback, Studio::CommandReplay::setLoadBankCallback
Begins playback.
FMOD_RESULT Studio::CommandReplay::start();
FMOD_RESULT FMOD_Studio_CommandReplay_Start(FMOD_STUDIO_COMMANDREPLAY *commandreplay);
RESULT Studio.CommandReplay.start();
Studio.CommandReplay.start();
If the replay is already running then calling this function will restart replay from the beginning.
See Also: Studio::CommandReplay::stop, Studio::CommandReplay::getPlaybackState
Stops playback.
FMOD_RESULT Studio::CommandReplay::stop();
FMOD_RESULT FMOD_Studio_CommandReplay_Stop(FMOD_STUDIO_COMMANDREPLAY *commandreplay);
RESULT Studio.CommandReplay.stop();
Studio.CommandReplay.stop();
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.
See Also: Studio::CommandReplay::start, Studio::CommandReplay::getPlaybackState, Studio::System::loadCommandReplay
Describes a command replay command.
typedef struct FMOD_STUDIO_COMMAND_INFO {
const char *commandname;
int parentcommandindex;
int framenumber;
float frametime;
FMOD_STUDIO_INSTANCETYPE instancetype;
FMOD_STUDIO_INSTANCETYPE outputtype;
unsigned int instancehandle;
unsigned int outputhandle;
} FMOD_STUDIO_COMMAND_INFO;
struct Studio.COMMAND_INFO
{
StringWrapper commandname;
int parentcommandindex;
int framenumber;
float frametime;
INSTANCETYPE instancetype;
INSTANCETYPE outputtype;
UInt32 instancehandle;
UInt32 outputhandle;
}
FMOD_STUDIO_COMMAND_INFO
{
commandname,
parentcommandindex,
framenumber,
frametime,
instancetype,
outputtype,
instancehandle,
outputhandle,
};
- commandname
- Fully qualified C++ name of the API function for this command. (UTF-8 string)
- parentcommandindex
- Index of the command that created the instance this command operates on, or -1 if the command does not operate on any instance.
- framenumber
- Frame the command belongs to.
- frametime
- Playback time at which this command will be executed.
- instancetype
- Type of object that this command uses as an instance. (FMOD_STUDIO_INSTANCETYPE)
- outputtype
- Type of object that this command outputs. (FMOD_STUDIO_INSTANCETYPE)
- instancehandle
- Original handle value of the instance.
- outputhandle
- Original handle value of the command output.
Note that the handle values in the instancehandle and outputhandle are from the recorded session and are not valid handles during playback.
See Also: Studio::CommandReplay::getCommandInfo
Command replay command instance handle types.
typedef enum FMOD_STUDIO_INSTANCETYPE {
FMOD_STUDIO_INSTANCETYPE_NONE,
FMOD_STUDIO_INSTANCETYPE_SYSTEM,
FMOD_STUDIO_INSTANCETYPE_EVENTDESCRIPTION,
FMOD_STUDIO_INSTANCETYPE_EVENTINSTANCE,
FMOD_STUDIO_INSTANCETYPE_PARAMETERINSTANCE,
FMOD_STUDIO_INSTANCETYPE_BUS,
FMOD_STUDIO_INSTANCETYPE_VCA,
FMOD_STUDIO_INSTANCETYPE_BANK,
FMOD_STUDIO_INSTANCETYPE_COMMANDREPLAY
} FMOD_STUDIO_INSTANCETYPE;
enum Studio.INSTANCETYPE
{
NONE,
SYSTEM,
EVENTDESCRIPTION,
EVENTINSTANCE,
PARAMETERINSTANCE,
BUS,
VCA,
BANK,
COMMANDREPLAY,
}
STUDIO_INSTANCETYPE_NONE
STUDIO_INSTANCETYPE_SYSTEM
STUDIO_INSTANCETYPE_EVENTDESCRIPTION
STUDIO_INSTANCETYPE_EVENTINSTANCE
STUDIO_INSTANCETYPE_PARAMETERINSTANCE
STUDIO_INSTANCETYPE_BUS
STUDIO_INSTANCETYPE_VCA
STUDIO_INSTANCETYPE_BANK
STUDIO_INSTANCETYPE_COMMANDREPLAY
- FMOD_STUDIO_INSTANCETYPE_NONE
- No type, handle is unused.
- FMOD_STUDIO_INSTANCETYPE_SYSTEM
- Studio::System.
- FMOD_STUDIO_INSTANCETYPE_EVENTDESCRIPTION
- Studio::EventDescription.
- FMOD_STUDIO_INSTANCETYPE_EVENTINSTANCE
- Studio::EventInstance.
- FMOD_STUDIO_INSTANCETYPE_PARAMETERINSTANCE
- Studio::ParameterInstance.
- FMOD_STUDIO_INSTANCETYPE_BUS
- Studio::Bus.
- FMOD_STUDIO_INSTANCETYPE_VCA
- Studio::VCA.
- FMOD_STUDIO_INSTANCETYPE_BANK
- Studio::Bank.
- FMOD_STUDIO_INSTANCETYPE_COMMANDREPLAY
- Studio::CommandReplay.