FMOD Engine User Manual 2.03
Management object from which all resources are created and played.
Create with System_Create.
Lifetime management:
Device selection:
Setup:
File system setup:
Plug-in support:
Network configuration:
Information:
Creation and retrieval:
Runtime control:
Recording:
Geometry management:
General:
Callback to allow custom calculation of distance attenuation.
float F_CALL FMOD_3D_ROLLOFF_CALLBACK(
FMOD_CHANNELCONTROL *channelcontrol,
float distance
);
delegate float CB_3D_ROLLOFFCALLBACK(
IntPtr channelcontrol,
float distance
);
Not supported for JavaScript.
Distance from the listener.
channelcontrol
can be cast to Channel *
.
See Also: System::set3DRolloffCallback, System::set3DListenerAttributes, System::get3DListenerAttributes
Advanced configuration settings.
Structure to allow configuration of lesser used system level settings. These tweaks generally allow the user to set resource limits and customize settings to better fit their application.
typedef struct FMOD_ADVANCEDSETTINGS {
int cbSize;
int maxMPEGCodecs;
int maxADPCMCodecs;
int maxXMACodecs;
int maxVorbisCodecs;
int maxAT9Codecs;
int maxFADPCMCodecs;
int maxOpusCodecs;
int ASIONumChannels;
char **ASIOChannelList;
FMOD_SPEAKER *ASIOSpeakerList;
float vol0virtualvol;
unsigned int defaultDecodeBufferSize;
unsigned short profilePort;
unsigned int geometryMaxFadeTime;
float distanceFilterCenterFreq;
int reverb3Dinstance;
int DSPBufferPoolSize;
FMOD_DSP_RESAMPLER resamplerMethod;
unsigned int randomSeed;
int maxConvolutionThreads;
int maxSpatialObjects;
} FMOD_ADVANCEDSETTINGS;
struct ADVANCEDSETTINGS
{
int cbSize;
int maxMPEGCodecs;
int maxADPCMCodecs;
int maxXMACodecs;
int maxVorbisCodecs;
int maxAT9Codecs;
int maxFADPCMCodecs;
int maxOpusCodecs;
int ASIONumChannels;
IntPtr ASIOChannelList;
IntPtr ASIOSpeakerList;
float vol0virtualvol;
uint defaultDecodeBufferSize;
ushort profilePort;
uint geometryMaxFadeTime;
float distanceFilterCenterFreq;
int reverb3Dinstance;
int DSPBufferPoolSize;
DSP_RESAMPLER resamplerMethod;
uint randomSeed;
int maxConvolutionThreads;
int maxSpatialObjects;
}
ADVANCEDSETTINGS
{
maxMPEGCodecs,
maxADPCMCodecs,
maxXMACodecs,
maxVorbisCodecs,
maxAT9Codecs,
maxFADPCMCodecs,
maxOpusCodecs,
ASIONumChannels,
vol0virtualvol,
defaultDecodeBufferSize,
profilePort,
geometryMaxFadeTime,
distanceFilterCenterFreq,
reverb3Dinstance,
DSPBufferPoolSize,
resamplerMethod,
randomSeed,
maxConvolutionThreads,
maxSpatialObjects,
};
Maximum MPEG Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Maximum IMA-ADPCM Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Maximum XMA Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Maximum Vorbis Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Maximum AT9 Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Maximum FADPCM Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Maximum Opus Sounds created as FMOD_CREATECOMPRESSEDSAMPLE.
Number of elements in ASIOSpeakerList
on input, number of elements in ASIOChannelList
on output.
ASIONumChannels
. Only valid after System::init.ASIONumChannels
. Use FMOD_SPEAKER_NONE to indicate no output for a given speaker. (FMOD_SPEAKER)For use with FMOD_INIT_VOL0_BECOMES_VIRTUAL, Channels with audibility below this will become virtual. See the Virtual Voices guide for more information.
For use with Streams, the default size of the double buffer.
For use with FMOD_INIT_PROFILE_ENABLE, specify the port to listen on for connections by FMOD Studio or FMOD Profiler.
For use with Geometry, the maximum time it takes for a Channel to fade to the new volume level when its occlusion changes.
For use with FMOD_INIT_CHANNEL_DISTANCEFILTER, the default center frequency for the distance filter.
For use with Reverb3D, selects which global reverb instance to use.
Number of intermediate mixing buffers in the DSP buffer pool. Each buffer in bytes is bufferlength
(See System::getDSPBufferSize) * sizeof(float) * output mode speaker count (See FMOD_SPEAKERMODE). ie 7.1 @ 1024 DSP block size = 1024 * 4 * 8 = 32KB.
Maximum number of CPU threads to use for FMOD_DSP_TYPE_CONVOLUTIONREVERB effect. 1 = effect is entirely processed inside the FMOD_THREAD_TYPE_MIXER thread. 2 and 3 offloads different parts of the convolution processing into different threads (FMOD_THREAD_TYPE_CONVOLUTION1 and FMOD_THREAD_TYPE_CONVOLUTION2 to increase throughput.
Maximum Spatial Objects that can be reserved per FMOD system. FMOD_OUTPUTTYPE_AUDIO3D is a special case where multiple FMOD systems are not allowed. See the Object based approach section of the Spatial Audio white paper. A value of -1 means no Spatial Objects will be reserved. A value of 0 means all available Spatial Objects will be reserved. Any other value means it will reserve that many Spatial Objects.
All members have a default of 0 except for cbSize
, so clearing the whole structure to zeroes first then setting cbSize
is a common use pattern.
Specifying one of the codec maximums will help determine the maximum CPU usage of playing FMOD_CREATECOMPRESSEDSAMPLE Sounds of that type as well as the memory requirements. Memory will be allocated for 'up front' (during System::init) if these values are specified as non zero. If any are zero, it allocates memory for the codec whenever a file of the type in question is loaded. So if maxMPEGCodecs
is 0 for example, it will allocate memory for the MPEG codecs the first time an MP3 is loaded or an MP3 based .FSB file is loaded.
Setting DSPBufferPoolSize
pre-allocates memory for the FMOD DSP graph. See the DSP architecture guide. By default, eight buffers are created up front. A large graph might require more if the aim is to avoid real-time allocations from the FMOD mixer thread.
See Also: System::setAdvancedSettings, System::getAdvancedSettings
Information about a single asynchronous file operation.
typedef struct FMOD_ASYNCREADINFO {
void *handle;
unsigned int offset;
unsigned int sizebytes;
int priority;
void *userdata;
void *buffer;
unsigned int bytesread;
FMOD_FILE_ASYNCDONE_FUNC done;
} FMOD_ASYNCREADINFO;
struct ASYNCREADINFO
{
IntPtr handle;
uint offset;
uint sizebytes;
int priority;
IntPtr userdata;
IntPtr buffer;
uint bytesread;
FILE_ASYNCDONE_FUNC done;
}
Not supported for JavaScript.
buffer
.When servicing the async read operation, read from handle
at the given offset
for sizebytes
into buffer
. Write the number of bytes read into bytesread
then call done
with the FMOD_RESULT that matches the success of the operation.
See Also: FMOD_FILE_ASYNCREAD_CALLBACK
Additional options for creating a Sound.
typedef struct FMOD_CREATESOUNDEXINFO {
int cbsize;
unsigned int length;
unsigned int fileoffset;
int numchannels;
int defaultfrequency;
FMOD_SOUND_FORMAT format;
unsigned int decodebuffersize;
int initialsubsound;
int numsubsounds;
int *inclusionlist;
int inclusionlistnum;
FMOD_SOUND_PCMREAD_CALLBACK pcmreadcallback;
FMOD_SOUND_PCMSETPOS_CALLBACK pcmsetposcallback;
FMOD_SOUND_NONBLOCK_CALLBACK nonblockcallback;
const char *dlsname;
const char *encryptionkey;
int maxpolyphony;
void *userdata;
FMOD_SOUND_TYPE suggestedsoundtype;
FMOD_FILE_OPEN_CALLBACK fileuseropen;
FMOD_FILE_CLOSE_CALLBACK fileuserclose;
FMOD_FILE_READ_CALLBACK fileuserread;
FMOD_FILE_SEEK_CALLBACK fileuserseek;
FMOD_FILE_ASYNCREAD_CALLBACK fileuserasyncread;
FMOD_FILE_ASYNCCANCEL_CALLBACK fileuserasynccancel;
void *fileuserdata;
int filebuffersize;
FMOD_CHANNELORDER channelorder;
FMOD_SOUNDGROUP *initialsoundgroup;
unsigned int initialseekposition;
FMOD_TIMEUNIT initialseekpostype;
int ignoresetfilesystem;
unsigned int audioqueuepolicy;
unsigned int minmidigranularity;
int nonblockthreadid;
FMOD_GUID *fsbguid;
} FMOD_CREATESOUNDEXINFO;
struct CREATESOUNDEXINFO
{
int cbsize;
uint length;
uint fileoffset;
int numchannels;
int defaultfrequency;
SOUND_FORMAT format;
uint decodebuffersize;
int initialsubsound;
int numsubsounds;
IntPtr inclusionlist;
int inclusionlistnum;
SOUND_PCMREADCALLBACK pcmreadcallback;
SOUND_PCMSETPOSCALLBACK pcmsetposcallback;
SOUND_NONBLOCKCALLBACK nonblockcallback;
IntPtr dlsname;
IntPtr encryptionkey;
int maxpolyphony;
IntPtr userdata;
SOUND_TYPE suggestedsoundtype;
FILE_OPENCALLBACK fileuseropen;
FILE_CLOSECALLBACK fileuserclose;
FILE_READCALLBACK fileuserread;
FILE_SEEKCALLBACK fileuserseek;
FILE_ASYNCREADCALLBACK fileuserasyncread;
FILE_ASYNCCANCELCALLBACK fileuserasynccancel;
IntPtr fileuserdata;
int filebuffersize;
CHANNELORDER channelorder;
IntPtr initialsoundgroup;
uint initialseekposition;
TIMEUNIT initialseekpostype;
int ignoresetfilesystem;
uint audioqueuepolicy;
uint minmidigranularity;
int nonblockthreadid;
IntPtr fsbguid;
}
CREATESOUNDEXINFO
{
length,
fileoffset,
numchannels,
defaultfrequency,
format,
decodebuffersize,
initialsubsound,
numsubsounds,
inclusionlist,
inclusionlistnum,
pcmreadcallback,
pcmsetposcallback,
nonblockcallback,
dlsname,
encryptionkey,
maxpolyphony,
userdata,
suggestedsoundtype,
fileuseropen,
fileuserclose,
fileuserread,
fileuserseek,
fileuserasyncread,
fileuserasynccancel,
fileuserdata,
filebuffersize,
channelorder,
initialsoundgroup,
initialseekposition,
initialseekpostype,
ignoresetfilesystem,
audioqueuepolicy,
minmidigranularity,
nonblockthreadid,
};
Bytes to read starting at fileoffset
, or length of Sound to create for FMOD_OPENUSER, or length of name_or_data
for FMOD_OPENMEMORY / FMOD_OPENMEMORY_POINT.
File offset to start reading from.
Number of channels in sound data for FMOD_OPENUSER / FMOD_OPENRAW.
Default frequency of sound data for FMOD_OPENUSER / FMOD_OPENRAW.
Size of the decoded buffer for FMOD_CREATESTREAM, or the block size used with pcmreadcallback
for FMOD_OPENUSER.
defaultfrequency
.inclusionlist
.Maximum voice count for FMOD_SOUND_TYPE_MIDI / FMOD_SOUND_TYPE_IT.
initialseekposition
. (FMOD_TIMEUNIT)Mixer granularity for FMOD_SOUND_TYPE_MIDI sounds, smaller numbers give a more accurate reproduction at the cost of higher CPU usage.
Thread index to execute FMOD_NONBLOCKING loads on for parallel Sound loading.
Loading a file from memory:
length
for the size of the memory block in bytes.Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length:
fileoffset
and length
.Create a user created / non-file based sound:
defaultfrequency
, numchannels
and format
.Load an FSB stream seeking to a specific subsound in one file operation:
initialsubsound
.Load a subset of the Sounds in an FSB saving memory:
inclusionlist
and inclusionlistnum
.numsubsounds
to match 'inclusionlistnum', saves memory and causes Sound::getSubSound to index into inclusionlist
.Capture sound data as it is decoded:
pcmreadcallback
and pcmseekcallback
.Provide a custom DLS for MIDI playback:
dlsname
.Setting the decodebuffersize
is for CPU intensive codecs that may be causing stuttering, not file intensive codecs (i.e. those from CD or net streams) which are normally altered with System::setStreamBufferSize. As an example of CPU intensive codecs, an MP3 file will take more CPU to decode than a PCM wav file.
If you hear stuttering, then the codec is using more CPU than the decode buffer playback rate can keep up with. Increasing the decodebuffersize
is likely to solve this problem.
FSB codec. If inclusionlist
and numsubsounds
are used together, this will trigger a special mode where subsounds are shuffled down to save memory (useful for large FSB files where you only want to load 1 sound). There will be no gaps, ie no null subsounds. As an example, if there are 10,000 subsounds and there is an inclusionlist
with only 1 entry, and numsubsounds
= 1, then subsound 0 will be that entry, and there will only be the memory allocated for 1 subsound. Previously there would still be 10,000 subsound pointers and other associated codec entries allocated along with it multiplied by 10,000.
See Also: Callback Behavior, System::createSound
Flags that provide additional information about a particular driver.
#define FMOD_DRIVER_STATE_CONNECTED 0x00000001
#define FMOD_DRIVER_STATE_DEFAULT 0x00000002
[Flags]
enum DRIVER_STATE : uint
{
CONNECTED = 0x00000001,
DEFAULT = 0x00000002,
}
DRIVER_STATE_CONNECTED = 0x00000001
DRIVER_STATE_DEFAULT = 0x00000002
See Also: System::getRecordDriverInfo
List of interpolation types used for resampling.
typedef enum FMOD_DSP_RESAMPLER {
FMOD_DSP_RESAMPLER_DEFAULT,
FMOD_DSP_RESAMPLER_NOINTERP,
FMOD_DSP_RESAMPLER_LINEAR,
FMOD_DSP_RESAMPLER_CUBIC,
FMOD_DSP_RESAMPLER_SPLINE,
FMOD_DSP_RESAMPLER_MAX
} FMOD_DSP_RESAMPLER;
enum DSP_RESAMPLER : int
{
DEFAULT,
NOINTERP,
LINEAR,
CUBIC,
SPLINE,
MAX
}
DSP_RESAMPLER_DEFAULT
DSP_RESAMPLER_NOINTERP
DSP_RESAMPLER_LINEAR
DSP_RESAMPLER_CUBIC
DSP_RESAMPLER_SPLINE
DSP_RESAMPLER_MAX
Use System::setAdvancedSettings and FMOD_ADVANCEDSETTINGS::resamplerMethod to configure the resampling quality you require for sample rate conversion during sound playback.
Information describing an error that has occurred.
typedef struct FMOD_ERRORCALLBACK_INFO {
FMOD_RESULT result;
FMOD_ERRORCALLBACK_INSTANCETYPE instancetype;
void *instance;
const char *functionname;
const char *functionparams;
} FMOD_ERRORCALLBACK_INFO;
struct ERRORCALLBACK_INFO
{
RESULT result;
ERRORCALLBACK_INSTANCETYPE instancetype;
IntPtr instance;
StringWrapper functionname;
StringWrapper functionparams;
}
ERRORCALLBACK_INFO
{
result,
instancetype,
instance,
functionname,
functionparams,
};
The instance pointer will be a type corresponding to the instanceType enum.
See Also: FMOD_SYSTEM_CALLBACK, FMOD_SYSTEM_CALLBACK_ERROR
Identifier used to represent the different types of instance in the error callback.
typedef enum FMOD_ERRORCALLBACK_INSTANCETYPE {
FMOD_ERRORCALLBACK_INSTANCETYPE_NONE,
FMOD_ERRORCALLBACK_INSTANCETYPE_SYSTEM,
FMOD_ERRORCALLBACK_INSTANCETYPE_CHANNEL,
FMOD_ERRORCALLBACK_INSTANCETYPE_CHANNELGROUP,
FMOD_ERRORCALLBACK_INSTANCETYPE_CHANNELCONTROL,
FMOD_ERRORCALLBACK_INSTANCETYPE_SOUND,
FMOD_ERRORCALLBACK_INSTANCETYPE_SOUNDGROUP,
FMOD_ERRORCALLBACK_INSTANCETYPE_DSP,
FMOD_ERRORCALLBACK_INSTANCETYPE_DSPCONNECTION,
FMOD_ERRORCALLBACK_INSTANCETYPE_GEOMETRY,
FMOD_ERRORCALLBACK_INSTANCETYPE_REVERB3D,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_SYSTEM,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_EVENTDESCRIPTION,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_EVENTINSTANCE,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_PARAMETERINSTANCE,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_BUS,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_VCA,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_BANK,
FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_COMMANDREPLAY
} FMOD_ERRORCALLBACK_INSTANCETYPE;
enum ERRORCALLBACK_INSTANCETYPE
{
NONE,
SYSTEM,
CHANNEL,
CHANNELGROUP,
CHANNELCONTROL,
SOUND,
SOUNDGROUP,
DSP,
DSPCONNECTION,
GEOMETRY,
REVERB3D,
STUDIO_SYSTEM,
STUDIO_EVENTDESCRIPTION,
STUDIO_EVENTINSTANCE,
STUDIO_PARAMETERINSTANCE,
STUDIO_BUS,
STUDIO_VCA,
STUDIO_BANK,
STUDIO_COMMANDREPLAY
}
ERRORCALLBACK_INSTANCETYPE_NONE
ERRORCALLBACK_INSTANCETYPE_SYSTEM
ERRORCALLBACK_INSTANCETYPE_CHANNEL
ERRORCALLBACK_INSTANCETYPE_CHANNELGROUP
ERRORCALLBACK_INSTANCETYPE_CHANNELCONTROL
ERRORCALLBACK_INSTANCETYPE_SOUND
ERRORCALLBACK_INSTANCETYPE_SOUNDGROUP
ERRORCALLBACK_INSTANCETYPE_DSP
ERRORCALLBACK_INSTANCETYPE_DSPCONNECTION
ERRORCALLBACK_INSTANCETYPE_GEOMETRY
ERRORCALLBACK_INSTANCETYPE_REVERB3D
ERRORCALLBACK_INSTANCETYPE_STUDIO_SYSTEM
ERRORCALLBACK_INSTANCETYPE_STUDIO_EVENTDESCRIPTION
ERRORCALLBACK_INSTANCETYPE_STUDIO_EVENTINSTANCE
ERRORCALLBACK_INSTANCETYPE_STUDIO_PARAMETERINSTANCE
ERRORCALLBACK_INSTANCETYPE_STUDIO_BUS
ERRORCALLBACK_INSTANCETYPE_STUDIO_VCA
ERRORCALLBACK_INSTANCETYPE_STUDIO_BANK
ERRORCALLBACK_INSTANCETYPE_STUDIO_COMMANDREPLAY
See Also: FMOD_ERRORCALLBACK_INFO, FMOD_SYSTEM_CALLBACK, FMOD_SYSTEM_CALLBACK_ERROR
Callback for cancelling a pending asynchronous read.
This callback is called to stop/release or shut down the resource that is holding the file, for example: releasing a Sound stream.
FMOD_RESULT F_CALL FMOD_FILE_ASYNCCANCEL_CALLBACK(
FMOD_ASYNCREADINFO *info,
void *userdata
);
delegate RESULT FILE_ASYNCCANCELCALLBACK(
IntPtr info,
IntPtr userdata
);
Not supported for JavaScript.
Before returning from this callback the implementation must ensure that all references to info
are relinquished.
See Also: System::setFileSystem, FMOD_FILE_OPEN_CALLBACK, FMOD_FILE_CLOSE_CALLBACK, FMOD_FILE_READ_CALLBACK, FMOD_FILE_SEEK_CALLBACK, FMOD_FILE_ASYNCREAD_CALLBACK
Function to be called when asynchronous reading is finished.
void F_CALL FMOD_FILE_ASYNCDONE_FUNC(
FMOD_ASYNCREADINFO *info,
FMOD_RESULT result
);
delegate void FILE_ASYNCDONE_FUNC(
IntPtr info,
RESULT result
);
Not supported for JavaScript.
Relevant result codes to use with this function include:
Callback for reading from a file asynchronously.
FMOD_RESULT F_CALL FMOD_FILE_ASYNCREAD_CALLBACK(
FMOD_ASYNCREADINFO *info,
void *userdata
);
delegate RESULT FILE_ASYNCREADCALLBACK(
IntPtr info,
IntPtr userdata
);
Not supported for JavaScript.
This callback allows you to accept a file I/O request without servicing it immediately. The callback can queue or store the FMOD_ASYNCREADINFO structure pointer, so that a 'servicing routine' can read the data and mark the job as done.
Marking an asynchronous job as 'done' outside of this callback can be done by calling the FMOD_ASYNCREADINFO::done function pointer with the file read result as a parameter.
If the servicing routine is processed in the same thread as the thread that invokes this callback (for example the thread that calls System::createSound or System::createStream), a deadlock will occur because while System::createSound or System::createStream waits for the file data, the servicing routine in the main thread won't be able to execute.
This typically means an outside servicing routine should typically be run in a separate thread.
The read request can be queued or stored and this callback can return immediately with FMOD_OK. Returning an error at this point will cause FMOD to stop what it was doing and return back to the caller. If it is from FMOD's stream thread, the stream will typically stop.
See Also: System::setFileSystem, FMOD_FILE_OPEN_CALLBACK, FMOD_FILE_CLOSE_CALLBACK, FMOD_FILE_READ_CALLBACK, FMOD_FILE_SEEK_CALLBACK, FMOD_FILE_ASYNCCANCEL_CALLBACK
Calback for closing a file.
FMOD_RESULT F_CALL FMOD_FILE_CLOSE_CALLBACK(
void *handle,
void *userdata
);
delegate RESULT FILE_CLOSECALLBACK(
IntPtr handle,
IntPtr userdata
);
function FMOD_FILE_CLOSE_CALLBACK(
handle,
userdata
)
Close any user created file handle and perform any cleanup necessary for the file here. If the callback is from System::attachFileSystem, then the return value is ignored.
See Also: System::setFileSystem, FMOD_FILE_OPEN_CALLBACK, FMOD_FILE_READ_CALLBACK, FMOD_FILE_SEEK_CALLBACK, FMOD_FILE_ASYNCREAD_CALLBACK, FMOD_FILE_ASYNCCANCEL_CALLBACK
Callback for opening a file.
FMOD_RESULT F_CALL FMOD_FILE_OPEN_CALLBACK(
const char *name,
unsigned int *filesize,
void **handle,
void *userdata
);
delegate RESULT FILE_OPENCALLBACK(
IntPtr name,
ref uint filesize,
ref IntPtr handle,
IntPtr userdata
);
function FMOD_FILE_OPEN_CALLBACK(
name,
filesize,
handle,
userdata
)
Size of the file.
Return the appropriate error code such as FMOD_ERR_FILE_NOTFOUND if the file fails to open. If the callback is from System::attachFileSystem, then the return value is ignored.
The 'name' argument can be used via StringWrapper
by using FMOD.StringWrapper nameStr = new FMOD.StringWrapper(name);
See Also: System::setFileSystem, FMOD_FILE_CLOSE_CALLBACK, FMOD_FILE_READ_CALLBACK, FMOD_FILE_SEEK_CALLBACK, FMOD_FILE_ASYNCREAD_CALLBACK, FMOD_FILE_ASYNCCANCEL_CALLBACK
Callback for reading from a file.
FMOD_RESULT F_CALL FMOD_FILE_READ_CALLBACK(
void *handle,
void *buffer,
unsigned int sizebytes,
unsigned int *bytesread,
void *userdata
);
delegate RESULT FILE_READCALLBACK(
IntPtr handle,
IntPtr buffer,
uint sizebytes,
ref uint bytesread,
IntPtr userdata
);
function FMOD_FILE_READ_CALLBACK(
handle,
buffer,
sizebytes,
bytesread,
userdata
)
Number of bytes to read into buffer
.
Number of bytes read into buffer
.
If the callback is from System::attachFileSystem, then the return value is ignored.
If there is not enough data to read the requested number of bytes, return fewer bytes in the bytesread
parameter and and return FMOD_ERR_FILE_EOF.
See Also: System::setFileSystem, FMOD_FILE_OPEN_CALLBACK, FMOD_FILE_CLOSE_CALLBACK, FMOD_FILE_SEEK_CALLBACK, FMOD_FILE_ASYNCREAD_CALLBACK, FMOD_FILE_ASYNCCANCEL_CALLBACK
Callback for seeking within a file.
FMOD_RESULT F_CALL FMOD_FILE_SEEK_CALLBACK(
void *handle,
unsigned int pos,
void *userdata
);
delegate RESULT FILE_SEEKCALLBACK(
IntPtr handle,
uint pos,
IntPtr userdata
);
function FMOD_FILE_SEEK_CALLBACK(
handle,
pos,
userdata
)
Absolute position to seek to in file.
If the callback is from System::attachFileSystem, then the return value is ignored.
See Also: System::setFileSystem, FMOD_FILE_OPEN_CALLBACK, FMOD_FILE_CLOSE_CALLBACK, FMOD_FILE_READ_CALLBACK, FMOD_FILE_ASYNCREAD_CALLBACK, FMOD_FILE_ASYNCCANCEL_CALLBACK
Configuration flags used when initializing the System object.
#define FMOD_INIT_NORMAL 0x00000000
#define FMOD_INIT_STREAM_FROM_UPDATE 0x00000001
#define FMOD_INIT_MIX_FROM_UPDATE 0x00000002
#define FMOD_INIT_3D_RIGHTHANDED 0x00000004
#define FMOD_INIT_CLIP_OUTPUT 0x00000008
#define FMOD_INIT_CHANNEL_LOWPASS 0x00000100
#define FMOD_INIT_CHANNEL_DISTANCEFILTER 0x00000200
#define FMOD_INIT_PROFILE_ENABLE 0x00010000
#define FMOD_INIT_VOL0_BECOMES_VIRTUAL 0x00020000
#define FMOD_INIT_GEOMETRY_USECLOSEST 0x00040000
#define FMOD_INIT_PREFER_DOLBY_DOWNMIX 0x00080000
#define FMOD_INIT_THREAD_UNSAFE 0x00100000
#define FMOD_INIT_PROFILE_METER_ALL 0x00200000
#define FMOD_INIT_MEMORY_TRACKING 0x00400000
[Flags]
enum INITFLAGS : uint
{
NORMAL = 0x00000000,
STREAM_FROM_UPDATE = 0x00000001,
MIX_FROM_UPDATE = 0x00000002,
_3D_RIGHTHANDED = 0x00000004,
CLIP_OUTPUT = 0x00000008,
CHANNEL_LOWPASS = 0x00000100,
CHANNEL_DISTANCEFILTER = 0x00000200,
PROFILE_ENABLE = 0x00010000,
VOL0_BECOMES_VIRTUAL = 0x00020000,
GEOMETRY_USECLOSEST = 0x00040000,
PREFER_DOLBY_DOWNMIX = 0x00080000,
THREAD_UNSAFE = 0x00100000,
PROFILE_METER_ALL = 0x00200000,
MEMORY_TRACKING = 0x00400000,
}
INIT_NORMAL = 0x00000000
INIT_STREAM_FROM_UPDATE = 0x00000001
INIT_MIX_FROM_UPDATE = 0x00000002
INIT_3D_RIGHTHANDED = 0x00000004
INIT_CLIP_OUTPUT = 0x00000008
INIT_CHANNEL_LOWPASS = 0x00000100
INIT_CHANNEL_DISTANCEFILTER = 0x00000200
INIT_PROFILE_ENABLE = 0x00010000
INIT_VOL0_BECOMES_VIRTUAL = 0x00020000
INIT_GEOMETRY_USECLOSEST = 0x00040000
INIT_PREFER_DOLBY_DOWNMIX = 0x00080000
INIT_THREAD_UNSAFE = 0x00100000
INIT_PROFILE_METER_ALL = 0x00200000
INIT_MEMORY_TRACKING = 0x00400000
See Also: System::init
Built-in output types that can be used to run the mixer.
typedef enum FMOD_OUTPUTTYPE {
FMOD_OUTPUTTYPE_AUTODETECT,
FMOD_OUTPUTTYPE_UNKNOWN,
FMOD_OUTPUTTYPE_NOSOUND,
FMOD_OUTPUTTYPE_WAVWRITER,
FMOD_OUTPUTTYPE_NOSOUND_NRT,
FMOD_OUTPUTTYPE_WAVWRITER_NRT,
FMOD_OUTPUTTYPE_WASAPI,
FMOD_OUTPUTTYPE_ASIO,
FMOD_OUTPUTTYPE_PULSEAUDIO,
FMOD_OUTPUTTYPE_ALSA,
FMOD_OUTPUTTYPE_COREAUDIO,
FMOD_OUTPUTTYPE_AUDIOTRACK,
FMOD_OUTPUTTYPE_OPENSL,
FMOD_OUTPUTTYPE_AUDIOOUT,
FMOD_OUTPUTTYPE_AUDIO3D,
FMOD_OUTPUTTYPE_WEBAUDIO,
FMOD_OUTPUTTYPE_NNAUDIO,
FMOD_OUTPUTTYPE_WINSONIC,
FMOD_OUTPUTTYPE_AAUDIO,
FMOD_OUTPUTTYPE_AUDIOWORKLET,
FMOD_OUTPUTTYPE_PHASE,
FMOD_OUTPUTTYPE_OHAUDIO,
FMOD_OUTPUTTYPE_MAX
} FMOD_OUTPUTTYPE;
enum OUTPUTTYPE : int
{
AUTODETECT,
UNKNOWN,
NOSOUND,
WAVWRITER,
NOSOUND_NRT,
WAVWRITER_NRT,
WASAPI,
ASIO,
PULSEAUDIO,
ALSA,
COREAUDIO,
AUDIOTRACK,
OPENSL,
AUDIOOUT,
AUDIO3D,
WEBAUDIO,
NNAUDIO,
WINSONIC,
AAUDIO,
AUDIOWORKLET,
PHASE,
OHAUDIO,
MAX,
}
OUTPUTTYPE_AUTODETECT
OUTPUTTYPE_UNKNOWN
OUTPUTTYPE_NOSOUND
OUTPUTTYPE_WAVWRITER
OUTPUTTYPE_NOSOUND_NRT
OUTPUTTYPE_WAVWRITER_NRT
OUTPUTTYPE_WASAPI
OUTPUTTYPE_ASIO
OUTPUTTYPE_PULSEAUDIO
OUTPUTTYPE_ALSA
OUTPUTTYPE_COREAUDIO
OUTPUTTYPE_AUDIOTRACK
OUTPUTTYPE_OPENSL
OUTPUTTYPE_AUDIOOUT
OUTPUTTYPE_AUDIO3D
OUTPUTTYPE_WEBAUDIO
OUTPUTTYPE_NNAUDIO
OUTPUTTYPE_WINSONIC
OUTPUTTYPE_AAUDIO
OUTPUTTYPE_AUDIOWORKLET
OUTPUTTYPE_PHASE
OUTPUTTYPE_OHAUDIO
OUTPUTTYPE_MAX
To pass information to the driver when initializing use the extradriverdata
parameter in System::init for the following reasons:
Currently these are the only FMOD drivers that take extra information. Other unknown plug-ins may have different requirements.
If FMOD_OUTPUTTYPE_WAVWRITER_NRT or FMOD_OUTPUTTYPE_NOSOUND_NRT are used, and if the System::update function is being called very quickly (ie for a non realtime decode) it may be being called too quickly for the FMOD streamer thread to respond to. The result will be a skipping/stuttering output in the captured audio. To remedy this, disable the FMOD streamer thread, and use FMOD_INIT_STREAM_FROM_UPDATE to avoid skipping in the output stream, as it will lock the mixer and the streamer together in the same thread.
See Also: System::setOutput, System::getOutput
Used to support lists of plug-ins within the one dynamic library.
typedef struct FMOD_PLUGINLIST {
FMOD_PLUGINTYPE type;
void *description;
} FMOD_PLUGINLIST;
Not supported for C#.
Not supported for JavaScript.
This structure is returned from a plugin as a pointer to a list where the last entry has FMOD_PLUGINTYPE_MAX and a NULL description.
See Also: System::getNumNestedPlugins, System::getNestedPlugin
Types of plug-in used to extend functionality.
typedef enum FMOD_PLUGINTYPE {
FMOD_PLUGINTYPE_OUTPUT,
FMOD_PLUGINTYPE_CODEC,
FMOD_PLUGINTYPE_DSP,
FMOD_PLUGINTYPE_MAX
} FMOD_PLUGINTYPE;
enum PLUGINTYPE : int
{
OUTPUT,
CODEC,
DSP,
MAX
}
PLUGINTYPE_OUTPUT
PLUGINTYPE_CODEC
PLUGINTYPE_DSP
PLUGINTYPE_MAX
See Also: System::getNumPlugins, System::getPluginInfo, System::unloadPlugin
Output type specific index for when there are multiple instances or destinations for a port type.
#define FMOD_PORT_INDEX_NONE 0xFFFFFFFFFFFFFFFF
struct PORT_INDEX
{
const ulong NONE = 0xFFFFFFFFFFFFFFFF;
}
PORT_INDEX_NONE = 0xFFFFFFFFFFFFFFFF
See Also: System::attachChannelGroupToPort, FMOD_PORT_TYPE
Port types available for routing audio.
typedef enum FMOD_PORT_TYPE
{
FMOD_PORT_TYPE_MUSIC,
FMOD_PORT_TYPE_COPYRIGHT_MUSIC,
FMOD_PORT_TYPE_VOICE,
FMOD_PORT_TYPE_CONTROLLER,
FMOD_PORT_TYPE_PERSONAL,
FMOD_PORT_TYPE_VIBRATION,
FMOD_PORT_TYPE_AUX,
FMOD_PORT_TYPE_PASSTHROUGH,
FMOD_PORT_TYPE_VR_VIBRATION,
FMOD_PORT_TYPE_MAX
} FMOD_PORT_TYPE;
enum PORT_TYPE : int
{
MUSIC,
COPYRIGHT_MUSIC,
VOICE,
CONTROLLER,
PERSONAL,
VIBRATION,
AUX,
PASSTHROUGH,
VR_VIBRATION,
MAX
}
PORT_TYPE_MUSIC
PORT_TYPE_COPYRIGHT_MUSIC
PORT_TYPE_VOICE
PORT_TYPE_CONTROLLER
PORT_TYPE_PERSONAL
PORT_TYPE_VIBRATION
PORT_TYPE_AUX
PORT_TYPE_PASSTHROUGH
PORT_TYPE_VR_VIBRATION
PORT_TYPE_MAX
Not all platforms support all port types. See platform specific guides for a list of supported port types on each platform.
See Also: System::attachChannelGroupToPort
The maximum number of global reverb instances.
#define FMOD_REVERB_MAXINSTANCES 4
class CONSTANTS
{
const int REVERB_MAXINSTANCES = 4;
}
REVERB_MAXINSTANCES = 4
Each instance of a reverb is an instance of an FMOD_DSP_SFXREVERB DSP in the DSP graph. This is unrelated to the number of possible Reverb3D objects, which is unlimited.
See Also: ChannelControl::setReverbProperties, ChannelControl::setReverbProperties, System::setReverbProperties, System::getReverbProperties
Predefined reverb configurations. To simplify usage, and avoid manually selecting reverb parameters, a table of common presets is supplied for ease of use.
#define FMOD_PRESET_OFF { 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f }
#define FMOD_PRESET_GENERIC { 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f }
#define FMOD_PRESET_PADDEDCELL { 170, 1, 2, 5000, 10, 100, 100, 250, 0, 160, 84, -7.8f }
#define FMOD_PRESET_ROOM { 400, 2, 3, 5000, 83, 100, 100, 250, 0, 6050, 88, -9.4f }
#define FMOD_PRESET_BATHROOM { 1500, 7, 11, 5000, 54, 100, 60, 250, 0, 2900, 83, 0.5f }
#define FMOD_PRESET_LIVINGROOM { 500, 3, 4, 5000, 10, 100, 100, 250, 0, 160, 58, -19.0f }
#define FMOD_PRESET_STONEROOM { 2300, 12, 17, 5000, 64, 100, 100, 250, 0, 7800, 71, -8.5f }
#define FMOD_PRESET_AUDITORIUM { 4300, 20, 30, 5000, 59, 100, 100, 250, 0, 5850, 64, -11.7f }
#define FMOD_PRESET_CONCERTHALL { 3900, 20, 29, 5000, 70, 100, 100, 250, 0, 5650, 80, -9.8f }
#define FMOD_PRESET_CAVE { 2900, 15, 22, 5000, 100, 100, 100, 250, 0, 20000, 59, -11.3f }
#define FMOD_PRESET_ARENA { 7200, 20, 30, 5000, 33, 100, 100, 250, 0, 4500, 80, -9.6f }
#define FMOD_PRESET_HANGAR { 10000, 20, 30, 5000, 23, 100, 100, 250, 0, 3400, 72, -7.4f }
#define FMOD_PRESET_CARPETTEDHALLWAY { 300, 2, 30, 5000, 10, 100, 100, 250, 0, 500, 56, -24.0f }
#define FMOD_PRESET_HALLWAY { 1500, 7, 11, 5000, 59, 100, 100, 250, 0, 7800, 87, -5.5f }
#define FMOD_PRESET_STONECORRIDOR { 270, 13, 20, 5000, 79, 100, 100, 250, 0, 9000, 86, -6.0f }
#define FMOD_PRESET_ALLEY { 1500, 7, 11, 5000, 86, 100, 100, 250, 0, 8300, 80, -9.8f }
#define FMOD_PRESET_FOREST { 1500, 162, 88, 5000, 54, 79, 100, 250, 0, 760, 94, -12.3f }
#define FMOD_PRESET_CITY { 1500, 7, 11, 5000, 67, 50, 100, 250, 0, 4050, 66, -26.0f }
#define FMOD_PRESET_MOUNTAINS { 1500, 300, 100, 5000, 21, 27, 100, 250, 0, 1220, 82, -24.0f }
#define FMOD_PRESET_QUARRY { 1500, 61, 25, 5000, 83, 100, 100, 250, 0, 3400, 100, -5.0f }
#define FMOD_PRESET_PLAIN { 1500, 179, 100, 5000, 50, 21, 100, 250, 0, 1670, 65, -28.0f }
#define FMOD_PRESET_PARKINGLOT { 1700, 8, 12, 5000, 100, 100, 100, 250, 0, 20000, 56, -19.5f }
#define FMOD_PRESET_SEWERPIPE { 2800, 14, 21, 5000, 14, 80, 60, 250, 0, 3400, 66, 1.2f }
#define FMOD_PRESET_UNDERWATER { 1500, 7, 11, 5000, 10, 100, 100, 250, 0, 500, 92, 7.0f }
class PRESET
{
REVERB_PROPERTIES OFF
REVERB_PROPERTIES GENERIC
REVERB_PROPERTIES PADDEDCELL
REVERB_PROPERTIES ROOM
REVERB_PROPERTIES BATHROOM
REVERB_PROPERTIES LIVINGROOM
REVERB_PROPERTIES STONEROOM
REVERB_PROPERTIES AUDITORIUM
REVERB_PROPERTIES CONCERTHALL
REVERB_PROPERTIES CAVE
REVERB_PROPERTIES ARENA
REVERB_PROPERTIES HANGAR
REVERB_PROPERTIES CARPETTEDHALLWAY
REVERB_PROPERTIES HALLWAY
REVERB_PROPERTIES STONECORRIDOR
REVERB_PROPERTIES ALLEY
REVERB_PROPERTIES FOREST
REVERB_PROPERTIES CITY
REVERB_PROPERTIES MOUNTAINS
REVERB_PROPERTIES QUARRY
REVERB_PROPERTIES PLAIN
REVERB_PROPERTIES PARKINGLOT
REVERB_PROPERTIES SEWERPIPE
REVERB_PROPERTIES UNDERWATER
}
Not supported for JavaScript.
Sets of predefined reverb properties used to initialize an FMOD_REVERB_PROPERTIES structure statically.
For example:
FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_GENERIC;
See Also: System::setReverbProperties, System::getReverbProperties
Structure defining a reverb environment.
typedef struct FMOD_REVERB_PROPERTIES {
float DecayTime;
float EarlyDelay;
float LateDelay;
float HFReference;
float HFDecayRatio;
float Diffusion;
float Density;
float LowShelfFrequency;
float LowShelfGain;
float HighCut;
float EarlyLateMix;
float WetLevel;
} FMOD_REVERB_PROPERTIES;
struct REVERB_PROPERTIES
{
float DecayTime;
float EarlyDelay;
float LateDelay;
float HFReference;
float HFDecayRatio;
float Diffusion;
float Density;
float LowShelfFrequency;
float LowShelfGain;
float HighCut;
float EarlyLateMix;
float WetLevel;
}
REVERB_PROPERTIES
{
DecayTime,
EarlyDelay,
LateDelay,
HFReference,
HFDecayRatio,
Diffusion,
Density,
LowShelfFrequency,
LowShelfGain,
HighCut,
EarlyLateMix,
WetLevel,
};
Reverberation decay time.
Initial reflection delay time.
Late reverberation delay time relative to initial reflection.
Reference high frequency.
High-frequency to mid-frequency decay time ratio.
Value that controls the echo density in the late reverberation decay.
Value that controls the modal density in the late reverberation decay.
Reference low frequency
Relative room effect level at low frequencies.
Relative room effect level at high frequencies.
Early reflections level relative to room effect.
Room effect level at mid frequencies.
Note the default reverb properties are the same as the FMOD_PRESET_GENERIC preset.
See Also: System::setReverbProperties, System::getReverbProperties, FMOD_REVERB_PRESETS
Connect the output of the specified ChannelGroup to an audio port on the output driver.
FMOD_RESULT System::attachChannelGroupToPort(
FMOD_PORT_TYPE portType,
FMOD_PORT_INDEX portIndex,
ChannelGroup *channelgroup,
bool passThru = false
);
FMOD_RESULT FMOD_System_AttachChannelGroupToPort(
FMOD_SYSTEM *system,
FMOD_PORT_TYPE portType,
FMOD_PORT_INDEX portIndex,
FMOD_CHANNELGROUP *channelgroup,
FMOD_BOOL passThru
);
RESULT System.attachChannelGroupToPort(
uint portType,
ulong portIndex,
ChannelGroup channelgroup,
bool passThru = false
);
System.attachChannelGroupToPort(
portType,
portIndex,
channelgroup,
passThru
);
portType
to use (output mode specific) (FMOD_PORT_INDEX)Whether the signal should additionally route to the existing ChannelGroup output.
Ports are additional outputs supported by some FMOD_OUTPUTTYPE plug-ins and can include things like controller headsets or dedicated background music streams. See the Port Support section (where applicable) of each platform's getting started guide found in the platform details chapter.
See Also: System::detachChannelGroupFromPort
'Piggyback' on FMOD file reading routines to capture data as it's read.
This allows users to capture data as FMOD reads it, which may be useful for extracting the raw data that FMOD reads for hard to support sources (for example internet streams).
FMOD_RESULT System::attachFileSystem(
FMOD_FILE_OPEN_CALLBACK useropen,
FMOD_FILE_CLOSE_CALLBACK userclose,
FMOD_FILE_READ_CALLBACK userread,
FMOD_FILE_SEEK_CALLBACK userseek
);
FMOD_RESULT FMOD_System_AttachFileSystem(
FMOD_SYSTEM *system,
FMOD_FILE_OPEN_CALLBACK useropen,
FMOD_FILE_CLOSE_CALLBACK userclose,
FMOD_FILE_READ_CALLBACK userread,
FMOD_FILE_SEEK_CALLBACK userseek
);
RESULT System.attachFileSystem(
FILE_OPENCALLBACK useropen,
FILE_CLOSECALLBACK userclose,
FILE_READCALLBACK userread,
FILE_SEEKCALLBACK userseek
);
System.attachFileSystem(
useropen,
userclose,
userread,
userseek
);
To detach, pass null or equivalent as the callback parameters.
Note: This function is not to replace FMOD's file system. For this functionality, see System::setFileSystem.
See Also: Callback Behavior
Callback for System notifications.
FMOD_RESULT F_CALL FMOD_SYSTEM_CALLBACK(
FMOD_SYSTEM *system,
FMOD_SYSTEM_CALLBACK_TYPE type,
void *commanddata1,
void *commanddata2,
void *userdata
);
delegate RESULT SYSTEM_CALLBACK(
IntPtr system,
SYSTEM_CALLBACK_TYPE type,
IntPtr commanddata1,
IntPtr commanddata2,
IntPtr userdata
);
function FMOD_SYSTEM_CALLBACK(
system,
type,
commanddata1,
commanddata2,
userdata
)
system
or the last value set with any call to System::setUserData for global callbacks.The 'system' argument can be cast to FMOD::System *
.
The 'system' argument can be used via System
by using FMOD.System coreSystem = new FMOD.System(system);
See Also: Callback Behavior, User Data, System::setCallback
Types of callbacks called by the System.
#define FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED 0x00000001
#define FMOD_SYSTEM_CALLBACK_DEVICELOST 0x00000002
#define FMOD_SYSTEM_CALLBACK_MEMORYALLOCATIONFAILED 0x00000004
#define FMOD_SYSTEM_CALLBACK_THREADCREATED 0x00000008
#define FMOD_SYSTEM_CALLBACK_BADDSPCONNECTION 0x00000010
#define FMOD_SYSTEM_CALLBACK_PREMIX 0x00000020
#define FMOD_SYSTEM_CALLBACK_POSTMIX 0x00000040
#define FMOD_SYSTEM_CALLBACK_ERROR 0x00000080
#define FMOD_SYSTEM_CALLBACK_THREADDESTROYED 0x00000100
#define FMOD_SYSTEM_CALLBACK_PREUPDATE 0x00000200
#define FMOD_SYSTEM_CALLBACK_POSTUPDATE 0x00000400
#define FMOD_SYSTEM_CALLBACK_RECORDLISTCHANGED 0x00000800
#define FMOD_SYSTEM_CALLBACK_BUFFEREDNOMIX 0x00001000
#define FMOD_SYSTEM_CALLBACK_DEVICEREINITIALIZE 0x00002000
#define FMOD_SYSTEM_CALLBACK_OUTPUTUNDERRUN 0x00004000
#define FMOD_SYSTEM_CALLBACK_RECORDPOSITIONCHANGED 0x00008000
#define FMOD_SYSTEM_CALLBACK_ALL 0xFFFFFFFF
[Flags]
enum SYSTEM_CALLBACK_TYPE : uint
{
DEVICELISTCHANGED = 0x00000001,
DEVICELOST = 0x00000002,
MEMORYALLOCATIONFAILED = 0x00000004,
THREADCREATED = 0x00000008,
BADDSPCONNECTION = 0x00000010,
PREMIX = 0x00000020,
POSTMIX = 0x00000040,
ERROR = 0x00000080,
THREADDESTROYED = 0x00000100,
PREUPDATE = 0x00000200,
POSTUPDATE = 0x00000400,
RECORDLISTCHANGED = 0x00000800,
BUFFEREDNOMIX = 0x00001000,
DEVICEREINITIALIZE = 0x00002000,
OUTPUTUNDERRUN = 0x00004000,
RECORDPOSITIONCHANGED = 0x00008000,
ALL = 0xFFFFFFFF,
}
SYSTEM_CALLBACK_DEVICELISTCHANGED = 0x00000001
SYSTEM_CALLBACK_DEVICELOST = 0x00000002
SYSTEM_CALLBACK_MEMORYALLOCATIONFAILED = 0x00000004
SYSTEM_CALLBACK_THREADCREATED = 0x00000008
SYSTEM_CALLBACK_BADDSPCONNECTION = 0x00000010
SYSTEM_CALLBACK_PREMIX = 0x00000020
SYSTEM_CALLBACK_POSTMIX = 0x00000040
SYSTEM_CALLBACK_ERROR = 0x00000080
SYSTEM_CALLBACK_THREADDESTROYED = 0x00000100
SYSTEM_CALLBACK_PREUPDATE = 0x00000200
SYSTEM_CALLBACK_POSTUPDATE = 0x00000400
SYSTEM_CALLBACK_RECORDLISTCHANGED = 0x00000800
SYSTEM_CALLBACK_BUFFEREDNOMIX = 0x00001000
SYSTEM_CALLBACK_DEVICEREINITIALIZE = 0x00002000
SYSTEM_CALLBACK_OUTPUTUNDERRUN = 0x00004000
SYSTEM_CALLBACK_RECORDPOSITIONCHANGED = 0x00008000
SYSTEM_CALLBACK_ALL = 0xFFFFFFFF
For each callback type unless specified below it is assumed commanddata1
and commanddata2
are unused and userdata
matches the value set with System::setUserData.
FMOD_SYSTEM_CALLBACK_MEMORYALLOCATIONFAILED
commanddata1
: (const char *) representing the file and line of the failure.
commanddata2
: (int) representing the size of the requested allocation
FMOD_SYSTEM_CALLBACK_ERROR
commanddata1
: (FMOD_ERRORCALLBACK_INFO *) with extra information about the error.
commanddata2
: Unused.
FMOD_SYSTEM_CALLBACK_THREADCREATED / FMOD_SYSTEM_CALLBACK_THREADDESTROYED
commanddata1
: Handle of the thread, see notes below for thread handle types.
commanddata2
: (const char *) representing the name of the thread.
FMOD_SYSTEM_CALLBACK_DEVICEREINITIALIZE
commanddata1
: (FMOD_OUTPUTTYPE) of the output device.
commanddata2
: (int) selected driver index.
FMOD_SYSTEM_CALLBACK_RECORDPOSITIONCHANGED
commanddata1
: (Sound) that is being recorded to.
commanddata2
: (int) The new record position.
Thread handle types per platform:
Using FMOD_SYSTEM_CALLBACK_ALL or FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED will disable any automated device ejection/insertion handling. Use this callback to control the behavior yourself.
Using FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED (Mac only) requires the application to be running an event loop which will allow external changes to device list to be detected.
See Also: Callback Behavior, System::setCallback, FMOD_SYSTEM_CALLBACK
Close the connection to the output and return to an uninitialized state without releasing the object.
FMOD_RESULT System::close();
FMOD_RESULT FMOD_System_Close(FMOD_SYSTEM *system);
RESULT System.close();
System.close();
Closing renders objects created with this System invalid. Make sure any Sound, ChannelGroup, Geometry and DSP objects are released before calling this.
All pre-initialize configuration settings will remain and the System can be reinitialized as needed.
See Also: System::init, System::release
Creates an instance of the FMOD system.
FMOD_RESULT System_Create(
System **system,
unsigned int headerversion = FMOD_VERSION
);
FMOD_RESULT FMOD_System_Create(
FMOD_SYSTEM **system,
unsigned int headerversion
);
static RESULT Factory.System_Create(
out System system
);
System_Create(
system
);
Pass FMOD_VERSION in headerversion
to ensure the library and header versions being used match.
This must be called first to create an FMOD System object before any other API calls (except for Memory_Initialize and Debug_Initialize). Use this function to create 1 or multiple instances of FMOD System objects.
Use System::release to free a system object.
Calls to System_Create and System::release are not thread-safe. Do not call these functions simultaneously from multiple threads at once.
See Also: System::init
Create a ChannelGroup object.
FMOD_RESULT System::createChannelGroup(
const char *name,
ChannelGroup **channelgroup
);
FMOD_RESULT FMOD_System_CreateChannelGroup(
FMOD_SYSTEM *system,
const char *name,
FMOD_CHANNELGROUP **channelgroup
);
RESULT System.createChannelGroup(
string name,
out ChannelGroup channelgroup
);
System.createChannelGroup(
name,
channelgroup
);
ChannelGroups can be used to assign / group Channels, for things such as volume scaling. ChannelGroups are also used for sub-mixing. Any Channels that are assigned to a ChannelGroup get submixed into that ChannelGroup's 'tail' DSP. See FMOD_CHANNELCONTROL_DSP_TAIL.
If a ChannelGroup has an effect added to it, the effect is processed post-mix from the Channels and ChannelGroups below it in the mix hierarchy. See the DSP architecture guide for more information.
All ChannelGroups will initially output directly to the master ChannelGroup (See System::getMasterChannelGroup). ChannelGroups can be re-parented this with ChannelGroup::addGroup.
See Also: ChannelGroup::release
Create a DSP unit given a plug-in description structure.
FMOD_RESULT System::createDSP(
const FMOD_DSP_DESCRIPTION *description,
DSP **dsp
);
FMOD_RESULT FMOD_System_CreateDSP(
FMOD_SYSTEM *system,
const FMOD_DSP_DESCRIPTION *description,
FMOD_DSP **dsp
);
RESULT System.createDSP(
ref DSP_DESCRIPTION description,
out DSP dsp
);
System.createDSP(
description,
dsp
);
A DSP unit is a module that can be inserted into the DSP graph to allow sound filtering or sound generation. See the DSP architecture guide for more information.
DSPs must be attached to the DSP graph before they become active, either via ChannelControl::addDSP or DSP::addInput.
See Also: System::createDSPByType, System::createDSPByPlugin
Create a DSP unit with a specified plug-in handle.
FMOD_RESULT System::createDSPByPlugin(
unsigned int handle,
DSP **dsp
);
FMOD_RESULT FMOD_System_CreateDSPByPlugin(
FMOD_SYSTEM *system,
unsigned int handle,
FMOD_DSP **dsp
);
RESULT System.createDSPByPlugin(
uint handle,
out DSP dsp
);
System.createDSPByPlugin(
handle,
dsp
);
A DSP object is a module that can be inserted into the DSP graph to allow sound filtering or sound generation. See the DSP architecture guide for more information.
A handle can come from a newly loaded plug-in with System::loadPlugin or an existing plug-in with System::getPluginHandle.
DSPs must be attached to the DSP graph before they become active, either via ChannelControl::addDSP or DSP::addInput.
See Also: System::createDSP, System::createDSPByType
Create a DSP unit with a specified built-in type index.
FMOD_RESULT System::createDSPByType(
FMOD_DSP_TYPE type,
DSP **dsp
);
FMOD_RESULT FMOD_System_CreateDSPByType(
FMOD_SYSTEM *system,
FMOD_DSP_TYPE type,
FMOD_DSP **dsp
);
RESULT System.createDSPByType(
DSP_TYPE type,
out DSP dsp
);
System.createDSPByType(
type,
dsp
);
A DSP unit (or "DSP") is a module that can be inserted into the DSP graph to allow sound filtering or sound generation. See the DSP architecture guide for more information.
DSPs must be attached to the DSP graph before they become active, either via ChannelControl::addDSP or DSP::addInput.
See Also: System::createDSP
Geometry creation function. This function will create a base geometry object which can then have polygons added to it.
FMOD_RESULT System::createGeometry(
int maxpolygons,
int maxvertices,
Geometry **geometry
);
FMOD_RESULT FMOD_System_CreateGeometry(
FMOD_SYSTEM *system,
int maxpolygons,
int maxvertices,
FMOD_GEOMETRY **geometry
);
RESULT System.createGeometry(
int maxpolygons,
int maxvertices,
out Geometry geometry
);
System.createGeometry(
maxpolygons,
maxvertices,
geometry
);
Polygons can be added to a geometry object using Geometry::addPolygon. For best efficiency, avoid overlapping of polygons and long thin polygons.
A geometry object stores its polygons in a group to allow optimization for line testing, insertion and updating of geometry in real-time.
Geometry objects also allow for efficient rotation, scaling and translation of groups of polygons.
It is important to set the value of maxworldsize to an appropriate value using System::setGeometrySettings.
See Also: System::setGeometrySettings, System::loadGeometry, Geometry::addPolygon, Geometry::setPosition, Geometry::setRotation, Geometry::setScale
Creates a 'virtual reverb' object. This object reacts to 3D location and morphs the reverb environment based on how close it is to the reverb object's center.
Multiple reverb objects can be created to achieve a multi-reverb environment. 1 reverb object is used for all 3D reverb objects (slot 0 by default).
FMOD_RESULT System::createReverb3D(
Reverb3D **reverb
);
FMOD_RESULT FMOD_System_CreateReverb3D(
FMOD_SYSTEM *system,
FMOD_REVERB3D **reverb
);
RESULT System.createReverb3D(
out Reverb3D reverb
);
System.createReverb3D(
reverb
);
The 3D reverb object is a sphere having 3D attributes (position, minimum distance, maximum distance) and reverb properties.
The properties and 3D attributes of all reverb objects collectively determine, along with the listener's position, the settings of and input gains into a single 3D reverb DSP.
When the listener is within the sphere of effect of one or more 3D reverbs, the listener's 3D reverb properties are a weighted combination of such 3D reverbs.
When the listener is outside all of the reverbs, no reverb is applied.
System::setReverbProperties can be used to create an alternative reverb that can be used for 2D and background global reverb.
To avoid this reverb interfering with the reverb slot used by the 3D reverb, 2D reverb should use a different slot id with System::setReverbProperties, otherwise FMOD_ADVANCEDSETTINGS::reverb3Dinstance can also be used to place 3D reverb on a different reverb slot.
Use ChannelControl::setReverbProperties to turn off reverb for 2D sounds (ie set wet = 0).
Creating multiple reverb objects does not impact performance. This is because these reverb objects are 'virtual reverbs': There is only one reverb DSP unit running at a time, and its parameter values are morphed to those of each virtual reverb as needed.
To remove the reverb DSP unit and the associated CPU cost, first make sure all 3D reverb objects are released. Then, call System::setReverbProperties with the 3D reverb's slot ID (0 by default) with a property point of 0 or NULL, to signal that the reverb instance should be deleted.
If a 3D reverb is still present, and System::setReverbProperties function is called to free the reverb, the 3D reverb system recreates it upon the next System::update call.
The 3D reverb system does not affect Studio events unless it is explicitly enabled by calling Studio::EventInstance::setReverbLevel on each event instance.
See Also: Reverb3D::release
Loads a sound into memory, opens it for streaming or sets it up for callback based sounds.
FMOD_RESULT System::createSound(
const char *name_or_data,
FMOD_MODE mode,
FMOD_CREATESOUNDEXINFO *exinfo,
Sound **sound
);
FMOD_RESULT FMOD_System_CreateSound(
FMOD_SYSTEM *system,
const char *name_or_data,
FMOD_MODE mode,
FMOD_CREATESOUNDEXINFO *exinfo,
FMOD_SOUND **sound
);
RESULT System.createSound(
string name,
MODE mode,
out Sound sound
);
RESULT System.createSound(
byte[] data,
MODE mode,
out Sound sound
);
RESULT System.createSound(
string name,
MODE mode,
ref CREATESOUNDEXINFO exinfo,
out Sound sound
);
RESULT System.createSound(
IntPtr name_or_data,
MODE mode,
ref CREATESOUNDEXINFO exinfo,
out Sound sound
);
System.createSound(
name_or_data,
mode,
exinfo,
sound
);
Behavior modifier for opening the sound. (FMOD_MODE)
FMOD_CREATESAMPLE will try to load and decompress the whole sound into memory, use FMOD_CREATESTREAM to open it as a stream and have it play back in realtime from disk or another medium. FMOD_CREATECOMPRESSEDSAMPLE can also be used for certain formats to play the sound directly in its compressed format from the mixer.
Note that FMOD_OPENRAW, FMOD_OPENMEMORY, FMOD_OPENMEMORY_POINT and FMOD_OPENUSER will not work here without the exinfo structure present, as more information is needed.
Use FMOD_NONBLOCKING to have the sound open or load in the background. You can use Sound::getOpenState to determine if it has finished loading / opening or not. While it is loading (not ready), sound functions are not accessible for that sound. Do not free memory provided with FMOD_OPENMEMORY if the sound is not in a ready state, as it will most likely lead to a crash.
To account for slow media that might cause buffer underrun (skipping / stuttering / repeating blocks of audio) with sounds created with FMOD_CREATESTREAM, use System::setStreamBufferSize to increase read ahead.
As using FMOD_OPENUSER causes FMOD to ignore whatever is passed as the first argument name_or_data
, recommended practice is to pass null or equivalent.
Specifying FMOD_OPENMEMORY_POINT will POINT to your memory rather allocating its own sound buffers and duplicating it internally, this means you cannot free the memory while FMOD is using it, until after Sound::release is called.
With FMOD_OPENMEMORY_POINT, only PCM formats and compressed formats using FMOD_CREATECOMPRESSEDSAMPLE are supported.
Use of FMOD.NON_BLOCKING is currently not supported for JavaScript.
Creates a SoundGroup object.
FMOD_RESULT System::createSoundGroup(
const char *name,
SoundGroup **soundgroup
);
FMOD_RESULT FMOD_System_CreateSoundGroup(
FMOD_SYSTEM *system,
const char *name,
FMOD_SOUNDGROUP **soundgroup
);
RESULT System.createSoundGroup(
string name,
out SoundGroup soundgroup
);
System.createSoundGroup(
name,
soundgroup
);
A SoundGroup is a way to address multiple Sounds at once with group level commands, such as:
Once a SoundGroup is created, Sound::setSoundGroup is used to put a Sound in a SoundGroup.
See Also: SoundGroup::release, Sound::setSoundGroup
Opens a sound for streaming.
FMOD_RESULT System::createStream(
const char *name_or_data,
FMOD_MODE mode,
FMOD_CREATESOUNDEXINFO *exinfo,
Sound **sound
);
FMOD_RESULT FMOD_System_CreateStream(
FMOD_SYSTEM *system,
const char *name_or_data,
FMOD_MODE mode,
FMOD_CREATESOUNDEXINFO *exinfo,
FMOD_SOUND **sound
);
RESULT System.createStream(
string name,
MODE mode,
out Sound sound
);
RESULT System.createStream(
string name,
MODE mode,
ref CREATESOUNDEXINFO exinfo,
out Sound sound
);
RESULT System.createStream(
byte[] data,
MODE mode,
ref CREATESOUNDEXINFO exinfo,
out Sound sound
);
RESULT System.createStream(
IntPtr name_or_data,
MODE mode,
ref CREATESOUNDEXINFO exinfo,
out Sound sound
);
System.createStream(
name_or_data,
mode,
exinfo,
sound
);
Behavior modifier for opening the sound. (FMOD_MODE)
This is a convenience function for System::createSound with the FMOD_CREATESTREAM flag added.
A stream only has one decode buffer and file handle, and therefore can only be played once. It cannot play multiple times at once because it cannot share a stream buffer if the stream is playing at different positions. Open multiple streams to have them play concurrently.
Disconnect the output of the specified ChannelGroup from an audio port on the output driver.
FMOD_RESULT System::detachChannelGroupFromPort(
ChannelGroup *channelgroup
);
FMOD_RESULT FMOD_System_DetachChannelGroupFromPort(
FMOD_SYSTEM *system,
FMOD_CHANNELGROUP *channelgroup
);
RESULT System.detachChannelGroupFromPort(
ChannelGroup channelgroup
);
System.detachChannelGroupFromPort(
channelgroup
);
Removing a ChannelGroup from a port will reroute the audio back to the main mix.
See Also: System::attachChannelGroupToPort
Retrieves the position, velocity and orientation of the specified 3D sound listener.
FMOD_RESULT System::get3DListenerAttributes(
int listener,
FMOD_VECTOR *pos,
FMOD_VECTOR *vel,
FMOD_VECTOR *forward,
FMOD_VECTOR *up
);
FMOD_RESULT FMOD_System_Get3DListenerAttributes(
FMOD_SYSTEM *system,
int listener,
FMOD_VECTOR *pos,
FMOD_VECTOR *vel,
FMOD_VECTOR *forward,
FMOD_VECTOR *up
);
RESULT System.get3DListenerAttributes(
int listener,
out VECTOR pos,
out VECTOR vel,
out VECTOR forward,
out VECTOR up
);
System.get3DListenerAttributes(
listener,
pos,
vel,
forward,
up
);
Index of listener to get 3D attributes for. Listeners are indexed from 0, to FMOD_MAX_LISTENERS - 1, in a multi-listener environment.
Position in 3D space used for panning and attenuation. (FMOD_VECTOR)
Velocity in 3D space used for doppler. (FMOD_VECTOR)
Users of the Studio API should call Studio::System::getListenerAttributes instead of this function.
See Also: System::set3DListenerAttributes
Retrieves the number of 3D listeners.
FMOD_RESULT System::get3DNumListeners(
int *numlisteners
);
FMOD_RESULT FMOD_System_Get3DNumListeners(
FMOD_SYSTEM *system,
int *numlisteners
);
RESULT System.get3DNumListeners(
out int numlisteners
);
System.get3DNumListeners(
numlisteners
);
Users of the Studio API should call Studio::System::getNumListeners instead of this function.
See Also: System::set3DNumListeners
Retrieves the global doppler scale, distance factor and roll-off scale for all 3D sounds.
FMOD_RESULT System::get3DSettings(
float *dopplerscale,
float *distancefactor,
float *rolloffscale
);
FMOD_RESULT FMOD_System_Get3DSettings(
FMOD_SYSTEM *system,
float *dopplerscale,
float *distancefactor,
float *rolloffscale
);
RESULT System.get3DSettings(
out float dopplerscale,
out float distancefactor,
out float rolloffscale
);
System.get3DSettings(
dopplerscale,
distancefactor,
rolloffscale
);
See Also: System::set3DSettings
Retrieves the advanced settings for the system object.
FMOD_RESULT System::getAdvancedSettings(
FMOD_ADVANCEDSETTINGS *settings
);
FMOD_RESULT FMOD_System_GetAdvancedSettings(
FMOD_SYSTEM *system,
FMOD_ADVANCEDSETTINGS *settings
);
RESULT System.getAdvancedSettings(
ref ADVANCEDSETTINGS settings
);
System.getAdvancedSettings(
settings
);
See Also: System::setAdvancedSettings
Retrieves a handle to a Channel by ID.
FMOD_RESULT System::getChannel(
int channelid,
Channel **channel
);
FMOD_RESULT FMOD_System_GetChannel(
FMOD_SYSTEM *system,
int channelid,
FMOD_CHANNEL **channel
);
RESULT System.getChannel(
int channelid,
out Channel channel
);
System.getChannel(
channelid,
channel
);
This function is mainly for getting handles to existing (playing) Channels and setting their attributes. The only way to 'create' an instance of a Channel for playback is to use System::playSound or [System::playDSP].
See Also: System::init
Retrieves the number of currently playing Channels.
FMOD_RESULT System::getChannelsPlaying(
int *channels,
int *realchannels = nullptr
);
FMOD_RESULT FMOD_System_GetChannelsPlaying(
FMOD_SYSTEM *system,
int *channels,
int *realchannels
);
RESULT System.getChannelsPlaying(
out int channels
);
RESULT System.getChannelsPlaying(
out int channels,
out int realchannels
);
System.getChannelsPlaying(
channels,
realchannels
);
For differences between real and virtual voices see the Virtual Voices guide for more information.
See Also: ChannelControl::isPlaying, Channel::isVirtual
Retrieves the amount of CPU used for different parts of the Core API.
FMOD_RESULT System::getCPUUsage(
FMOD_CPU_USAGE *usage
);
FMOD_RESULT FMOD_System_GetCPUUsage(
FMOD_SYSTEM *system,
FMOD_CPU_USAGE *usage
);
RESULT System.getCPUUsage(
out CPU_USAGE usage
);
System.getCPUUsage(
usage
);
For readability, the percentage values are smoothed to provide a more stable output.
See Also: Studio::System::getCPUUsage, FMOD_STUDIO_CPU_USAGE
Retrieves the default matrix used to convert from one speaker mode to another.
FMOD_RESULT System::getDefaultMixMatrix(
FMOD_SPEAKERMODE sourcespeakermode,
FMOD_SPEAKERMODE targetspeakermode,
float *matrix,
int matrixhop
);
FMOD_RESULT FMOD_System_GetDefaultMixMatrix(
FMOD_SYSTEM *system,
FMOD_SPEAKERMODE sourcespeakermode,
FMOD_SPEAKERMODE targetspeakermode,
float *matrix,
int matrixhop
);
RESULT System.getDefaultMixMatrix(
SPEAKERMODE sourcespeakermode,
SPEAKERMODE targetspeakermode,
float[] matrix,
int matrixhop
);
System.getDefaultMixMatrix(
sourcespeakermode,
targetspeakermode,
matrix,
matrixhop
);
sourcespeakermode
. Maximum of FMOD_MAX_CHANNEL_WIDTH.The gain for source channel 's' to target channel 't' is matrix[t * matrixhop + s].
If 'sourcespeakermode' or 'targetspeakermode' is FMOD_SPEAKERMODE_RAW, this function will return FMOD_ERR_INVALID_PARAM.
See Also: System::getSpeakerModeChannels
Retrieves the output driver for the selected output type.
FMOD_RESULT System::getDriver(
int *driver
);
FMOD_RESULT FMOD_System_GetDriver(
FMOD_SYSTEM *system,
int *driver
);
RESULT System.getDriver(
out int driver
);
System.getDriver(
driver
);
See Also: System::setDriver
Retrieves identification information about a sound device specified by its index, and specific to the selected output mode.
FMOD_RESULT System::getDriverInfo(
int id,
char *name,
int namelen,
FMOD_GUID *guid,
int *systemrate,
FMOD_SPEAKERMODE *speakermode,
int *speakermodechannels
);
FMOD_RESULT FMOD_System_GetDriverInfo(
FMOD_SYSTEM *system,
int id,
char *name,
int namelen,
FMOD_GUID *guid,
int *systemrate,
FMOD_SPEAKERMODE *speakermode,
int *speakermodechannels
);
RESULT System.getDriverInfo(
int id,
out string name,
int namelen,
out Guid guid,
out int systemrate,
out SPEAKERMODE speakermode,
out int speakermodechannels
);
System.getDriverInfo(
id,
name,
guid,
systemrate,
speakermode,
speakermodechannels
);
Index of the sound driver device.
Length of name
. 256 is sufficient to contain the vast majority of driver names.
See Also: System::setOutput
Retrieves the buffer size settings for the FMOD software mixing engine.
FMOD_RESULT System::getDSPBufferSize(
unsigned int *bufferlength,
int *numbuffers
);
FMOD_RESULT FMOD_System_GetDSPBufferSize(
FMOD_SYSTEM *system,
unsigned int *bufferlength,
int *numbuffers
);
RESULT System.getDSPBufferSize(
out uint bufferlength,
out int numbuffers
);
System.getDSPBufferSize(
bufferlength,
numbuffers
);
Mixer engine block size.
Mixer engine number of buffers used.
To get the bufferlength
in milliseconds, divide it by the output rate and multiply the result by 1000. For a bufferlength
of 1024 and an output rate of 48khz (see System::SetSoftwareFormat), milliseconds = 1024 / 48000 * 1000 = 21.33ms. This means the mixer updates every 21.33ms.
To get the total buffer size multiply the bufferlength
by the numbuffers
value. By default this would be 4 * 1024 = 4096 samples, or 4 * 21.33ms = 85.33ms. This would generally be the total latency of the software mixer, but in reality due to one of the buffers being written to constantly, and the cursor position of the buffer that is audible, the latency is typically more like the (number of buffers - 1.5) multiplied by the buffer length.
To convert from milliseconds back to 'samples', simply multiply the value in milliseconds by the sample rate of the output (ie 48000 if that is what it is set to), then divide by 1000.
See Also: System::setDSPBufferSize
Retrieve the description structure for a pre-existing DSP plug-in.
FMOD_RESULT System::getDSPInfoByPlugin(
unsigned int handle,
const FMOD_DSP_DESCRIPTION **description
);
FMOD_RESULT FMOD_System_GetDSPInfoByPlugin(
FMOD_SYSTEM *system,
unsigned int handle,
const FMOD_DSP_DESCRIPTION **description
);
RESULT System.getDSPInfoByPlugin(
uint handle,
out IntPtr description
);
System.getDSPInfoByPlugin(
handle,
description
);
See Also: System::loadPlugin
Retrieve the description structure for a built-in DSP plug-in.
FMOD_RESULT System::getDSPInfoByType(
FMOD_DSP_TYPE type,
const FMOD_DSP_DESCRIPTION **description
);
FMOD_RESULT FMOD_System_GetDSPInfoByType(
FMOD_SYSTEM *system,
FMOD_DSP_TYPE type,
const FMOD_DSP_DESCRIPTION **description
);
RESULT System.getDSPInfoByType(
DSP_TYPE type,
out IntPtr description
);
System.getDSPInfoByType(
type,
description
);
FMOD_DSP_TYPE_MIXER not supported.
See Also: System::getDSPInfoByPlugin
Retrieves information about file reads.
FMOD_RESULT System::getFileUsage(
long long *sampleBytesRead,
long long *streamBytesRead,
long long *otherBytesRead
);
FMOD_RESULT FMOD_System_GetFileUsage(
FMOD_SYSTEM *system,
long long *sampleBytesRead,
long long *streamBytesRead,
long long *otherBytesRead
);
RESULT System.getFileUsage(
out Int64 sampleBytesRead,
out Int64 streamBytesRead,
out Int64 otherBytesRead
);
System.getFileUsage(
sampleBytesRead,
streamBytesRead,
otherBytesRead
);
Total bytes read from file for loading sample data.
Total bytes read from file for streaming sounds.
Total bytes read for non-audio data such as bank files created in FMOD Studio.
The values returned are running totals that never reset.
Calculates geometry occlusion between a listener and a sound source.
FMOD_RESULT System::getGeometryOcclusion(
const FMOD_VECTOR *listener,
const FMOD_VECTOR *source,
float *direct,
float *reverb
);
FMOD_RESULT FMOD_System_GetGeometryOcclusion(
FMOD_SYSTEM *system,
const FMOD_VECTOR *listener,
const FMOD_VECTOR *source,
float *direct,
float *reverb
);
RESULT System.getGeometryOcclusion(
ref VECTOR listener,
ref VECTOR source,
out float direct,
out float reverb
);
System.getGeometryOcclusion(
listener,
source,
direct,
reverb
);
If single sided polygons have been created, it is important to get the source and listener positions around the right way,
as the occlusion from point A to point B may not be the same as the occlusion from point B to point A.
See Also: System::createGeometry
Retrieves the maximum world size for the geometry engine.
FMOD_RESULT System::getGeometrySettings(
float *maxworldsize
);
FMOD_RESULT FMOD_System_GetGeometrySettings(
FMOD_SYSTEM *system,
float *maxworldsize
);
RESULT System.getGeometrySettings(
out float maxworldsize
);
System.getGeometrySettings(
maxworldsize
);
FMOD uses an efficient spatial partitioning system to store polygons for ray casting purposes.
The maximum size of the world should be set to allow processing within a known range.
Outside of this range, objects and polygons will not be processed as efficiently.
Excessive world size settings can also cause loss of precision and efficiency.
See Also: System::setGeometrySettings
Retrieves the master ChannelGroup that all sounds ultimately route to.
FMOD_RESULT System::getMasterChannelGroup(
ChannelGroup **channelgroup
);
FMOD_RESULT FMOD_System_GetMasterChannelGroup(
FMOD_SYSTEM *system,
FMOD_CHANNELGROUP **channelgroup
);
RESULT System.getMasterChannelGroup(
out ChannelGroup channelgroup
);
System.getMasterChannelGroup(
channelgroup
);
This is the default ChannelGroup that Channels play on, unless a different ChannelGroup is specified with System::playSound, System::playDSP or Channel::setChannelGroup.
A master ChannelGroup can be used to do things like set the 'master volume' for all playing Channels. See ChannelControl::setVolume.
See Also: System::createChannelGroup
Retrieves the default SoundGroup, where all sounds are placed when they are created.
FMOD_RESULT System::getMasterSoundGroup(
SoundGroup **soundgroup
);
FMOD_RESULT FMOD_System_GetMasterSoundGroup(
FMOD_SYSTEM *system,
FMOD_SOUNDGROUP **soundgroup
);
RESULT System.getMasterSoundGroup(
out SoundGroup soundgroup
);
System.getMasterSoundGroup(
soundgroup
);
If SoundGroup is released, the Sounds will be put back into this SoundGroup.
See Also: SoundGroup::release, Sound::setSoundGroup
Retrieves the handle of a nested plug-in.
FMOD_RESULT System::getNestedPlugin(
unsigned int handle,
int index,
unsigned int *nestedhandle
);
FMOD_RESULT FMOD_System_GetNestedPlugin(
FMOD_SYSTEM *system,
unsigned int handle,
int index,
unsigned int *nestedhandle
);
RESULT System.getNestedPlugin(
uint handle,
int index,
out uint nestedhandle
);
System.getNestedPlugin(
handle,
index,
nestedhandle
);
Index into the list of plug-in definitions.
This function is used to iterate handles for plug-ins that have a list of definitions.
Most plug-ins contain a single definition. If this is the case, only index 0 is valid, and the returned handle is the same as the handle passed in.
See the DSP Plug-in API guide for more information.
Retrieves the URL of the proxy server used in internet streaming.
FMOD_RESULT System::getNetworkProxy(
char *proxy,
int proxylen
);
FMOD_RESULT FMOD_System_GetNetworkProxy(
FMOD_SYSTEM *system,
char *proxy,
int proxylen
);
RESULT System.getNetworkProxy(
out string proxy,
int proxylen
);
System.getNetworkProxy(
proxy
);
proxy
.See Also: System::setNetworkProxy
Retrieve the timeout value for network streams.
FMOD_RESULT System::getNetworkTimeout(
int *timeout
);
FMOD_RESULT FMOD_System_GetNetworkTimeout(
FMOD_SYSTEM *system,
int *timeout
);
RESULT System.getNetworkTimeout(
out int timeout
);
System.getNetworkTimeout(
timeout
);
Timeout value.
Units: Milliseconds
Retrieves the number of output drivers available for the selected output type.
FMOD_RESULT System::getNumDrivers(
int *numdrivers
);
FMOD_RESULT FMOD_System_GetNumDrivers(
FMOD_SYSTEM *system,
int *numdrivers
);
RESULT System.getNumDrivers(
out int numdrivers
);
System.getNumDrivers(
numdrivers
);
If System::setOutput has not been called, this function will return the number of drivers available for the default output type.
A possible use for this function is to iterate through available sound devices for the current output type, and use System::getDriverInfo to get the device's name and other attributes.
See Also: System::getDriver
Retrieves the number of nested plug-ins from the selected plug-in.
FMOD_RESULT System::getNumNestedPlugins(
unsigned int handle,
int *count
);
FMOD_RESULT FMOD_System_GetNumNestedPlugins(
FMOD_SYSTEM *system,
unsigned int handle,
int *count
);
RESULT System.getNumNestedPlugins(
uint handle,
out int count
);
System.getNumNestedPlugins(
handle,
count
);
Most plug-ins contain a single definition, in which case the count is 1, however some have a list of definitions. This function returns the number of plug-ins that have been defined.
See the DSP Plug-in API guide for more information.
See Also: System::getNestedPlugin
Retrieves the number of loaded plug-ins.
FMOD_RESULT System::getNumPlugins(
FMOD_PLUGINTYPE plugintype,
int *numplugins
);
FMOD_RESULT FMOD_System_GetNumPlugins(
FMOD_SYSTEM *system,
FMOD_PLUGINTYPE plugintype,
int *numplugins
);
RESULT System.getNumPlugins(
PLUGINTYPE plugintype,
out int numplugins
);
System.getNumPlugins(
plugintype,
numplugins
);
plugintype
.See Also: System::loadPlugin, System::getPluginHandle
Retrieves the type of output interface used to run the mixer.
FMOD_RESULT System::getOutput(
FMOD_OUTPUTTYPE *output
);
FMOD_RESULT FMOD_System_GetOutput(
FMOD_SYSTEM *system,
FMOD_OUTPUTTYPE *output
);
RESULT System.getOutput(
out OUTPUTTYPE output
);
System.getOutput(
output
);
See Also: System::setOutput
Retrieves the plug-in handle for the currently selected output type.
FMOD_RESULT System::getOutputByPlugin(
unsigned int *handle
);
FMOD_RESULT FMOD_System_GetOutputByPlugin(
FMOD_SYSTEM *system,
unsigned int *handle
);
RESULT System.getOutputByPlugin(
out uint handle
);
System.getOutputByPlugin(
handle
);
See Also: System::getNumPlugins, System::setOutputByPlugin, System::setOutput
Retrieves an output type specific internal native interface.
FMOD_RESULT System::getOutputHandle(
void **handle
);
FMOD_RESULT FMOD_System_GetOutputHandle(
FMOD_SYSTEM *system,
void **handle
);
RESULT System.getOutputHandle(
out IntPtr handle
);
System.getOutputHandle(
handle
);
Reinterpret the returned handle based on the selected output type, not all types return something.
See Also: FMOD_OUTPUTTYPE, System::setOutput, System::init
Retrieves the handle of a plug-in based on its type and relative index.
FMOD_RESULT System::getPluginHandle(
FMOD_PLUGINTYPE plugintype,
int index,
unsigned int *handle
);
FMOD_RESULT FMOD_System_GetPluginHandle(
FMOD_SYSTEM *system,
FMOD_PLUGINTYPE plugintype,
int index,
unsigned int *handle
);
RESULT System.getPluginHandle(
PLUGINTYPE plugintype,
int index,
out uint handle
);
System.getPluginHandle(
plugintype,
index,
handle
);
plugintype
.All plug-ins, whether built-in or loaded, can be enumerated using this and System::getNumPlugins.
See Also: System::loadPlugin
Retrieves information for the selected plug-in.
FMOD_RESULT System::getPluginInfo(
unsigned int handle,
FMOD_PLUGINTYPE *plugintype,
char *name,
int namelen,
unsigned int *version
);
FMOD_RESULT FMOD_System_GetPluginInfo(
FMOD_SYSTEM *system,
unsigned int handle,
FMOD_PLUGINTYPE *plugintype,
char *name,
int namelen,
unsigned int *version
);
RESULT System.getPluginInfo(
uint handle,
out PLUGINTYPE plugintype,
out string name,
int namelen,
out uint version
);
System.getPluginInfo(
handle,
plugintype,
name,
version
);
Length of name
.
See Also: System::getNumPlugins, System::getPluginHandle
Retrieves identification information about an audio device specified by its index, and specific to the output mode.
FMOD_RESULT System::getRecordDriverInfo(
int id,
char *name,
int namelen,
FMOD_GUID *guid,
int *systemrate,
FMOD_SPEAKERMODE *speakermode,
int *speakermodechannels,
FMOD_DRIVER_STATE *state
);
FMOD_RESULT FMOD_System_GetRecordDriverInfo(
FMOD_SYSTEM *system,
int id,
char *name,
int namelen,
FMOD_GUID *guid,
int *systemrate,
FMOD_SPEAKERMODE *speakermode,
int *speakermodechannels,
FMOD_DRIVER_STATE *state
);
RESULT System.getRecordDriverInfo(
int id,
out string name,
int namelen,
out Guid guid,
out int systemrate,
out SPEAKERMODE speakermode,
out int speakermodechannels,
out DRIVER_STATE state
);
System.getRecordDriverInfo(
id,
name,
guid,
systemrate,
speakermode,
speakermodechannels,
state
);
Index of the recording device.
name
string.See Also: System::setOutput
Retrieves the number of recording devices available for this output mode. Use this to enumerate all recording devices possible so that the user can select one.
FMOD_RESULT System::getRecordNumDrivers(
int *numdrivers,
int *numconnected
);
FMOD_RESULT FMOD_System_GetRecordNumDrivers(
FMOD_SYSTEM *system,
int *numdrivers,
int *numconnected
);
RESULT System.getRecordNumDrivers(
out int numdrivers,
out int numconnected
);
System.getRecordNumDrivers(
numdrivers,
numconnected
);
See Also: System::getRecordDriverInfo
Retrieves the current recording position of the record buffer in PCM samples.
FMOD_RESULT System::getRecordPosition(
int id,
unsigned int *position
);
FMOD_RESULT FMOD_System_GetRecordPosition(
FMOD_SYSTEM *system,
int id,
unsigned int *position
);
RESULT System.getRecordPosition(
int id,
out uint position
);
System.getRecordPosition(
id,
position
);
Index of the recording device.
Current recording position.
Units: Samples
Will return FMOD_ERR_RECORD_DISCONNECTED if the driver is unplugged.
The position will return to 0 when System::recordStop is called or when a non-looping recording reaches the end.
PS4 specific note: Record devices are virtual so 'position' will continue to update if the device is unplugged (the OS is generating silence). This function will still report FMOD_ERR_RECORD_DISCONNECTED for your information though.
See Also: System::recordStart, System::recordStop
Retrieves the current reverb environment for the specified reverb instance.
FMOD_RESULT System::getReverbProperties(
int instance,
FMOD_REVERB_PROPERTIES *prop
);
FMOD_RESULT FMOD_System_GetReverbProperties(
FMOD_SYSTEM *system,
int instance,
FMOD_REVERB_PROPERTIES *prop
);
RESULT System.getReverbProperties(
int instance,
out REVERB_PROPERTIES prop
);
System.getReverbProperties(
instance,
prop
);
See Also: System::setReverbProperties
Retrieves the maximum number of software mixed Channels possible.
FMOD_RESULT System::getSoftwareChannels(
int *numsoftwarechannels
);
FMOD_RESULT FMOD_System_GetSoftwareChannels(
FMOD_SYSTEM *system,
int *numsoftwarechannels
);
RESULT System.getSoftwareChannels(
out int numsoftwarechannels
);
System.getSoftwareChannels(
numsoftwarechannels
);
Software Channels refers to real voices that will play, with numsoftwarechannels
refering to the maximum number of voices before successive voices start becoming virtual. For differences between real and virtual voices see the Virtual Voices guide.
See Also: System::setSoftwareChannels
Retrieves the output format for the software mixer.
FMOD_RESULT System::getSoftwareFormat(
int *samplerate,
FMOD_SPEAKERMODE *speakermode,
int *numrawspeakers
);
FMOD_RESULT FMOD_System_GetSoftwareFormat(
FMOD_SYSTEM *system,
int *samplerate,
FMOD_SPEAKERMODE *speakermode,
int *numrawspeakers
);
RESULT System.getSoftwareFormat(
out int samplerate,
out SPEAKERMODE speakermode,
out int numrawspeakers
);
System.getSoftwareFormat(
samplerate,
speakermode,
numrawspeakers
);
See Also: System::setSoftwareFormat
Retrieves the channel count for a given speaker mode.
FMOD_RESULT System::getSpeakerModeChannels(
FMOD_SPEAKERMODE mode,
int *channels
);
FMOD_RESULT FMOD_System_GetSpeakerModeChannels(
FMOD_SYSTEM *system,
FMOD_SPEAKERMODE mode,
int *channels
);
RESULT System.getSpeakerModeChannels(
SPEAKERMODE mode,
out int channels
);
System.getSpeakerModeChannels(
mode,
channels
);
Retrieves the position of the specified speaker for the current speaker mode.
FMOD_RESULT System::getSpeakerPosition(
FMOD_SPEAKER speaker,
float *x,
float *y,
bool *active
);
FMOD_RESULT FMOD_System_GetSpeakerPosition(
FMOD_SYSTEM *system,
FMOD_SPEAKER speaker,
float *x,
float *y,
FMOD_BOOL *active
);
RESULT System.getSpeakerPosition(
SPEAKER speaker,
out float x,
out float y,
out bool active
);
System.getSpeakerPosition(
speaker,
x,
y,
active
);
2D X position relative to the listener. -1 = left, 0 = middle, +1 = right.
2D Y position relative to the listener. -1 = back, 0 = middle, +1 = front.
Active state of a speaker. True = included in 3D calculations, False = ignored.
See Also: System::setSpeakerPosition
Retrieves the default file buffer size for newly opened streams.
FMOD_RESULT System::getStreamBufferSize(
unsigned int *filebuffersize,
FMOD_TIMEUNIT *filebuffersizetype
);
FMOD_RESULT FMOD_System_GetStreamBufferSize(
FMOD_SYSTEM *system,
unsigned int *filebuffersize,
FMOD_TIMEUNIT *filebuffersizetype
);
RESULT System.getStreamBufferSize(
out uint filebuffersize,
out TIMEUNIT filebuffersizetype
);
System.getStreamBufferSize(
filebuffersize,
filebuffersizetype
);
Buffer size.
Type of units for filebuffersize
. (FMOD_TIMEUNIT)
Valid units for filebuffersizetype
are:
See Also: System::setStreamBufferSize
Retrieves a user value associated with a System object.
FMOD_RESULT System::getUserData(
void **userdata
);
FMOD_RESULT FMOD_System_GetUserData(
FMOD_SYSTEM *system,
void **userdata
);
RESULT System.getUserData(
out IntPtr userdata
);
System.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.
Retrieves the FMOD version and build number.
FMOD_RESULT System::getVersion(
unsigned int *version,
unsigned int *buildnumber = 0
);
FMOD_RESULT FMOD_System_GetVersion(
FMOD_SYSTEM *system,
unsigned int *version,
unsigned int *buildnumber
);
RESULT System.getVersion(
out uint version
);
RESULT System.getVersion(
out uint version,
out uint buildnumber
);
System.getVersion(
version,
buildnumber
);
The version is a 32 bit hexadecimal value formatted as 16:8:8, with the upper 16 bits being the product version, the middle 8 bits being the major version and the bottom 8 bits being the minor version. For example a value of 0x00010203 is equal to 1.02.03.
Compare against FMOD_VERSION to make sure header and runtime library versions match.
See Also: System_Create
Initialize the system object and prepare FMOD for playback.
FMOD_RESULT System::init(
int maxchannels,
FMOD_INITFLAGS flags,
void *extradriverdata
);
FMOD_RESULT FMOD_System_Init(
FMOD_SYSTEM *system,
int maxchannels,
FMOD_INITFLAGS flags,
void *extradriverdata
);
RESULT System.init(
int maxchannels,
INITFLAGS flags,
IntPtr extradriverdata
);
System.init(
maxchannels,
flags,
extradriverdata
);
Maximum number of Channel objects available for playback, also known as virtual voices. Virtual voices will play with minimal overhead, with a subset of 'real' voices that are mixed, and selected based on priority and audibility. See the Virtual Voices guide for more information.
A system object must be created with System_create
Most API functions require an initialized System object before they will succeed, otherwise they will return FMOD_ERR_UNINITIALIZED. Some can only be called before initialization. These are:
System::setOutput / System::setOutputByPlugin can be called before or after System::init on Android, GameCore, UWP, Windows and Mac. Other platforms can only call this before System::init.
See Also: System::close, System::release
Retrieves the state of the FMOD recording API, ie if it is currently recording or not.
FMOD_RESULT System::isRecording(
int id,
bool *recording
);
FMOD_RESULT FMOD_System_IsRecording(
FMOD_SYSTEM *system,
int id,
FMOD_BOOL *recording
);
RESULT System.isRecording(
int id,
out bool recording
);
System.isRecording(
id,
recording
);
Index of the recording device.
Recording state. True = system is recording, False = system is not recording.
Recording can be started with System::recordStart and stopped with System::recordStop.
Will return FMOD_ERR_RECORD_DISCONNECTED if the driver is unplugged.
PS4 specific note: Record devices are virtual so 'recording' will continue to report true if the device is unplugged (the OS is generating silence). This function will still report FMOD_ERR_RECORD_DISCONNECTED for your information though.
See Also: System::getRecordPosition
Creates a geometry object from a block of memory which contains pre-saved geometry data.
This function avoids the need to manually create and add geometry for faster start time.
FMOD_RESULT System::loadGeometry(
const void *data,
int datasize,
Geometry **geometry
);
FMOD_RESULT FMOD_System_LoadGeometry(
FMOD_SYSTEM *system,
const void *data,
int datasize,
FMOD_GEOMETRY **geometry
);
RESULT System.loadGeometry(
IntPtr data,
int datasize,
out Geometry geometry
);
System.loadGeometry(
data,
datasize,
geometry
);
data
.See Also: System::createGeometry
Loads an FMOD plug-in (DSP, output or codec) from a file.
FMOD_RESULT System::loadPlugin(
const char *filename,
unsigned int *handle,
unsigned int priority = 0
);
FMOD_RESULT FMOD_System_LoadPlugin(
FMOD_SYSTEM *system,
const char *filename,
unsigned int *handle,
unsigned int priority
);
RESULT System.loadPlugin(
string filename,
out uint handle,
uint priority = 0
);
Currently not supported for JavaScript.
Once loaded, DSP plug-ins can be used via System::createDSPByPlugin, output plug-ins can be used via System::setOutputByPlugin, and codec plug-ins are used automatically.
When opening a file each codec tests whether it can support the file format in priority
order.
The format of the plug-in is dependent on the operating system:
See Also: System::unloadPlugin, System::setPluginPath, System::getNumPlugins, System::getPluginHandle, System::getPluginInfo
Mutual exclusion function to lock the DSP engine (which runs asynchronously in another thread), so that it will not execute.
FMOD_RESULT System::lockDSP();
FMOD_RESULT FMOD_System_LockDSP(FMOD_SYSTEM *system);
RESULT System.lockDSP();
System.lockDSP();
If the DSP engine is already executing, this function is blocked until it has completed.
The function may be used to synchronize DSP graph operations carried out by your code. For example, you could use this to construct a DSP sub-graph without the DSP engine executing in the background while the sub-graph is still under construction.
Once you no longer need the DSP engine to be locked, it can be unlocked with System::unlockDSP.
Note that if the DSP engine is locked for a significant amount of time, it may result in audible skipping or stuttering.
Resume mixer thread and reacquire access to audio hardware.
FMOD_RESULT System::mixerResume();
FMOD_RESULT FMOD_System_MixerResume(FMOD_SYSTEM *system);
RESULT System.mixerResume();
System.mixerResume();
Used on mobile platforms when entering the foreground after being suspended.
All internal state will resume, i.e. created Sound and Channels are still valid and playback will continue.
Android specific: Must be called on the same thread as System::mixerSuspend.
HTML5 specific: Used to start audio from a user interaction event, like a mouse click or screen touch event. Without this call audio may not start on some browsers.
See Also: System::mixerSuspend
Suspend mixer thread and relinquish usage of audio hardware while maintaining internal state.
FMOD_RESULT System::mixerSuspend();
FMOD_RESULT FMOD_System_MixerSuspend(FMOD_SYSTEM *system);
RESULT System.mixerSuspend();
System.mixerSuspend();
Used on mobile platforms when entering a backgrounded state to reduce CPU to 0%.
All internal state will be maintained, i.e. created Sound and Channels will stay available in memory.
See Also: System::mixerResume
Plays a DSP along with any of its inputs on a Channel.
FMOD_RESULT System::playDSP(
DSP *dsp,
ChannelGroup *channelgroup,
bool paused,
Channel **channel
);
FMOD_RESULT FMOD_System_PlayDSP(
FMOD_SYSTEM *system,
FMOD_DSP *dsp,
FMOD_CHANNELGROUP *channelgroup,
FMOD_BOOL paused,
FMOD_CHANNEL **channel
);
RESULT System.playDSP(
DSP dsp,
ChannelGroup channelgroup,
bool paused,
out Channel channel
);
System.playDSP(
dsp,
channelgroup,
paused,
channel
);
Whether to start in the paused state. Start a Channel paused to allow altering attributes without it being audible, then follow it up with a call to ChannelControl::setPaused with paused
= False.
Specifying a channelgroup
as part of playDSP is more efficient than using Channel::setChannelGroup after playDSP, and could avoid audible glitches if the playDSP is not in a paused state.
Channels are reference counted to handle dead or stolen Channel handles. See the white paper on Channel handles for more information.
Playing more Sounds or DSPs than physical Channels allow is handled with virtual voices. See the white paper on Virtual Voices for more information.
See Also: System::createDSP, System::createDSPByType, System::createDSPByPlugin
Plays a Sound on a Channel.
FMOD_RESULT System::playSound(
Sound *sound,
ChannelGroup *channelgroup,
bool paused,
Channel **channel
);
FMOD_RESULT FMOD_System_PlaySound(
FMOD_SYSTEM *system,
FMOD_SOUND *sound,
FMOD_CHANNELGROUP *channelgroup,
FMOD_BOOL paused,
FMOD_CHANNEL **channel
);
RESULT System.playSound(
Sound sound,
ChannelGroup channelgroup,
bool paused,
out Channel channel
);
System.playSound(
sound,
channelgroup,
paused,
channel
);
Whether to start in the paused state. Start a Channel paused to allow altering attributes without it being audible, then follow it up with a call to ChannelControl::setPaused with paused
= False.
When a sound is played, it will use the sound's default frequency and priority. See Sound::setDefaults.
A sound defined as FMOD_3D will by default play at the 3D position of the listener. To set the 3D position of the Channel before the sound is audible, start the Channel paused by setting the paused
parameter to true, and call ChannelControl::set3DAttributes.
Specifying a channelgroup
as part of playSound is more efficient than using Channel::setChannelGroup after playSound, and could avoid audible glitches if the playSound is not in a paused state.
Channels are reference counted to handle dead or stolen Channel handles. See the white paper on Channel handles for more information.
Playing more Sounds than physical Channels allow is handled with virtual voices. See the white paper on Virtual Voices for more information.
See Also: System::createSound, System::createStream
Starts the recording engine recording to a pre-created Sound object.
FMOD_RESULT System::recordStart(
int id,
Sound *sound,
bool loop
);
FMOD_RESULT FMOD_System_RecordStart(
FMOD_SYSTEM *system,
int id,
FMOD_SOUND *sound,
FMOD_BOOL loop
);
RESULT System.recordStart(
int id,
Sound sound,
bool loop
);
System.recordStart(
id,
sound,
loop
);
Index of the recording device.
Flag to tell the recording engine whether to continue recording to the provided sound from the start again, after it has reached the end. If this is set to true the data will be continually be overwritten once every loop.
Will return FMOD_ERR_RECORD_DISCONNECTED if the driver is unplugged.
Sound must be created as FMOD_CREATESAMPLE. Raw PCM data can be accessed with Sound::lock, Sound::unlock and System::getRecordPosition.
Recording from the same driver a second time will stop the first recording.
For lowest latency set the FMOD::Sound sample rate to the rate returned by System::getRecordDriverInfo, otherwise a resampler will be allocated to handle the difference in frequencies, which adds latency.
See Also: System::recordStop
Stops the recording engine from recording to a pre-created Sound object.
FMOD_RESULT System::recordStop(
int id
);
FMOD_RESULT FMOD_System_RecordStop(
FMOD_SYSTEM *system,
int id
);
RESULT System.recordStop(
int id
);
System.recordStop(
id
);
Index of the recording device.
Returns no error if unplugged or already stopped.
See Also: System::recordStart
Register a Codec plug-in description structure for later use.
FMOD_RESULT System::registerCodec(
FMOD_CODEC_DESCRIPTION *description,
unsigned int *handle,
unsigned int priority = 0
);
FMOD_RESULT FMOD_System_RegisterCodec(
FMOD_SYSTEM *system,
FMOD_CODEC_DESCRIPTION *description,
unsigned int *handle,
unsigned int priority
);
System.registerCodec(
description,
handle,
priority
);
Currently not supported for C#.
To create an instances of this plug-in use System::createSound and System::createStream.
When opening a file each Codec tests whether it can support the file format in priority
order. The priority for each FMOD_SOUND_TYPE are as follows:
FMOD_SOUND_TYPE | Priority |
---|---|
FMOD_SOUND_TYPE_FSB | 250 |
FMOD_SOUND_TYPE_XMA | 250 |
FMOD_SOUND_TYPE_AT9 | 250 |
FMOD_SOUND_TYPE_VORBIS | 250 |
FMOD_SOUND_TYPE_OPUS | 250 |
FMOD_SOUND_TYPE_FADPCM | 250 |
FMOD_SOUND_TYPE_WAV | 600 |
FMOD_SOUND_TYPE_OGGVORBIS | 800 |
FMOD_SOUND_TYPE_AIFF | 1000 |
FMOD_SOUND_TYPE_FLAC | 1100 |
FMOD_SOUND_TYPE_MOD | 1200 |
FMOD_SOUND_TYPE_S3M | 1300 |
FMOD_SOUND_TYPE_XM | 1400 |
FMOD_SOUND_TYPE_IT | 1500 |
FMOD_SOUND_TYPE_MIDI | 1600 |
FMOD_SOUND_TYPE_DLS | 1700 |
FMOD_SOUND_TYPE_ASF | 1900 |
FMOD_SOUND_TYPE_AUDIOQUEUE | 2200 |
FMOD_SOUND_TYPE_MEDIACODEC | 2250 |
FMOD_SOUND_TYPE_MPEG | 2400 |
FMOD_SOUND_TYPE_PLAYLIST | 2450 |
FMOD_SOUND_TYPE_RAW | 2500 |
FMOD_SOUND_TYPE_USER | 2600 |
FMOD_SOUND_TYPE_MEDIA_FOUNDATION | 2600 |
XMA, AT9, Vorbis, Opus and FADPCM are supported through the FSB format, and therefore have the same priority as FSB.
Media Foundation is supported through the User codec, and therefore has the same priority as User.
Raw and User are only accesible if FMOD_OPENRAW or FMOD_OPENUSER is specified as the mode in System::createSound.
Register a DSP plug-in description structure for later use.
FMOD_RESULT System::registerDSP(
const FMOD_DSP_DESCRIPTION *description,
unsigned int *handle
);
FMOD_RESULT FMOD_System_RegisterDSP(
FMOD_SYSTEM *system,
const FMOD_DSP_DESCRIPTION *description,
unsigned int *handle
);
RESULT System.registerDSP(
ref DSP_DESCRIPTION description,
out uint handle
);
System.registerDSP(
description,
handle
);
To create an instance of this plug-in, use System::createDSPByPlugin.
Register an Output plug-in description structure for later use.
FMOD_RESULT System::registerOutput(
const FMOD_OUTPUT_DESCRIPTION *description,
unsigned int *handle
);
FMOD_RESULT FMOD_System_RegisterOutput(
FMOD_SYSTEM *system,
const FMOD_OUTPUT_DESCRIPTION *description,
unsigned int *handle
);
System.registerOutput(
description,
handle
);
Not supported for C#.
To select this plug-in for output use, use System::setOutputByPlugin.
Closes and frees this object and its resources.
FMOD_RESULT System::release();
FMOD_RESULT FMOD_System_Release(FMOD_SYSTEM *system);
RESULT System.release();
System.release();
This will internally call System::close, so calling System::close before this function is not necessary.
Calls to System_Create and System::release are not thread-safe. Do not call these functions simultaneously from multiple threads at once.
See Also: System::init
Sets the position, velocity and orientation of the specified 3D sound listener.
FMOD_RESULT System::set3DListenerAttributes(
int listener,
const FMOD_VECTOR *pos,
const FMOD_VECTOR *vel,
const FMOD_VECTOR *forward,
const FMOD_VECTOR *up
);
FMOD_RESULT FMOD_System_Set3DListenerAttributes(
FMOD_SYSTEM *system,
int listener,
const FMOD_VECTOR *pos,
const FMOD_VECTOR *vel,
const FMOD_VECTOR *forward,
const FMOD_VECTOR *up
);
RESULT System.set3DListenerAttributes(
int listener,
ref VECTOR pos,
ref VECTOR vel,
ref VECTOR forward,
ref VECTOR up
);
System.set3DListenerAttributes(
listener,
pos,
vel,
forward,
up
);
Index of listener to set 3D attributes on. Listeners are indexed from 0, to FMOD_MAX_LISTENERS - 1, in a multi-listener environment.
Position in 3D world space used for panning and attenuation. (FMOD_VECTOR)
Velocity in 3D space used for doppler. (FMOD_VECTOR)
The forward
and up
vectors must be perpendicular and be of unit length (magnitude of each vector should be 1).
Vectors must be provided in the correct handedness.
For velocity, remember to use units per second, and not units per frame. This is a common mistake and will make the doppler effect sound wrong if velocity is based on movement per frame rather than a fixed time period.
If velocity per frame is calculated, it can be converted to velocity per second by dividing it by the time taken between frames as a fraction of a second.
i.e.
velocity_units_per_second = (position_currentframe - position_lastframe) / time_taken_since_last_frame_in_seconds.
At 60fps the formula would look like velocity_units_per_second = (position_currentframe - position_lastframe) / 0.0166667.
Users of the Studio API should call Studio::System::setListenerAttributes instead of this function.
See Also: System::get3DListenerAttributes, System::set3DSettings, System::get3DSettings
Sets the number of 3D 'listeners' in the 3D sound scene.
FMOD_RESULT System::set3DNumListeners(
int numlisteners
);
FMOD_RESULT FMOD_System_Set3DNumListeners(
FMOD_SYSTEM *system,
int numlisteners
);
RESULT System.set3DNumListeners(
int numlisteners
);
System.set3DNumListeners(
numlisteners
);
Number of listeners in the scene.
This function is useful mainly for split-screen game purposes.
If the number of listeners is set to more than 1, then panning and doppler are turned off. All sound effects will be mono. FMOD uses a 'closest sound to the listener' method to determine what should be heard in this case.
Users of the Studio API should call Studio::System::setNumListeners instead of this function.
See Also: System::get3DNumListeners, System::set3DListenerAttributes
Sets a callback to allow custom calculation of distance attenuation.
FMOD_RESULT System::set3DRolloffCallback(
FMOD_3D_ROLLOFF_CALLBACK callback
);
FMOD_RESULT FMOD_System_Set3DRolloffCallback(
FMOD_SYSTEM *system,
FMOD_3D_ROLLOFF_CALLBACK callback
);
RESULT System.set3DRolloffCallback(
CB_3D_ROLLOFFCALLBACK callback
);
Not supported for JavaScript.
This function overrides FMOD_3D_INVERSEROLLOFF, FMOD_3D_LINEARROLLOFF, FMOD_3D_LINEARSQUAREROLLOFF, FMOD_3D_INVERSETAPEREDROLLOFF and FMOD_3D_CUSTOMROLLOFF.
See Also: Callback Behavior
Sets the global doppler scale, distance factor and log roll-off scale for all 3D sound in FMOD.
FMOD_RESULT System::set3DSettings(
float dopplerscale,
float distancefactor,
float rolloffscale
);
FMOD_RESULT FMOD_System_Set3DSettings(
FMOD_SYSTEM *system,
float dopplerscale,
float distancefactor,
float rolloffscale
);
RESULT System.set3DSettings(
float dopplerscale,
float distancefactor,
float rolloffscale
);
System.set3DSettings(
dopplerscale,
distancefactor,
rolloffscale
);
A scaling factor for doppler shift.
A factor for converting game distance units to FMOD distance units.
A scaling factor for distance attenuation. When a sound uses a roll-off mode other than FMOD_3D_CUSTOMROLLOFF and the distance is greater than the sound's minimum distance, the distance is scaled by the roll-off scale.
The dopplerscale
is a general scaling factor for how much the pitch varies due to doppler shifting in 3D sound. Doppler is the pitch bending effect when a sound comes towards the listener or moves away from it, much like the effect you hear when a train goes past you with its horn sounding. With "dopplerscale" you can exaggerate or diminish the effect. FMOD's effective speed of sound at a doppler factor of 1.0 is 340 m/s.
The distancefactor
is the FMOD 3D engine relative distance factor, compared to 1.0 meters. Another way to put it is that it equates to "how many units per meter does your engine have". For example, if you are using feet then "scale" would equal 3.28.
This only affects doppler. If you keep your min/max distance, custom roll-off curves, and positions in scale relative to each other, the volume roll-off will not change. If you set this, the mindistance of a sound will automatically set itself to this value when it is created in case the user forgets to set the mindistance to match the new distancefactor.
The rolloffscale
is a global factor applied to the roll-off of sounds using roll-off modes other than FMOD_3D_CUSTOMROLLOFF. When a sound uses a roll-off mode other than FMOD_3D_CUSTOMROLLOFF and the distance is greater than the sound's minimum distance, the distance for the purposes of distance attenuation is calculated according to the formula distance = (distance - minDistance) * rolloffscale + minDistance
.
See Also: System::get3DSettings, Sound::set3DMinMaxDistance, Sound::get3DMinMaxDistance, ChannelControl::set3DAttributes
Sets advanced settings for the system object, typically to allow adjusting of settings related to resource usage or audio quality.
FMOD_RESULT System::setAdvancedSettings(
FMOD_ADVANCEDSETTINGS *settings
);
FMOD_RESULT FMOD_System_SetAdvancedSettings(
FMOD_SYSTEM *system,
FMOD_ADVANCEDSETTINGS *settings
);
RESULT System.setAdvancedSettings(
ref ADVANCEDSETTINGS settings
);
System.setAdvancedSettings(
settings
);
To use, clear the FMOD_ADVANCEDSETTINGS structure to zeroes first, then set the cbSize member to the size in bytes of the FMOD_ADVANCEDSETTINGS structure. From here settings can be set one at a time, as all defaults are null or 0 for all members.
See Also: System::getAdvancedSettings
Sets the callback for System level notifications.
FMOD_RESULT System::setCallback(
FMOD_SYSTEM_CALLBACK callback,
FMOD_SYSTEM_CALLBACK_TYPE callbackmask = FMOD_SYSTEM_CALLBACK_ALL
);
FMOD_RESULT FMOD_System_SetCallback(
FMOD_SYSTEM *system,
FMOD_SYSTEM_CALLBACK callback,
FMOD_SYSTEM_CALLBACK_TYPE callbackmask
);
RESULT System.setCallback(
SYSTEM_CALLBACK callback,
SYSTEM_CALLBACK_TYPE callbackmask = SYSTEM_CALLBACK_TYPE.ALL
);
System.setCallback(
callback,
callbackmask
);
System callbacks can be called by a variety of FMOD threads, so make sure any code executed inside the callback is thread safe.
See Also: Callback Behavior
Sets the output driver for the selected output type.
FMOD_RESULT System::setDriver(
int driver
);
FMOD_RESULT FMOD_System_SetDriver(
FMOD_SYSTEM *system,
int driver
);
RESULT System.setDriver(
int driver
);
System.setDriver(
driver
);
Driver index where 0 represents the default for the output type.
When an output type has more than one driver available, this function can be used to select between them.
If this function is called after System::init, the current driver will be shutdown and the newly selected driver will be initialized / started.
See Also: System::getDriver, System::getDriverInfo, System::setOutput
Sets the buffer size for the FMOD software mixing engine.
This function is used if you need to control mixer latency or granularity. Smaller buffersizes lead to smaller latency, but can lead to stuttering/skipping/unstable sound on slower machines or soundcards with bad drivers.
FMOD_RESULT System::setDSPBufferSize(
unsigned int bufferlength,
int numbuffers
);
FMOD_RESULT FMOD_System_SetDSPBufferSize(
FMOD_SYSTEM *system,
unsigned int bufferlength,
int numbuffers
);
RESULT System.setDSPBufferSize(
uint bufferlength,
int numbuffers
);
System.setDSPBufferSize(
bufferlength,
numbuffers
);
The mixer engine block size. Use this to adjust mixer update granularity. See below for more information on buffer length vs latency.
The mixer engine number of buffers used. Use this to adjust mixer latency. See below for more information on number of buffers vs latency.
To get the bufferlength
in milliseconds, divide it by the output rate and multiply the result by 1000. For a bufferlength
of 1024 and an output rate of 48khz (see System::SetSoftwareFormat), milliseconds = 1024 / 48000 * 1000 = 21.33ms. This means the mixer updates every 21.33ms.
To get the total buffer size multiply the bufferlength
by the numbuffers
value. By default this would be 4 * 1024 = 4096 samples, or 4 * 21.33ms = 85.33ms. This would generally be the total latency of the software mixer, but in reality due to one of the buffers being written to constantly, and the cursor position of the buffer that is audible, the latency is typically more like the (number of buffers - 1.5) multiplied by the buffer length.
To convert from milliseconds back to 'samples', simply multiply the value in milliseconds by the sample rate of the output (ie 48000 if that is what it is set to), then divide by 1000.
The FMOD software mixer mixes to a ringbuffer. The size of this ringbuffer is determined here. It mixes a block of sound data every 'bufferlength' number of samples, and there are 'numbuffers' number of these blocks that make up the entire ringbuffer. Adjusting these values can lead to extremely low latency performance (smaller values), or greater stability in sound output (larger values).
Warning! The 'buffersize' is generally best left alone. Making the granularity smaller will just increase CPU usage (cache misses and DSP graph overhead). Making it larger affects how often you hear commands update such as volume/pitch/pan changes. Anything above 20ms will be noticeable and sound parameter changes will be obvious instead of smooth.
FMOD chooses the most optimal size by default for best stability, depending on the output type. It is not recommended changing this value unless you really need to. You may get worse performance than the default settings chosen by FMOD. If you do set the size manually, the bufferlength
argument must be a multiple of four, typically 256, 480, 512, 1024 or 2048 depedning on your latency requirements.
The values in milliseconds and average latency expected from the settings can be calculated using the following code:
FMOD_RESULT result;
unsigned int blocksize;
int numblocks;
float ms;
result = system->getDSPBufferSize(&blocksize, &numblocks);
result = system->getSoftwareFormat(&frequency, 0, 0);
ms = (float)blocksize * 1000.0f / (float)frequency;
printf("Mixer blocksize = %.02f ms\n", ms);
printf("Mixer Total buffersize = %.02f ms\n", ms * numblocks);
printf("Mixer Average Latency = %.02f ms\n", ms * ((float)numblocks - 1.5f));
See Also: System::getDSPBufferSize, System::getSoftwareFormat, System::init, System::close
Set callbacks to implement all file I/O instead of using the platform native method.
FMOD_RESULT System::setFileSystem(
FMOD_FILE_OPEN_CALLBACK useropen,
FMOD_FILE_CLOSE_CALLBACK userclose,
FMOD_FILE_READ_CALLBACK userread,
FMOD_FILE_SEEK_CALLBACK userseek,
FMOD_FILE_ASYNCREAD_CALLBACK userasyncread,
FMOD_FILE_ASYNCCANCEL_CALLBACK userasynccancel,
int blockalign
);
FMOD_RESULT FMOD_System_SetFileSystem(
FMOD_SYSTEM *system,
FMOD_FILE_OPEN_CALLBACK useropen,
FMOD_FILE_CLOSE_CALLBACK userclose,
FMOD_FILE_READ_CALLBACK userread,
FMOD_FILE_SEEK_CALLBACK userseek,
FMOD_FILE_ASYNCREAD_CALLBACK userasyncread,
FMOD_FILE_ASYNCCANCEL_CALLBACK userasynccancel,
int blockalign
);
RESULT System.setFileSystem(
FILE_OPENCALLBACK useropen,
FILE_CLOSECALLBACK userclose,
FILE_READCALLBACK userread,
FILE_SEEKCALLBACK userseek,
FILE_ASYNCREADCALLBACK userasyncread,
FILE_ASYNCCANCELCALLBACK userasynccancel,
int blockalign
);
System.setFileSystem(
useropen,
userclose,
userread,
userseek,
userasyncread,
userasynccancel,
blockalign
);
userasyncread
and userasynccancel
. (FMOD_FILE_READ_CALLBACK)userasyncread
and userasynccancel
. (FMOD_FILE_SEEK_CALLBACK)userread
and userseek
. (FMOD_FILE_ASYNCREAD_CALLBACK)userasyncread
call. (FMOD_FILE_ASYNCCANCEL_CALLBACK)File buffering chunk size, specify -1 to keep system default or previously set value. 0 = disable buffering, see notes below for more on this.
Setting these callbacks have no effect on sounds loaded with FMOD_OPENMEMORY or FMOD_OPENUSER.
There are three valid configurations for this function:
useropen
, userclose
, userread
, userseek
and optionally blockalign
for blocking file I/O.useropen
, userclose
, userasyncread
, userasynccancel
and optionally blockalign
for asynchronous file I/O.blockalign
by itself with everything else null, to change platform native file I/O buffering.Setting blockalign
to 0 will disable file buffering and cause every read to invoke the relevant callback (not recommended), current default is tuned for memory usage vs performance. Be mindful of the I/O capabilities of the platform before increasing this default.
Asynchronous file access via userasyncread
/ userasynccanel
.
userasyncread
allows the user to return immediately before the data is ready. FMOD will either wait internally (see note below about thread safety), or continuously check in the streamer until data arrives. It is the user's responsibility to provide data in time in the stream case, or the stream may stutter. Data starvation can be detected with Sound::getOpenState.userasyncread
is processed in the main thread, then it will hang the application, because FMOD will wait internally until data is ready, and the main thread will not be able to supply the data. For this reason the user's file access should normally be from a separate thread.userasynccancel
must either service or prevent an async read issued previously via userasyncread
before returning.Implementation tips to avoid hangs / crashes.
userasyncread
and userasynccancel
are not supported for JavaScript.
See Also: Callback Behavior, System::attachFileSystem
Sets the maximum world size for the geometry engine for performance / precision reasons.
FMOD_RESULT System::setGeometrySettings(
float maxworldsize
);
FMOD_RESULT FMOD_System_SetGeometrySettings(
FMOD_SYSTEM *system,
float maxworldsize
);
RESULT System.setGeometrySettings(
float maxworldsize
);
System.setGeometrySettings(
maxworldsize
);
FMOD uses an efficient spatial partitioning system to store polygons for ray casting purposes.
The maximum size of the world should (maxworldsize
) be set to allow processing within a known range.
Outside of this range, objects and polygons will not be processed as efficiently.
Excessive world size settings can also cause loss of precision and efficiency.
Setting maxworldsize
should be done first before creating any geometry. It can be done any time afterwards but may be slow in this case.
See Also: System::createGeometry, System::getGeometrySettings, System::set3DSettings
Set a proxy server to use for all subsequent internet connections.
FMOD_RESULT System::setNetworkProxy(
const char *proxy
);
FMOD_RESULT FMOD_System_SetNetworkProxy(
FMOD_SYSTEM *system,
const char *proxy
);
RESULT System.setNetworkProxy(
string proxy
);
System.setNetworkProxy(
proxy
);
Specify the proxy in host:port
format e.g. www.fmod.com:8888
(defaults to port 80 if no port is specified).
Basic authentication is supported using user:password@host:port
format e.g. bob:sekrit123@www.fmod.com:8888
See Also: System::getNetworkProxy
Set the timeout for network streams.
FMOD_RESULT System::setNetworkTimeout(
int timeout
);
FMOD_RESULT FMOD_System_SetNetworkTimeout(
FMOD_SYSTEM *system,
int timeout
);
RESULT System.setNetworkTimeout(
int timeout
);
System.setNetworkTimeout(
timeout
);
Timeout value.
See Also: System::getNetworkTimeout
Sets the type of output interface used to run the mixer.
FMOD_RESULT System::setOutput(
FMOD_OUTPUTTYPE output
);
FMOD_RESULT FMOD_System_SetOutput(
FMOD_SYSTEM *system,
FMOD_OUTPUTTYPE output
);
RESULT System.setOutput(
OUTPUTTYPE output
);
System.setOutput(
output
);
This function is typically used to select between different OS specific audio APIs which may have different features.
It is only necessary to call this function if you want to specifically switch away from the default output mode for the operating system. The most optimal mode is selected by default for the operating system.
(Windows, UWP, GameCore, Android, MacOS, iOS, Linux Only) This function can be called after System::init to perform special handling of driver disconnections, see FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED.
When using the Studio API, switching to an NRT (non-realtime) output type after FMOD is already initialized will not behave correctly unless the Studio API was initialized with FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE.
See Also: System::getOutput
Selects an output type given a plug-in handle.
FMOD_RESULT System::setOutputByPlugin(
unsigned int handle
);
FMOD_RESULT FMOD_System_SetOutputByPlugin(
FMOD_SYSTEM *system,
unsigned int handle
);
RESULT System.setOutputByPlugin(
uint handle
);
System.setOutputByPlugin(
handle
);
(Windows Only) This function can be called after FMOD is already initialized. You can use it to change the output mode at runtime. If FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED is specified use the setOutput call to change to FMOD_OUTPUTTYPE_NOSOUND if no more sound card drivers exist.
See Also: System::getNumPlugins, System::getOutputByPlugin, System::setOutput
Specify a base search path for plug-ins so they can be placed somewhere else than the directory of the main executable.
FMOD_RESULT System::setPluginPath(
const char *path
);
FMOD_RESULT FMOD_System_SetPluginPath(
FMOD_SYSTEM *system,
const char *path
);
RESULT System.setPluginPath(
string path
);
System.setPluginPath(
path
);
See Also: System::loadPlugin
Sets parameters for the global reverb environment.
FMOD_RESULT System::setReverbProperties(
int instance,
const FMOD_REVERB_PROPERTIES *prop
);
FMOD_RESULT FMOD_System_SetReverbProperties(
FMOD_SYSTEM *system,
int instance,
const FMOD_REVERB_PROPERTIES *prop
);
RESULT System.setReverbProperties(
int instance,
ref REVERB_PROPERTIES prop
);
System.setReverbProperties(
instance,
prop
);
Index of the particular reverb instance to target.
To assist in defining reverb properties there are several presets available, see FMOD_REVERB_PRESETS
When using each instance for the first time, FMOD will create an SFX reverb DSP unit that takes up several hundred kilobytes of memory and some CPU.
See Also: System::getReverbProperties, ChannelControl::setReverbProperties, ChannelControl::getReverbProperties, Effects Reference: SFX Reverb
Sets the maximum number of software mixed Channels possible.
FMOD_RESULT System::setSoftwareChannels(
int numsoftwarechannels
);
FMOD_RESULT FMOD_System_SetSoftwareChannels(
FMOD_SYSTEM *system,
int numsoftwarechannels
);
RESULT System.setSoftwareChannels(
int numsoftwarechannels
);
System.setSoftwareChannels(
numsoftwarechannels
);
The maximum number of real Channels to be allocated by FMOD.
This function cannot be called after FMOD is already activated, it must be called before System::init, or after System::close.
'Software Channels' refers to real Channels that will play, with numsoftwarechannels
refering to the maximum number of Channels before successive Channels start becoming virtual. For differences between real and virtual Channels see the Virtual Voices guide.
See Also: System::getSoftwareChannels, System::init, System::close
Sets the output format for the software mixer.
FMOD_RESULT System::setSoftwareFormat(
int samplerate,
FMOD_SPEAKERMODE speakermode,
int numrawspeakers
);
FMOD_RESULT FMOD_System_SetSoftwareFormat(
FMOD_SYSTEM *system,
int samplerate,
FMOD_SPEAKERMODE speakermode,
int numrawspeakers
);
RESULT System.setSoftwareFormat(
int samplerate,
SPEAKERMODE speakermode,
int numrawspeakers
);
System.setSoftwareFormat(
samplerate,
speakermode,
numrawspeakers
);
Sample rate of the mixer.
Number of speakers for FMOD_SPEAKERMODE_RAW mode.
If loading banks made in FMOD Studio, this must be called with speakermode
corresponding to the project output format if there is a possibility of the output audio device not matching the project format. Any differences between the project format and speakermode
will cause the mix to sound wrong.
By default speakermode
will assume the setup the OS / output prefers.
Altering the samplerate
from the OS / output preferred rate may incur extra latency. Altering the speakermode
from the OS / output preferred mode may cause an upmix/downmix which can alter the sound.
On lower power platforms such as mobile samplerate
will default to 24 kHz to reduce CPU cost.
This function must be called before System::init, or after System::close.
See Also: System::getSoftwareFormat
Sets the position of the specified speaker for the current speaker mode.
This function allows the user to specify the position of their speaker to account for non standard setups.
It also allows the user to disable speakers from 3D consideration in a game.
FMOD_RESULT System::setSpeakerPosition(
FMOD_SPEAKER speaker,
float x,
float y,
bool active
);
FMOD_RESULT FMOD_System_SetSpeakerPosition(
FMOD_SYSTEM *system,
FMOD_SPEAKER speaker,
float x,
float y,
FMOD_BOOL active
);
RESULT System.setSpeakerPosition(
SPEAKER speaker,
float x,
float y,
bool active
);
System.setSpeakerPosition(
speaker,
x,
y,
active
);
2D X position relative to the listener. -1 = left, 0 = middle, +1 = right.
2D Y position relative to the listener. -1 = back, 0 = middle, +1 = front.
Active state of a speaker. True = included in 3D calculations, False = ignored.
This allows you to customize the position of the speakers for the current FMOD_SPEAKERMODE by giving X (left to right) and Y (front to back) coordinates.
When disabling a speaker, 3D spatialization is redistributed around the missing speaker so that signal isn't lost.
Stereo setup would look like this:
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_FRONT_LEFT, -1.0f, 0.0f, 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_FRONT_RIGHT, 1.0f, 0.0f, 1);
system->setSpeakerPosition(FMOD_SPEAKER_FRONT_LEFT, -1.0f, 0.0f, true);
system->setSpeakerPosition(FMOD_SPEAKER_FRONT_RIGHT, 1.0f, 0.0f, true);
7.1 setup would look like this:
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_FRONT_LEFT, sin(degtorad( -30)), cos(degtorad( -30)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_FRONT_RIGHT, sin(degtorad( 30)), cos(degtorad( 30)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_FRONT_CENTER, sin(degtorad( 0)), cos(degtorad( 0)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_LOW_FREQUENCY, sin(degtorad( 0)), cos(degtorad( 0)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_SURROUND_LEFT, sin(degtorad( -90)), cos(degtorad( -90)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_SURROUND_RIGHT, sin(degtorad( 90)), cos(degtorad( 90)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_BACK_LEFT, sin(degtorad(-150)), cos(degtorad(-150)), 1);
FMOD_System_SetSpeakerPosition(system, FMOD_SPEAKER_BACK_RIGHT, sin(degtorad( 150)), cos(degtorad( 150)), 1);
system->setSpeakerPosition(FMOD_SPEAKER_FRONT_LEFT, sin(degtorad( -30)), cos(degtorad( -30)), true);
system->setSpeakerPosition(FMOD_SPEAKER_FRONT_RIGHT, sin(degtorad( 30)), cos(degtorad( 30)), true);
system->setSpeakerPosition(FMOD_SPEAKER_FRONT_CENTER, sin(degtorad( 0)), cos(degtorad( 0)), true);
system->setSpeakerPosition(FMOD_SPEAKER_LOW_FREQUENCY, sin(degtorad( 0)), cos(degtorad( 0)), true);
system->setSpeakerPosition(FMOD_SPEAKER_SURROUND_LEFT, sin(degtorad( -90)), cos(degtorad( -90)), true);
system->setSpeakerPosition(FMOD_SPEAKER_SURROUND_RIGHT, sin(degtorad( 90)), cos(degtorad( 90)), true);
system->setSpeakerPosition(FMOD_SPEAKER_BACK_LEFT, sin(degtorad(-150)), cos(degtorad(-150)), true);
system->setSpeakerPosition(FMOD_SPEAKER_BACK_RIGHT, sin(degtorad( 150)), cos(degtorad( 150)), true);
Calling System::setSoftwareFormat will override any customization made with this function.
Users of the Studio API should be aware this function does not affect the speaker positions used by the spatializer DSPs such as the pan and object panner DSPs. It is purely for Core API spatialization via ChannelControl::set3DAttributes.
See Also: System::getSpeakerPosition
Sets the default file buffer size for newly opened streams.
FMOD_RESULT System::setStreamBufferSize(
unsigned int filebuffersize,
FMOD_TIMEUNIT filebuffersizetype
);
FMOD_RESULT FMOD_System_SetStreamBufferSize(
FMOD_SYSTEM *system,
unsigned int filebuffersize,
FMOD_TIMEUNIT filebuffersizetype
);
RESULT System.setStreamBufferSize(
uint filebuffersize,
TIMEUNIT filebuffersizetype
);
System.setStreamBufferSize(
filebuffersize,
filebuffersizetype
);
Buffer size.
Type of units for filebuffersize
. (FMOD_TIMEUNIT)
Valid units for filebuffersizetype
are:
Larger values will consume more memory, whereas smaller values may cause buffer under-run / starvation / stuttering caused by large delays in disk access (ie netstream), or CPU usage in slow machines, or by trying to play too many streams at once.
Does not affect streams created with FMOD_OPENUSER, as the buffer size is specified in System::createSound.
Does not affect latency of playback. All streams are pre-buffered (unless opened with FMOD_OPENONLY), so they will always start immediately.
Seek and Play operations can sometimes cause a reflush of this buffer.
If FMOD_TIMEUNIT_RAWBYTES is used, the memory allocated is two times the size passed in, because fmod allocates a double buffer.
If FMOD_TIMEUNIT_MS, FMOD_TIMEUNIT_PCM or FMOD_TIMEUNIT_PCMBYTES is used, and the stream is infinite (such as a shoutcast netstream), or VBR, then FMOD cannot calculate an accurate compression ratio to work with when the file is opened. This means it will then base the buffersize on FMOD_TIMEUNIT_PCMBYTES, or in other words the number of PCM bytes, but this will be incorrect for some compressed formats. Use FMOD_TIMEUNIT_RAWBYTES for these type (infinite / undetermined length) of streams for more accurate read sizes.
To determine the actual memory usage of a stream, including sound buffer and other overhead, use Memory_GetStats before and after creating a sound.
Stream may still stutter if the codec uses a large amount of cpu time, which impacts the smaller, internal 'decode' buffer. The decode buffer size is changeable via FMOD_CREATESOUNDEXINFO.
See Also: System::getStreamBufferSize, Sound::getOpenState
Sets a user value associated with a System object.
FMOD_RESULT System::setUserData(
void *userdata
);
FMOD_RESULT FMOD_System_SetUserData(
FMOD_SYSTEM *system,
void *userdata
);
RESULT System.setUserData(
IntPtr userdata
);
System.setUserData(
userdata
);
This function allows arbitrary user data to be attached to this object, which wll be passed through the userdata
parameter in any FMOD_SYSTEM_CALLBACKs. See the User Data section of the glossary for an example of how to get and set user data.
See Also: System::getUserData, System::setCallback
Unloads an FMOD (DSP, Output or Codec) plug-in.
FMOD_RESULT System::unloadPlugin(
unsigned int handle
);
FMOD_RESULT FMOD_System_UnloadPlugin(
FMOD_SYSTEM *system,
unsigned int handle
);
RESULT System.unloadPlugin(
uint handle
);
System.unloadPlugin(
handle
);
See Also: System::loadPlugin
Mutual exclusion function to unlock the DSP engine (which runs asynchronously in another thread) and let it continue executing.
FMOD_RESULT System::unlockDSP();
FMOD_RESULT FMOD_System_UnlockDSP(FMOD_SYSTEM *system);
RESULT System.unlockDSP();
System.unlockDSP();
The DSP engine must be locked with System::lockDSP before this function is called.
Updates the FMOD system.
FMOD_RESULT System::update();
FMOD_RESULT FMOD_System_Update(FMOD_SYSTEM *system);
RESULT System.update();
System.update();
Should be called once per 'game' tick, or once per frame in your application to perform actions such as:
If FMOD_OUTPUTTYPE_NOSOUND_NRT or FMOD_OUTPUTTYPE_WAVWRITER_NRT output modes are used, this function also drives the software / DSP engine, instead of it running asynchronously in a thread as is the default behavior.
This can be used for faster than realtime updates to the decoding or DSP engine which might be useful if the output is the wav writer for example.
If FMOD_INIT_STREAM_FROM_UPDATE is used, this function will update the stream engine. Combining this with the non realtime output will mean smoother captured output.
See Also: System::init, FMOD_INITFLAGS, FMOD_OUTPUTTYPE, FMOD_MODE