FMOD Engine User Manual 2.03
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_CALL 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.
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 *
.
The 'replay' argument can be used via CommandReplay
by using FMOD.Studio.CommandReplay commandReplay = new FMOD.Studio.CommandReplay(replay);
The 'eventdescription' argument can be used via EventDescription
by using FMOD.EventDescription description = new FMOD.EventDescription(eventdescription);
The 'instance' argument can be used via EventInstance
by using FMOD.EventInstance eventInstance = new FMOD.EventInstance(instance);
See Also: Studio::CommandReplay::setCreateInstanceCallback
Callback for when the command replay goes to the next frame.
FMOD_RESULT F_CALL 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.
The replay
argument can be cast to FMOD::Studio::CommandReplay *
.
The 'replay' argument can be used via CommandReplay
by using FMOD.Studio.CommandReplay commandReplay = new FMOD.Studio.CommandReplay(replay);
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
);
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
);
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
);
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
);
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
);
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
);
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 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
);
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
);
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
);
This function allows arbitrary user data to be retrieved from this object. See the User Data section of the glossary for an example of how to get and set user data.
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_CALL 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,
IntPtr bankfilename,
LOAD_BANK_FLAGS flags,
out IntPtr bank,
IntPtr userdata
);
Not supported for JavaScript.
The replay
argument can be cast to FMOD::Studio::CommandReplay *
.
The bank
argument can be cast to FMOD::Studio::Bank *
.
The 'replay' argument can be used via CommandReplay
by using FMOD.Studio.CommandReplay commandReplay = new FMOD.Studio.CommandReplay(replay);
The 'bankfilename' argument can be used via StringWrapper
by using FMOD.StringWrapper bankFilename = new FMOD.StringWrapper(bankfilename);
The 'bank' argument can be used via CommandReplay
by using FMOD.Studio.Bank studioBank = new FMOD.Studio.Bank(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
);
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
);
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
);
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.
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.
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.
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 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
);
This function allows arbitrary user data to be attached to this object. See the User Data section of the glossary for an example of how to get and set user data.
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,
};
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