FMOD Engine User Manual 2.03
An interface that manages output plug-ins.
Object 3D:
General:
Output allocate memory function.
void * F_CALL FMOD_OUTPUT_ALLOC_FUNC(
unsigned int size,
unsigned int align,
const char *file,
int line
);
Not supported for C#.
Not supported for JavaScript.
Allocation size.
Memory alignment.
file
.See Also: FMOD_OUTPUT_STATE
Output close port callback.
FMOD_RESULT F_CALL FMOD_OUTPUT_CLOSEPORT_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
int portId
);
Not supported for C#.
Not supported for JavaScript.
Main thread callback to close an auxiliary output port on the device.
See Also: FMOD_OUTPUT_DESCRIPTION
Output close callback.
This callback is called to shut down and release the output driver's audio interface.
FMOD_RESULT F_CALL FMOD_OUTPUT_CLOSE_CALLBACK(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
To stop the output stream, rather than closing and shutting it down, FMOD_OUTPUT_STOP_CALLBACK would be used.
See Also: FMOD_OUTPUT_DESCRIPTION
Output copy port function.
Function to copy the output from the mixer for the given auxiliary port.
FMOD_RESULT F_CALL FMOD_OUTPUT_COPYPORT_FUNC(
FMOD_OUTPUT_STATE *output_state,
int portId,
void *buffer,
unsigned int length
);
Not supported for C#.
Not supported for JavaScript.
buffer
See Also: FMOD_OUTPUT_STATE
Output description.
This description structure allows the plug-in writer to define all functionality required for a user-defined output device.
typedef struct FMOD_OUTPUT_DESCRIPTION {
unsigned int apiversion;
const char *name;
unsigned int version;
FMOD_OUTPUT_METHOD method;
FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK getnumdrivers;
FMOD_OUTPUT_GETDRIVERINFO_CALLBACK getdriverinfo;
FMOD_OUTPUT_INIT_CALLBACK init;
FMOD_OUTPUT_START_CALLBACK start;
FMOD_OUTPUT_STOP_CALLBACK stop;
FMOD_OUTPUT_CLOSE_CALLBACK close;
FMOD_OUTPUT_UPDATE_CALLBACK update;
FMOD_OUTPUT_GETHANDLE_CALLBACK gethandle;
FMOD_OUTPUT_MIXER_CALLBACK mixer;
FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK object3dgetinfo;
FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK object3dalloc;
FMOD_OUTPUT_OBJECT3DFREE_CALLBACK object3dfree;
FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK object3dupdate;
FMOD_OUTPUT_OPENPORT_CALLBACK openport;
FMOD_OUTPUT_CLOSEPORT_CALLBACK closeport;
FMOD_OUTPUT_DEVICELISTCHANGED_CALLBACK devicelistchanged;
} FMOD_OUTPUT_DESCRIPTION;
FMOD_OUTPUT_DESCRIPTION
{
apiversion,
name,
version,
method,
getnumdrivers,
getdriverinfo,
init,
start,
stop,
close,
update,
gethandle,
mixer,
object3dgetinfo,
object3dalloc,
object3dfree,
object3dupdate,
openport,
closeport,
devicelistchanged
};
Not supported for C#.
Pass this structure to System::registerOutput to create a new output type, or if defining a dynamically loadable plug-in, return it in a function called FMODGetOutputDescription
. FMOD's plug-in loader will look for this function in a dynamic library.
/*
Plug-in setup example
*/
extern "C" FMOD_OUTPUT_DESCRIPTION* F_CALL FMODGetOutputDescription()
{
static FMOD_OUTPUT_DESCRIPTION desc;
/*
Fill members of structure
*/
return &desc;
}
There are several methods for driving the FMOD mixer to service the audio hardware.
Callbacks marked with 'user thread' will be called in response to the user of the Core API. In the case of the Studio API, the user is the Studio update thread.
See Also: FMOD_OUTPUT_STATE
Output device list change callback.
FMOD_RESULT F_CALL FMOD_OUTPUT_DEVICELISTCHANGED_CALLBACK(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
See Also: FMOD_OUTPUT_DESCRIPTION
Output free memory function.
void F_CALL FMOD_OUTPUT_FREE_FUNC(
void *ptr,
const char *file,
int line
);
Not supported for C#.
Not supported for JavaScript.
file
.See Also: FMOD_OUTPUT_STATE
Output get driver info callback.
This callback is called to provide the user with information about the selected audio driver.
FMOD_RESULT F_CALL FMOD_OUTPUT_GETDRIVERINFO_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
int id,
char *name,
int namelen,
FMOD_GUID *guid,
int *systemrate,
FMOD_SPEAKERMODE *speakermode,
int *speakermodechannels
);
Not supported for C#.
Not supported for JavaScript.
The length of name buffer being passed in by the user.
The rate the output device prefers. Leave 0 to remain flexible.
Invoked by:
See Also: System::getNumDrivers, FMOD_OUTPUT_DESCRIPTION, System::getNumDrivers, FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK
Output get output handle callback.
This callback is called to provide the user with a low level audio interface handle that may be used to pass to other middleware.
FMOD_RESULT F_CALL FMOD_OUTPUT_GETHANDLE_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
void **handle
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback is only needed if the plug-in writer wants to allow the user access to the main handle behind the plug-in (for example the file handle in a file writer plug-in). The plug-in writer needs to document and publish the type of the handle, as is done in the documentation for System::getOutputHandle.
See Also: FMOD_OUTPUT_DESCRIPTION
Output get number of drivers callback.
This callback is called to provide the user with the number of devices usable for the output mode.
FMOD_RESULT F_CALL FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
int *numdrivers
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
Optional. FMOD will assume 0 if this is not specified.
See Also: FMOD_OUTPUT_DESCRIPTION, System::getDriverInfo, FMOD_OUTPUT_GETDRIVERINFO_CALLBACK
Output initialization callback.
This callback is called to allow initialization of the output stream for mixing.
FMOD_RESULT F_CALL FMOD_OUTPUT_INIT_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
int selecteddriver,
FMOD_INITFLAGS flags,
int *outputrate,
FMOD_SPEAKERMODE *speakermode,
int *speakermodechannels,
FMOD_SOUND_FORMAT *outputformat,
int dspbufferlength,
int *dspnumbuffers,
int *dspnumadditionalbuffers,
void *extradriverdata
);
Not supported for C#.
Not supported for JavaScript.
Output rate selected by the user. If not possible, change the rate to the closest match. FMOD will resample from the rate requested to your rate if they do not match.
Size of the buffer fmod will mix to in one mix update.
Invoked by:
See Also: FMOD_OUTPUT_DESCRIPTION, System::setDriver
Output log function.
Call this function in an output plug-in context to utilize the FMOD Engine's debugging system.
void F_CALL FMOD_OUTPUT_LOG_FUNC(
FMOD_DEBUG_FLAGS level,
const char *file,
int line,
const char *function,
const char *string,
...
);
Not supported for C#.
Not supported for JavaScript.
file
.See Also: FMOD_OUTPUT_STATE
Output method used to interact with the mixer.
#define FMOD_OUTPUT_METHOD_MIX_DIRECT 0
#define FMOD_OUTPUT_METHOD_MIX_BUFFERED 2
OUTPUT_METHOD_MIX_DIRECT = 0
OUTPUT_METHOD_MIX_BUFFERED = 1
Not supported for C#.
For hardware that presents a callback that must be filled immediately FMOD_OUTPUT_METHOD_MIX_BUFFERED is recommended as buffering occurs in a separate thread, reading from the mixer is simply a memcpy. Using FMOD_OUTPUT_METHOD_MIX_DIRECT is recommended if you want to take direct control of how and when the mixer runs.
See Also: FMOD_OUTPUT_DESCRIPTION
Output mixer callback.
This callback can be used to stall the FMOD mixer thread until it is ready to call the FMOD mixer directly.
FMOD_RESULT F_CALL FMOD_OUTPUT_MIXER_CALLBACK(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback must use the FMOD_OUTPUT_READFROMMIXER_FUNC function to produce the audio stream needed by the output.
This callback is optional in FMOD_OUTPUT_METHOD_MIX_DIRECT or FMOD_OUTPUT_METHOD_MIX_BUFFERED mode. An output mode may avoid this callback, and instead use its own timing system to call the FMOD mixer with FMOD_OUTPUT_READFROMMIXER_FUNC.
If this callback is used, it will be triggered immediately from the FMOD mixer thread. The callback can then stall with its own synchronization primitive (ie a wait on a semaphore), until something else signals the primitive to execute a mix with FMOD_OUTPUT_READFROMMIXER_FUNC.
Ensure you have a reasonable timeout (~200ms) on your synchronization primitive and allow this callback to return regularly, to avoid deadlocks.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_STATE
Output 3D Object alloc callback.
This callback is called to reserve hardware resources for a single 3D object.
FMOD_RESULT F_CALL FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
void **object3d
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback is used for 'Object based audio' where sound hardware can receive individual audio streams and position them in 3D space natively, separate from the FMOD mixer. A typical implementation would be something like Dolby Atmos or Playstation VR.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK, FMOD_OUTPUT_OBJECT3DFREE_CALLBACK, FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK
Output 3D Object free callback.
This callback is called to release a hardware resource previously acquired with FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK.
FMOD_RESULT F_CALL FMOD_OUTPUT_OBJECT3DFREE_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
void *object3d
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback is used for 'Object based audio' where sound hardware can receive individual audio streams and position them in 3D space natively, separate from the FMOD mixer. A typical implementation would be something like Dolby Atmos or Atmos or Playstation VR.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK, FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK, FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK
Output 3D Object get info callback.
Called from the mixer thread to provide information about the capabilities of 3D object hardware.
FMOD_RESULT F_CALL FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
int *maxhardwareobjects
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback is used for 'Object based audio' where sound hardware can receive individual audio streams and position them in 3D space natively, separate from the FMOD mixer. A typical implementation would be something like Dolby Atmos or Atmos or Playstation VR.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK, FMOD_OUTPUT_OBJECT3DFREE_CALLBACK, FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK
Output 3D Object Info.
typedef struct FMOD_OUTPUT_OBJECT3DINFO {
float *buffer;
unsigned int bufferlength;
FMOD_VECTOR position;
float gain;
float spread;
float priority;
} FMOD_OUTPUT_OBJECT3DINFO;
FMOD_OUTPUT_OBJECT3DINFO
{
buffer,
bufferlength,
position,
gain,
spread,
priority,
};
Not supported for C#.
This callback is used for 'Object mixing' where sound hardware can receive individual audio streams and position them in 3D space natively, separate from the FMOD mixer. A typical implementation would be something like Dolby Atmos or Atmos or Playstation VR.
This structure is passed to the plug-in via FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK, so that any object-based panning solution available can position it in the speakers correctly.
Object based panning is a 3D panning solution that sends a mono-only signal to a hardware device, such as Dolby Atmos or other similar panning solutions.
FMOD does not attenuate the buffer, but provides a 'gain' parameter that the user must use to scale the buffer by. Rather than pre-attenuating the buffer, the plug-in developer can access untouched data for other purposes, like reverb sending for example.
The 'gain' parameter is based on the user's 3D custom roll-off model.
See Also: FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK
Output 3D Object update callback.
Called from the mixer thread once for every acquired 3D object every mix to provide 3D information and buffered audio.
FMOD_RESULT F_CALL FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
void *object3d,
const FMOD_OUTPUT_OBJECT3DINFO *info
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback is used for 'Object based audio' where sound hardware can receive individual audio streams and position them in 3D space natively, separate from the FMOD mixer. A typical implementation would be something like Dolby Atmos or Atmos or Playstation VR.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK, FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK, FMOD_OUTPUT_OBJECT3DFREE_CALLBACK
Output open port callback.
FMOD_RESULT F_CALL FMOD_OUTPUT_OPENPORT_CALLBACK(
FMOD_OUTPUT_STATE *output_state,
FMOD_PORT_TYPE portType,
FMOD_PORT_INDEX portIndex,
int *portId,
int *portRate,
int *portChannels,
FMOD_SOUND_FORMAT *portFormat
);
Not supported for C#.
Not supported for JavaScript.
Port rate.
Main thread callback to open an auxiliary output port on the device.
See Also: FMOD_OUTPUT_DESCRIPTION
The output plug-in API version the plug-in was created with.
#define FMOD_OUTPUT_PLUGIN_VERSION 5
FMOD.OUTPUT_PLUGIN_VERSION
Currently not supported for C#.
See Also: FMOD_OUTPUT_DESCRIPTION
Output read from mixer function.
FMOD_RESULT F_CALL FMOD_OUTPUT_READFROMMIXER_FUNC(
FMOD_OUTPUT_STATE *output_state,
void *buffer,
unsigned int length
);
Not supported for C#.
Not supported for JavaScript.
Called by the plug-in. Use this function from your own driver irq/timer to read some data from FMOD's DSP engine. All of the resulting output caused by playing sounds and specifying effects by the user of the plug-in is mixed here and written to the memory provided by you.
Output request reset function.
Request the output to shut down and restart.
FMOD_RESULT F_CALL FMOD_OUTPUT_REQUESTRESET_FUNC(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
If this is issued, the output will not reset immediately, but on the next udpate the output will first shut down with a call to the FMOD_OUTPUT_STOP_CALLBACK then FMOD_OUTPUT_CLOSE_CALLBACK, followed by a restart with FMOD_OUTPUT_INIT_CALLBACK and FMOD_OUTPUT_START_CALLBACK
Output start callback.
Called just before mixing should begin. This callback is called to start the output driver's audio stream.
FMOD_RESULT F_CALL FMOD_OUTPUT_START_CALLBACK(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This function is meant for starting the output audio rather than allocating memory and initializing interfaces like FMOD_OUTPUT_INIT_CALLBACK would.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_STOP_CALLBACK
Output object state passed into every callback provides access to plug-in developers data and system functionality.
typedef struct FMOD_OUTPUT_STATE {
void *plugindata;
FMOD_OUTPUT_READFROMMIXER_FUNC readfrommixer;
FMOD_OUTPUT_ALLOC_FUNC alloc;
FMOD_OUTPUT_FREE_FUNC free;
FMOD_OUTPUT_LOG_FUNC log;
FMOD_OUTPUT_COPYPORT_FUNC copyport;
FMOD_OUTPUT_REQUESTRESET_FUNC requestreset;
} FMOD_OUTPUT_STATE;
FMOD_OUTPUT_STATE
{
plugindata,
};
Not supported for C#.
See Also: FMOD_OUTPUT_DESCRIPTION
Output stop callback.
Called just after mixing has ended. This callback is called to stop the output driver's audio stream.
FMOD_RESULT F_CALL FMOD_OUTPUT_STOP_CALLBACK(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This function is meant for stopping the output audio rather than freeing memory and shutting down audio interfaces like FMOD_OUTPUT_CLOSE_CALLBACK would.
See Also: FMOD_OUTPUT_DESCRIPTION, FMOD_OUTPUT_START_CALLBACK
Output update callback.
FMOD_RESULT F_CALL FMOD_OUTPUT_UPDATE_CALLBACK(
FMOD_OUTPUT_STATE *output_state
);
Not supported for C#.
Not supported for JavaScript.
Invoked by:
This callback is invoked from the main application update which allows the output to process data in sync with the application, rather than the mixer thread.
See Also: FMOD_OUTPUT_DESCRIPTION, System::update