//
// Generated by Brutal.Fmod.Generate; do not edit by hand.
#nullable enable
namespace Brutal.FmodApi
{
public static partial class Fmod
{
///
///
/// Closes and frees this object and its resources.
///
///
/// This will internally call System::close, so calling System::close before this function is not necessary.
///
///
/// See Also: System::init
///
///
/// System::release
///
///
public static Result TryRelease(this FmodSystem system) => PInvoke.SystemRelease(system);
///
///
/// Closes and frees this object and its resources.
///
///
/// This will internally call System::close, so calling System::close before this function is not necessary.
///
///
/// See Also: System::init
///
///
/// System::release
///
///
public static void Release(this FmodSystem system) => TryRelease(system).Check();
///
///
/// Sets the type of output interface used to run the mixer.
///
///
/// System::setOutput
///
///
public static Result TrySetOutput(this FmodSystem system, OutputType output) =>
PInvoke.SystemSetOutput(system, output);
///
///
/// Sets the type of output interface used to run the mixer.
///
///
/// System::setOutput
///
///
public static void SetOutput(this FmodSystem system, OutputType output) => TrySetOutput(system, output).Check();
///
///
/// Retrieves the type of output interface used to run the mixer.
///
///
/// System::getOutput
///
///
public static unsafe Result TryGetOutput(this FmodSystem system, out OutputType output)
{
fixed (OutputType* outputPtr = &output)
return PInvoke.SystemGetOutput(system, outputPtr);
}
///
///
/// Retrieves the type of output interface used to run the mixer.
///
///
/// System::getOutput
///
///
public static OutputType GetOutput(this FmodSystem system)
{
TryGetOutput(system, out var output).Check();
return output;
}
///
///
/// Retrieves the number of output drivers available for the selected output type.
///
///
/// System::getNumDrivers
///
///
public static unsafe Result TryGetNumDrivers(this FmodSystem system, out int numDrivers)
{
fixed (int* numDriversPtr = &numDrivers)
return PInvoke.SystemGetNumDrivers(system, numDriversPtr);
}
///
///
/// Retrieves the number of output drivers available for the selected output type.
///
///
/// System::getNumDrivers
///
///
public static int GetNumDrivers(this FmodSystem system)
{
TryGetNumDrivers(system, out var numDrivers).Check();
return numDrivers;
}
///
///
/// Retrieves identification information about a sound device specified by its index, and specific to the
/// selected output mode.
///
///
/// System::getDriverInfo
///
///
public static unsafe Result TryGetDriverInfo(
this FmodSystem system,
int id,
byte* name,
int nameLen,
out Guid guid,
out int systemRate,
out SpeakerMode speakerMode,
out int speakerModeChannels
)
{
fixed (Guid* guidPtr = &guid)
fixed (int* systemRatePtr = &systemRate)
fixed (SpeakerMode* speakerModePtr = &speakerMode)
fixed (int* speakerModeChannelsPtr = &speakerModeChannels)
return PInvoke.SystemGetDriverInfo(
system,
id,
name,
nameLen,
guidPtr,
systemRatePtr,
speakerModePtr,
speakerModeChannelsPtr
);
}
///
///
/// Retrieves identification information about a sound device specified by its index, and specific to the
/// selected output mode.
///
///
/// System::getDriverInfo
///
///
public static unsafe void GetDriverInfo(
this FmodSystem system,
int id,
byte* name,
int nameLen,
out Guid guid,
out int systemRate,
out SpeakerMode speakerMode,
out int speakerModeChannels
) =>
TryGetDriverInfo(
system,
id,
name,
nameLen,
out guid,
out systemRate,
out speakerMode,
out speakerModeChannels
)
.Check();
///
///
/// Sets the output driver for the selected output type.
///
///
/// System::setDriver
///
///
public static Result TrySetDriver(this FmodSystem system, int driver) =>
PInvoke.SystemSetDriver(system, driver);
///
///
/// Sets the output driver for the selected output type.
///
///
/// System::setDriver
///
///
public static void SetDriver(this FmodSystem system, int driver) => TrySetDriver(system, driver).Check();
///
///
/// Retrieves the output driver for the selected output type.
///
///
/// System::getDriver
///
///
public static unsafe Result TryGetDriver(this FmodSystem system, out int driver)
{
fixed (int* driverPtr = &driver)
return PInvoke.SystemGetDriver(system, driverPtr);
}
///
///
/// Retrieves the output driver for the selected output type.
///
///
/// System::getDriver
///
///
public static int GetDriver(this FmodSystem system)
{
TryGetDriver(system, out var driver).Check();
return driver;
}
///
///
/// Sets the maximum number of software mixed Channels possible.
///
///
/// System::setSoftwareChannels
///
///
public static Result TrySetSoftwareChannels(this FmodSystem system, int numSoftwareChannels) =>
PInvoke.SystemSetSoftwareChannels(system, numSoftwareChannels);
///
///
/// Sets the maximum number of software mixed Channels possible.
///
///
/// System::setSoftwareChannels
///
///
public static void SetSoftwareChannels(this FmodSystem system, int numSoftwareChannels) =>
TrySetSoftwareChannels(system, numSoftwareChannels).Check();
///
///
/// Retrieves the maximum number of software mixed Channels possible.
///
///
/// System::getSoftwareChannels
///
///
public static unsafe Result TryGetSoftwareChannels(this FmodSystem system, out int numSoftwareChannels)
{
fixed (int* numSoftwareChannelsPtr = &numSoftwareChannels)
return PInvoke.SystemGetSoftwareChannels(system, numSoftwareChannelsPtr);
}
///
///
/// Retrieves the maximum number of software mixed Channels possible.
///
///
/// System::getSoftwareChannels
///
///
public static int GetSoftwareChannels(this FmodSystem system)
{
TryGetSoftwareChannels(system, out var numSoftwareChannels).Check();
return numSoftwareChannels;
}
///
///
/// Sets the output format for the software mixer.
///
///
/// System::setSoftwareFormat
///
///
public static Result TrySetSoftwareFormat(
this FmodSystem system,
int sampleRate,
SpeakerMode speakerMode,
int numRawSpeakers
) => PInvoke.SystemSetSoftwareFormat(system, sampleRate, speakerMode, numRawSpeakers);
///
///
/// Sets the output format for the software mixer.
///
///
/// System::setSoftwareFormat
///
///
public static void SetSoftwareFormat(
this FmodSystem system,
int sampleRate,
SpeakerMode speakerMode,
int numRawSpeakers
) => TrySetSoftwareFormat(system, sampleRate, speakerMode, numRawSpeakers).Check();
///
///
/// Retrieves the output format for the software mixer.
///
///
/// System::getSoftwareFormat
///
///
public static unsafe Result TryGetSoftwareFormat(
this FmodSystem system,
out int sampleRate,
out SpeakerMode speakerMode,
out int numRawSpeakers
)
{
fixed (int* sampleRatePtr = &sampleRate)
fixed (SpeakerMode* speakerModePtr = &speakerMode)
fixed (int* numRawSpeakersPtr = &numRawSpeakers)
return PInvoke.SystemGetSoftwareFormat(system, sampleRatePtr, speakerModePtr, numRawSpeakersPtr);
}
///
///
/// Retrieves the output format for the software mixer.
///
///
/// System::getSoftwareFormat
///
///
public static void GetSoftwareFormat(
this FmodSystem system,
out int sampleRate,
out SpeakerMode speakerMode,
out int numRawSpeakers
) => TryGetSoftwareFormat(system, out sampleRate, out speakerMode, out numRawSpeakers).Check();
///
///
/// 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.
///
///
/// System::setDSPBufferSize
///
///
public static Result TrySetDspBufferSize(this FmodSystem system, uint bufferLength, int numBuffers) =>
PInvoke.SystemSetDspBufferSize(system, bufferLength, numBuffers);
///
///
/// 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.
///
///
/// System::setDSPBufferSize
///
///
public static void SetDspBufferSize(this FmodSystem system, uint bufferLength, int numBuffers) =>
TrySetDspBufferSize(system, bufferLength, numBuffers).Check();
///
///
/// Retrieves the buffer size settings for the FMOD software mixing engine.
///
///
/// System::getDSPBufferSize
///
///
public static unsafe Result TryGetDspBufferSize(
this FmodSystem system,
out uint bufferLength,
out int numBuffers
)
{
fixed (uint* bufferLengthPtr = &bufferLength)
fixed (int* numBuffersPtr = &numBuffers)
return PInvoke.SystemGetDspBufferSize(system, bufferLengthPtr, numBuffersPtr);
}
///
///
/// Retrieves the buffer size settings for the FMOD software mixing engine.
///
///
/// System::getDSPBufferSize
///
///
public static void GetDspBufferSize(this FmodSystem system, out uint bufferLength, out int numBuffers) =>
TryGetDspBufferSize(system, out bufferLength, out numBuffers).Check();
///
///
/// Set callbacks to implement all file I/O instead of using the platform native method.
///
///
/// System::setFileSystem
///
///
public static Result TrySetFileSystem(
this FmodSystem system,
FileOpenCallbackPtr userOpen,
FileCloseCallbackPtr userClose,
FileReadCallbackPtr userRead,
FileSeekCallbackPtr userSeek,
FileAsyncReadCallbackPtr userAsyncRead,
FileAsyncCancelCallbackPtr userAsyncCancel,
int blockAlign
) =>
PInvoke.SystemSetFileSystem(
system,
userOpen,
userClose,
userRead,
userSeek,
userAsyncRead,
userAsyncCancel,
blockAlign
);
///
///
/// Set callbacks to implement all file I/O instead of using the platform native method.
///
///
/// System::setFileSystem
///
///
public static void SetFileSystem(
this FmodSystem system,
FileOpenCallbackPtr userOpen,
FileCloseCallbackPtr userClose,
FileReadCallbackPtr userRead,
FileSeekCallbackPtr userSeek,
FileAsyncReadCallbackPtr userAsyncRead,
FileAsyncCancelCallbackPtr userAsyncCancel,
int blockAlign
) =>
TrySetFileSystem(
system,
userOpen,
userClose,
userRead,
userSeek,
userAsyncRead,
userAsyncCancel,
blockAlign
)
.Check();
///
///
/// '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).
///
///
/// System::attachFileSystem
///
///
public static Result TryAttachFileSystem(
this FmodSystem system,
FileOpenCallbackPtr userOpen,
FileCloseCallbackPtr userClose,
FileReadCallbackPtr userRead,
FileSeekCallbackPtr userSeek
) => PInvoke.SystemAttachFileSystem(system, userOpen, userClose, userRead, userSeek);
///
///
/// '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).
///
///
/// System::attachFileSystem
///
///
public static void AttachFileSystem(
this FmodSystem system,
FileOpenCallbackPtr userOpen,
FileCloseCallbackPtr userClose,
FileReadCallbackPtr userRead,
FileSeekCallbackPtr userSeek
) => TryAttachFileSystem(system, userOpen, userClose, userRead, userSeek).Check();
///
///
/// Sets advanced settings for the system object, typically to allow adjusting of settings related to
/// resource usage or audio quality.
///
///
/// System::setAdvancedSettings
///
///
public static unsafe Result TrySetAdvancedSettings(this FmodSystem system, in AdvancedSettings settings)
{
fixed (AdvancedSettings* settingsPtr = &settings)
return PInvoke.SystemSetAdvancedSettings(system, settingsPtr);
}
///
///
/// Sets advanced settings for the system object, typically to allow adjusting of settings related to
/// resource usage or audio quality.
///
///
/// System::setAdvancedSettings
///
///
public static void SetAdvancedSettings(this FmodSystem system, in AdvancedSettings settings) =>
TrySetAdvancedSettings(system, settings).Check();
///
///
/// Retrieves the advanced settings for the system object.
///
///
/// System::getAdvancedSettings
///
///
public static unsafe Result TryGetAdvancedSettings(this FmodSystem system, out AdvancedSettings settings)
{
fixed (AdvancedSettings* settingsPtr = &settings)
return PInvoke.SystemGetAdvancedSettings(system, settingsPtr);
}
///
///
/// Retrieves the advanced settings for the system object.
///
///
/// System::getAdvancedSettings
///
///
public static AdvancedSettings GetAdvancedSettings(this FmodSystem system)
{
TryGetAdvancedSettings(system, out var settings).Check();
return settings;
}
///
///
/// Sets the callback for System level notifications.
///
///
/// System::setCallback
///
///
public static Result TrySetCallback(
this FmodSystem system,
SystemCallbackPtr callback,
SystemCallbackType callbackMask
) => PInvoke.SystemSetCallback(system, callback, callbackMask);
///
///
/// Sets the callback for System level notifications.
///
///
/// System::setCallback
///
///
public static void SetCallback(
this FmodSystem system,
SystemCallbackPtr callback,
SystemCallbackType callbackMask
) => TrySetCallback(system, callback, callbackMask).Check();
///
///
/// Specify a base search path for plug-ins so they can be placed somewhere else than the directory of the
/// main executable.
///
///
/// System::setPluginPath
///
///
public static unsafe Result TrySetPluginPath(this FmodSystem system, RefString8 path)
{
fixed (byte* pathPtr = path)
return PInvoke.SystemSetPluginPath(system, pathPtr);
}
///
///
/// Specify a base search path for plug-ins so they can be placed somewhere else than the directory of the
/// main executable.
///
///
/// System::setPluginPath
///
///
public static void SetPluginPath(this FmodSystem system, RefString8 path) =>
TrySetPluginPath(system, path).Check();
///
///
/// Loads an FMOD plug-in (DSP, output or codec) from a file.
///
///
/// System::loadPlugin
///
///
public static unsafe Result TryLoadPlugin(
this FmodSystem system,
RefString8 fileName,
out uint handle,
uint priority
)
{
fixed (byte* fileNamePtr = fileName)
fixed (uint* handlePtr = &handle)
return PInvoke.SystemLoadPlugin(system, fileNamePtr, handlePtr, priority);
}
///
///
/// Loads an FMOD plug-in (DSP, output or codec) from a file.
///
///
/// System::loadPlugin
///
///
public static uint LoadPlugin(this FmodSystem system, RefString8 fileName, uint priority)
{
TryLoadPlugin(system, fileName, out var handle, priority).Check();
return handle;
}
///
///
/// Unloads an FMOD (DSP, Output or Codec) plug-in.
///
///
/// System::unloadPlugin
///
///
public static Result TryUnloadPlugin(this FmodSystem system, uint handle) =>
PInvoke.SystemUnloadPlugin(system, handle);
///
///
/// Unloads an FMOD (DSP, Output or Codec) plug-in.
///
///
/// System::unloadPlugin
///
///
public static void UnloadPlugin(this FmodSystem system, uint handle) => TryUnloadPlugin(system, handle).Check();
///
///
/// Retrieves the number of nested plug-ins from the selected plug-in.
///
///
/// System::getNumNestedPlugins
///
///
public static unsafe Result TryGetNumNestedPlugins(this FmodSystem system, uint handle, out int count)
{
fixed (int* countPtr = &count)
return PInvoke.SystemGetNumNestedPlugins(system, handle, countPtr);
}
///
///
/// Retrieves the number of nested plug-ins from the selected plug-in.
///
///
/// System::getNumNestedPlugins
///
///
public static int GetNumNestedPlugins(this FmodSystem system, uint handle)
{
TryGetNumNestedPlugins(system, handle, out var count).Check();
return count;
}
///
///
/// Retrieves the handle of a nested plug-in.
///
///
/// System::getNestedPlugin
///
///
public static unsafe Result TryGetNestedPlugin(
this FmodSystem system,
uint handle,
int index,
out uint nestedHandle
)
{
fixed (uint* nestedHandlePtr = &nestedHandle)
return PInvoke.SystemGetNestedPlugin(system, handle, index, nestedHandlePtr);
}
///
///
/// Retrieves the handle of a nested plug-in.
///
///
/// System::getNestedPlugin
///
///
public static uint GetNestedPlugin(this FmodSystem system, uint handle, int index)
{
TryGetNestedPlugin(system, handle, index, out var nestedHandle).Check();
return nestedHandle;
}
///
///
/// Retrieves the number of loaded plug-ins.
///
///
/// System::getNumPlugins
///
///
public static unsafe Result TryGetNumPlugins(this FmodSystem system, PluginType pluginType, out int numPlugins)
{
fixed (int* numPluginsPtr = &numPlugins)
return PInvoke.SystemGetNumPlugins(system, pluginType, numPluginsPtr);
}
///
///
/// Retrieves the number of loaded plug-ins.
///
///
/// System::getNumPlugins
///
///
public static int GetNumPlugins(this FmodSystem system, PluginType pluginType)
{
TryGetNumPlugins(system, pluginType, out var numPlugins).Check();
return numPlugins;
}
///
///
/// Retrieves the handle of a plug-in based on its type and relative index.
///
///
/// System::getPluginHandle
///
///
public static unsafe Result TryGetPluginHandle(
this FmodSystem system,
PluginType pluginType,
int index,
out uint handle
)
{
fixed (uint* handlePtr = &handle)
return PInvoke.SystemGetPluginHandle(system, pluginType, index, handlePtr);
}
///
///
/// Retrieves the handle of a plug-in based on its type and relative index.
///
///
/// System::getPluginHandle
///
///
public static uint GetPluginHandle(this FmodSystem system, PluginType pluginType, int index)
{
TryGetPluginHandle(system, pluginType, index, out var handle).Check();
return handle;
}
///
///
/// Retrieves information for the selected plug-in.
///
///
/// System::getPluginInfo
///
///
public static unsafe Result TryGetPluginInfo(
this FmodSystem system,
uint handle,
out PluginType pluginType,
byte* name,
int nameLen,
out uint version
)
{
fixed (PluginType* pluginTypePtr = &pluginType)
fixed (uint* versionPtr = &version)
return PInvoke.SystemGetPluginInfo(system, handle, pluginTypePtr, name, nameLen, versionPtr);
}
///
///
/// Retrieves information for the selected plug-in.
///
///
/// System::getPluginInfo
///
///
public static unsafe void GetPluginInfo(
this FmodSystem system,
uint handle,
out PluginType pluginType,
byte* name,
int nameLen,
out uint version
) => TryGetPluginInfo(system, handle, out pluginType, name, nameLen, out version).Check();
///
///
/// Selects an output type given a plug-in handle.
///
///
/// System::setOutputByPlugin
///
///
public static Result TrySetOutputByPlugin(this FmodSystem system, uint handle) =>
PInvoke.SystemSetOutputByPlugin(system, handle);
///
///
/// Selects an output type given a plug-in handle.
///
///
/// System::setOutputByPlugin
///
///
public static void SetOutputByPlugin(this FmodSystem system, uint handle) =>
TrySetOutputByPlugin(system, handle).Check();
///
///
/// Retrieves the plug-in handle for the currently selected output type.
///
///
/// System::getOutputByPlugin
///
///
public static unsafe Result TryGetOutputByPlugin(this FmodSystem system, out uint handle)
{
fixed (uint* handlePtr = &handle)
return PInvoke.SystemGetOutputByPlugin(system, handlePtr);
}
///
///
/// Retrieves the plug-in handle for the currently selected output type.
///
///
/// System::getOutputByPlugin
///
///
public static uint GetOutputByPlugin(this FmodSystem system)
{
TryGetOutputByPlugin(system, out var handle).Check();
return handle;
}
///
///
/// Create a DSP unit with a specified plug-in handle.
///
///
/// System::createDSPByPlugin
///
///
public static unsafe Result TryCreateDspByPlugin(this FmodSystem system, uint handle, out Dsp dsp)
{
fixed (Dsp* dspPtr = &dsp)
return PInvoke.SystemCreateDspByPlugin(system, handle, dspPtr);
}
///
///
/// Create a DSP unit with a specified plug-in handle.
///
///
/// System::createDSPByPlugin
///
///
public static Dsp CreateDspByPlugin(this FmodSystem system, uint handle)
{
TryCreateDspByPlugin(system, handle, out var dsp).Check();
return dsp;
}
///
///
/// Retrieve the description structure for a pre-existing DSP plug-in.
///
///
/// System::getDSPInfoByPlugin
///
///
public static unsafe Result TryGetDspInfoByPlugin(
this FmodSystem system,
uint handle,
out DspDescription* description
)
{
fixed (DspDescription** descriptionPtr = &description)
return PInvoke.SystemGetDspInfoByPlugin(system, handle, descriptionPtr);
}
///
///
/// Retrieve the description structure for a pre-existing DSP plug-in.
///
///
/// System::getDSPInfoByPlugin
///
///
public static unsafe DspDescription* GetDspInfoByPlugin(this FmodSystem system, uint handle)
{
TryGetDspInfoByPlugin(system, handle, out var description).Check();
return description;
}
///
///
/// Register a Codec plug-in description structure for later use.
///
///
/// System::registerCodec
///
///
public static unsafe Result TryRegisterCodec(
this FmodSystem system,
out CodecDescription description,
out uint handle,
uint priority
)
{
fixed (CodecDescription* descriptionPtr = &description)
fixed (uint* handlePtr = &handle)
return PInvoke.SystemRegisterCodec(system, descriptionPtr, handlePtr, priority);
}
///
///
/// Register a Codec plug-in description structure for later use.
///
///
/// System::registerCodec
///
///
public static void RegisterCodec(
this FmodSystem system,
out CodecDescription description,
out uint handle,
uint priority
) => TryRegisterCodec(system, out description, out handle, priority).Check();
///
///
/// Register a DSP plug-in description structure for later use.
///
///
/// System::registerDSP
///
///
public static unsafe Result TryRegisterDsp(
this FmodSystem system,
in DspDescription description,
out uint handle
)
{
fixed (DspDescription* descriptionPtr = &description)
fixed (uint* handlePtr = &handle)
return PInvoke.SystemRegisterDsp(system, descriptionPtr, handlePtr);
}
///
///
/// Register a DSP plug-in description structure for later use.
///
///
/// System::registerDSP
///
///
public static uint RegisterDsp(this FmodSystem system, in DspDescription description)
{
TryRegisterDsp(system, description, out var handle).Check();
return handle;
}
///
///
/// Register an Output plug-in description structure for later use.
///
///
/// System::registerOutput
///
///
public static unsafe Result TryRegisterOutput(
this FmodSystem system,
in OutputDescription description,
out uint handle
)
{
fixed (OutputDescription* descriptionPtr = &description)
fixed (uint* handlePtr = &handle)
return PInvoke.SystemRegisterOutput(system, descriptionPtr, handlePtr);
}
///
///
/// Register an Output plug-in description structure for later use.
///
///
/// System::registerOutput
///
///
public static uint RegisterOutput(this FmodSystem system, in OutputDescription description)
{
TryRegisterOutput(system, description, out var handle).Check();
return handle;
}
///
///
/// Initialize the system object and prepare FMOD for playback.
///
///
/// System::init
///
///
public static Result TryInit(this FmodSystem system, int maxChannels, InitFlags flags, nint extraDriverData) =>
PInvoke.SystemInit(system, maxChannels, flags, extraDriverData);
///
///
/// Initialize the system object and prepare FMOD for playback.
///
///
/// System::init
///
///
public static void Init(this FmodSystem system, int maxChannels, InitFlags flags, nint extraDriverData) =>
TryInit(system, maxChannels, flags, extraDriverData).Check();
///
///
/// Close the connection to the output and return to an uninitialized state without releasing the object.
///
///
/// 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
///
///
/// System::close
///
///
public static Result TryClose(this FmodSystem system) => PInvoke.SystemClose(system);
///
///
/// Close the connection to the output and return to an uninitialized state without releasing the object.
///
///
/// 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
///
///
/// System::close
///
///
public static void Close(this FmodSystem system) => TryClose(system).Check();
///
///
/// Updates the FMOD system.
///
///
/// 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
///
///
/// System::update
///
///
public static Result TryUpdate(this FmodSystem system) => PInvoke.SystemUpdate(system);
///
///
/// Updates the FMOD system.
///
///
/// 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
///
///
/// System::update
///
///
public static void Update(this FmodSystem system) => TryUpdate(system).Check();
///
///
/// 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.
///
///
/// System::setSpeakerPosition
///
///
public static Result TrySetSpeakerPosition(
this FmodSystem system,
Speaker speaker,
float x,
float y,
Bool32 active
) => PInvoke.SystemSetSpeakerPosition(system, speaker, x, y, active);
///
///
/// 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.
///
///
/// System::setSpeakerPosition
///
///
public static void SetSpeakerPosition(
this FmodSystem system,
Speaker speaker,
float x,
float y,
Bool32 active
) => TrySetSpeakerPosition(system, speaker, x, y, active).Check();
///
///
/// Retrieves the position of the specified speaker for the current speaker mode.
///
///
/// System::getSpeakerPosition
///
///
public static unsafe Result TryGetSpeakerPosition(
this FmodSystem system,
Speaker speaker,
out float x,
out float y,
out Bool32 active
)
{
fixed (float* xPtr = &x)
fixed (float* yPtr = &y)
fixed (Bool32* activePtr = &active)
return PInvoke.SystemGetSpeakerPosition(system, speaker, xPtr, yPtr, activePtr);
}
///
///
/// Retrieves the position of the specified speaker for the current speaker mode.
///
///
/// System::getSpeakerPosition
///
///
public static void GetSpeakerPosition(
this FmodSystem system,
Speaker speaker,
out float x,
out float y,
out Bool32 active
) => TryGetSpeakerPosition(system, speaker, out x, out y, out active).Check();
///
///
/// Sets the default file buffer size for newly opened streams.
///
///
/// System::setStreamBufferSize
///
///
public static Result TrySetStreamBufferSize(
this FmodSystem system,
uint fileBufferSize,
TimeUnit fileBufferSizeType
) => PInvoke.SystemSetStreamBufferSize(system, fileBufferSize, fileBufferSizeType);
///
///
/// Sets the default file buffer size for newly opened streams.
///
///
/// System::setStreamBufferSize
///
///
public static void SetStreamBufferSize(
this FmodSystem system,
uint fileBufferSize,
TimeUnit fileBufferSizeType
) => TrySetStreamBufferSize(system, fileBufferSize, fileBufferSizeType).Check();
///
///
/// Retrieves the default file buffer size for newly opened streams.
///
///
/// System::getStreamBufferSize
///
///
public static unsafe Result TryGetStreamBufferSize(
this FmodSystem system,
out uint fileBufferSize,
out TimeUnit fileBufferSizeType
)
{
fixed (uint* fileBufferSizePtr = &fileBufferSize)
fixed (TimeUnit* fileBufferSizeTypePtr = &fileBufferSizeType)
return PInvoke.SystemGetStreamBufferSize(system, fileBufferSizePtr, fileBufferSizeTypePtr);
}
///
///
/// Retrieves the default file buffer size for newly opened streams.
///
///
/// System::getStreamBufferSize
///
///
public static void GetStreamBufferSize(
this FmodSystem system,
out uint fileBufferSize,
out TimeUnit fileBufferSizeType
) => TryGetStreamBufferSize(system, out fileBufferSize, out fileBufferSizeType).Check();
///
///
/// Sets the global doppler scale, distance factor and log roll-off scale for all 3D sound in FMOD.
///
///
/// System::set3DSettings
///
///
public static Result TrySet3dSettings(
this FmodSystem system,
float dopplerScale,
float distanceFactor,
float rolloffScale
) => PInvoke.SystemSet3dSettings(system, dopplerScale, distanceFactor, rolloffScale);
///
///
/// Sets the global doppler scale, distance factor and log roll-off scale for all 3D sound in FMOD.
///
///
/// System::set3DSettings
///
///
public static void Set3dSettings(
this FmodSystem system,
float dopplerScale,
float distanceFactor,
float rolloffScale
) => TrySet3dSettings(system, dopplerScale, distanceFactor, rolloffScale).Check();
///
///
/// Retrieves the global doppler scale, distance factor and roll-off scale for all 3D sounds.
///
///
/// System::get3DSettings
///
///
public static unsafe Result TryGet3dSettings(
this FmodSystem system,
out float dopplerScale,
out float distanceFactor,
out float rolloffScale
)
{
fixed (float* dopplerScalePtr = &dopplerScale)
fixed (float* distanceFactorPtr = &distanceFactor)
fixed (float* rolloffScalePtr = &rolloffScale)
return PInvoke.SystemGet3dSettings(system, dopplerScalePtr, distanceFactorPtr, rolloffScalePtr);
}
///
///
/// Retrieves the global doppler scale, distance factor and roll-off scale for all 3D sounds.
///
///
/// System::get3DSettings
///
///
public static void Get3dSettings(
this FmodSystem system,
out float dopplerScale,
out float distanceFactor,
out float rolloffScale
) => TryGet3dSettings(system, out dopplerScale, out distanceFactor, out rolloffScale).Check();
///
///
/// Sets the number of 3D 'listeners' in the 3D sound scene.
///
///
/// System::set3DNumListeners
///
///
public static Result TrySet3dNumListeners(this FmodSystem system, int numListeners) =>
PInvoke.SystemSet3dNumListeners(system, numListeners);
///
///
/// Sets the number of 3D 'listeners' in the 3D sound scene.
///
///
/// System::set3DNumListeners
///
///
public static void Set3dNumListeners(this FmodSystem system, int numListeners) =>
TrySet3dNumListeners(system, numListeners).Check();
///
///
/// Retrieves the number of 3D listeners.
///
///
/// System::get3DNumListeners
///
///
public static unsafe Result TryGet3dNumListeners(this FmodSystem system, out int numListeners)
{
fixed (int* numListenersPtr = &numListeners)
return PInvoke.SystemGet3dNumListeners(system, numListenersPtr);
}
///
///
/// Retrieves the number of 3D listeners.
///
///
/// System::get3DNumListeners
///
///
public static int Get3dNumListeners(this FmodSystem system)
{
TryGet3dNumListeners(system, out var numListeners).Check();
return numListeners;
}
///
///
/// Sets the position, velocity and orientation of the specified 3D sound listener.
///
///
/// System::set3DListenerAttributes
///
///
public static unsafe Result TrySet3dListenerAttributes(
this FmodSystem system,
int listener,
in float3 pos,
in float3 vel,
in float3 forward,
in float3 up
)
{
fixed (float3* posPtr = &pos)
fixed (float3* velPtr = &vel)
fixed (float3* forwardPtr = &forward)
fixed (float3* upPtr = &up)
return PInvoke.SystemSet3dListenerAttributes(system, listener, posPtr, velPtr, forwardPtr, upPtr);
}
///
///
/// Sets the position, velocity and orientation of the specified 3D sound listener.
///
///
/// System::set3DListenerAttributes
///
///
public static void Set3dListenerAttributes(
this FmodSystem system,
int listener,
in float3 pos,
in float3 vel,
in float3 forward,
in float3 up
) => TrySet3dListenerAttributes(system, listener, pos, vel, forward, up).Check();
///
///
/// Retrieves the position, velocity and orientation of the specified 3D sound listener.
///
///
/// System::get3DListenerAttributes
///
///
public static unsafe Result TryGet3dListenerAttributes(
this FmodSystem system,
int listener,
out float3 pos,
out float3 vel,
out float3 forward,
out float3 up
)
{
fixed (float3* posPtr = &pos)
fixed (float3* velPtr = &vel)
fixed (float3* forwardPtr = &forward)
fixed (float3* upPtr = &up)
return PInvoke.SystemGet3dListenerAttributes(system, listener, posPtr, velPtr, forwardPtr, upPtr);
}
///
///
/// Retrieves the position, velocity and orientation of the specified 3D sound listener.
///
///
/// System::get3DListenerAttributes
///
///
public static void Get3dListenerAttributes(
this FmodSystem system,
int listener,
out float3 pos,
out float3 vel,
out float3 forward,
out float3 up
) => TryGet3dListenerAttributes(system, listener, out pos, out vel, out forward, out up).Check();
///
///
/// Sets a callback to allow custom calculation of distance attenuation.
///
///
/// System::set3DRolloffCallback
///
///
public static Result TrySet3dRolloffCallback(this FmodSystem system, Rolloff3dCallbackPtr callback) =>
PInvoke.SystemSet3dRolloffCallback(system, callback);
///
///
/// Sets a callback to allow custom calculation of distance attenuation.
///
///
/// System::set3DRolloffCallback
///
///
public static void Set3dRolloffCallback(this FmodSystem system, Rolloff3dCallbackPtr callback) =>
TrySet3dRolloffCallback(system, callback).Check();
///
///
/// Suspend mixer thread and relinquish usage of audio hardware while maintaining internal state.
///
///
/// 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
///
///
/// System::mixerSuspend
///
///
public static Result TryMixerSuspend(this FmodSystem system) => PInvoke.SystemMixerSuspend(system);
///
///
/// Suspend mixer thread and relinquish usage of audio hardware while maintaining internal state.
///
///
/// 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
///
///
/// System::mixerSuspend
///
///
public static void MixerSuspend(this FmodSystem system) => TryMixerSuspend(system).Check();
///
///
/// Resume mixer thread and reacquire access to audio hardware.
///
///
/// 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
///
///
/// System::mixerResume
///
///
public static Result TryMixerResume(this FmodSystem system) => PInvoke.SystemMixerResume(system);
///
///
/// Resume mixer thread and reacquire access to audio hardware.
///
///
/// 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
///
///
/// System::mixerResume
///
///
public static void MixerResume(this FmodSystem system) => TryMixerResume(system).Check();
///
///
/// Retrieves the default matrix used to convert from one speaker mode to another.
///
///
/// System::getDefaultMixMatrix
///
///
public static unsafe Result TryGetDefaultMixMatrix(
this FmodSystem system,
SpeakerMode sourceSpeakerMode,
SpeakerMode targetSpeakerMode,
float* matrix,
int matrixHop
) => PInvoke.SystemGetDefaultMixMatrix(system, sourceSpeakerMode, targetSpeakerMode, matrix, matrixHop);
///
///
/// Retrieves the default matrix used to convert from one speaker mode to another.
///
///
/// System::getDefaultMixMatrix
///
///
public static unsafe void GetDefaultMixMatrix(
this FmodSystem system,
SpeakerMode sourceSpeakerMode,
SpeakerMode targetSpeakerMode,
float* matrix,
int matrixHop
) => TryGetDefaultMixMatrix(system, sourceSpeakerMode, targetSpeakerMode, matrix, matrixHop).Check();
///
///
/// Retrieves the channel count for a given speaker mode.
///
///
/// System::getSpeakerModeChannels
///
///
public static unsafe Result TryGetSpeakerModeChannels(
this FmodSystem system,
SpeakerMode mode,
out int channels
)
{
fixed (int* channelsPtr = &channels)
return PInvoke.SystemGetSpeakerModeChannels(system, mode, channelsPtr);
}
///
///
/// Retrieves the channel count for a given speaker mode.
///
///
/// System::getSpeakerModeChannels
///
///
public static int GetSpeakerModeChannels(this FmodSystem system, SpeakerMode mode)
{
TryGetSpeakerModeChannels(system, mode, out var channels).Check();
return channels;
}
///
///
/// Retrieves the FMOD version and build number.
///
///
/// System::getVersion
///
///
public static unsafe Result TryGetVersion(this FmodSystem system, out uint version, out uint buildnumber)
{
fixed (uint* versionPtr = &version)
fixed (uint* buildnumberPtr = &buildnumber)
return PInvoke.SystemGetVersion(system, versionPtr, buildnumberPtr);
}
///
///
/// Retrieves the FMOD version and build number.
///
///
/// System::getVersion
///
///
public static void GetVersion(this FmodSystem system, out uint version, out uint buildnumber) =>
TryGetVersion(system, out version, out buildnumber).Check();
///
///
/// Retrieves an output type specific internal native interface.
///
///
/// System::getOutputHandle
///
///
public static unsafe Result TryGetOutputHandle(this FmodSystem system, out nint handle)
{
fixed (nint* handlePtr = &handle)
return PInvoke.SystemGetOutputHandle(system, handlePtr);
}
///
///
/// Retrieves an output type specific internal native interface.
///
///
/// System::getOutputHandle
///
///
public static nint GetOutputHandle(this FmodSystem system)
{
TryGetOutputHandle(system, out var handle).Check();
return handle;
}
///
///
/// Retrieves the number of currently playing Channels.
///
///
/// System::getChannelsPlaying
///
///
public static unsafe Result TryGetChannelsPlaying(
this FmodSystem system,
out int channels,
out int realChannels
)
{
fixed (int* channelsPtr = &channels)
fixed (int* realChannelsPtr = &realChannels)
return PInvoke.SystemGetChannelsPlaying(system, channelsPtr, realChannelsPtr);
}
///
///
/// Retrieves the number of currently playing Channels.
///
///
/// System::getChannelsPlaying
///
///
public static void GetChannelsPlaying(this FmodSystem system, out int channels, out int realChannels) =>
TryGetChannelsPlaying(system, out channels, out realChannels).Check();
///
///
/// Retrieves the amount of CPU used for different parts of the Core API.
///
///
/// System::getCPUUsage
///
///
public static unsafe Result TryGetCpuUsage(this FmodSystem system, out CpuUsage usage)
{
fixed (CpuUsage* usagePtr = &usage)
return PInvoke.SystemGetCpuUsage(system, usagePtr);
}
///
///
/// Retrieves the amount of CPU used for different parts of the Core API.
///
///
/// System::getCPUUsage
///
///
public static CpuUsage GetCpuUsage(this FmodSystem system)
{
TryGetCpuUsage(system, out var usage).Check();
return usage;
}
///
///
/// Retrieves information about file reads.
///
///
/// System::getFileUsage
///
///
public static unsafe Result TryGetFileUsage(
this FmodSystem system,
out long sampleBytesRead,
out long streamBytesRead,
out long otherBytesRead
)
{
fixed (long* sampleBytesReadPtr = &sampleBytesRead)
fixed (long* streamBytesReadPtr = &streamBytesRead)
fixed (long* otherBytesReadPtr = &otherBytesRead)
return PInvoke.SystemGetFileUsage(system, sampleBytesReadPtr, streamBytesReadPtr, otherBytesReadPtr);
}
///
///
/// Retrieves information about file reads.
///
///
/// System::getFileUsage
///
///
public static void GetFileUsage(
this FmodSystem system,
out long sampleBytesRead,
out long streamBytesRead,
out long otherBytesRead
) => TryGetFileUsage(system, out sampleBytesRead, out streamBytesRead, out otherBytesRead).Check();
///
///
/// Loads a sound into memory, opens it for streaming or sets it up for callback based sounds.
///
///
/// System::createSound
///
///
public static unsafe Result TryCreateSound(
this FmodSystem system,
RefString8 nameOrData,
Mode mode,
in CreateSoundExInfo exInfo,
out Sound sound
)
{
fixed (byte* nameOrDataPtr = nameOrData)
fixed (CreateSoundExInfo* exInfoPtr = &exInfo)
fixed (Sound* soundPtr = &sound)
return PInvoke.SystemCreateSound(system, nameOrDataPtr, mode, exInfoPtr, soundPtr);
}
///
///
/// Loads a sound into memory, opens it for streaming or sets it up for callback based sounds.
///
///
/// System::createSound
///
///
public static Sound CreateSound(
this FmodSystem system,
RefString8 nameOrData,
Mode mode,
in CreateSoundExInfo exInfo
)
{
TryCreateSound(system, nameOrData, mode, exInfo, out var sound).Check();
return sound;
}
///
///
/// Opens a sound for streaming.
///
///
/// System::createStream
///
///
public static unsafe Result TryCreateStream(
this FmodSystem system,
RefString8 nameOrData,
Mode mode,
in CreateSoundExInfo exInfo,
out Sound sound
)
{
fixed (byte* nameOrDataPtr = nameOrData)
fixed (CreateSoundExInfo* exInfoPtr = &exInfo)
fixed (Sound* soundPtr = &sound)
return PInvoke.SystemCreateStream(system, nameOrDataPtr, mode, exInfoPtr, soundPtr);
}
///
///
/// Opens a sound for streaming.
///
///
/// System::createStream
///
///
public static Sound CreateStream(
this FmodSystem system,
RefString8 nameOrData,
Mode mode,
in CreateSoundExInfo exInfo
)
{
TryCreateStream(system, nameOrData, mode, exInfo, out var sound).Check();
return sound;
}
///
///
/// Create a DSP unit given a plug-in description structure.
///
///
/// System::createDSP
///
///
public static unsafe Result TryCreateDsp(this FmodSystem system, in DspDescription description, out Dsp dsp)
{
fixed (DspDescription* descriptionPtr = &description)
fixed (Dsp* dspPtr = &dsp)
return PInvoke.SystemCreateDsp(system, descriptionPtr, dspPtr);
}
///
///
/// Create a DSP unit given a plug-in description structure.
///
///
/// System::createDSP
///
///
public static Dsp CreateDsp(this FmodSystem system, in DspDescription description)
{
TryCreateDsp(system, description, out var dsp).Check();
return dsp;
}
///
///
/// Create a DSP unit with a specified built-in type index.
///
///
/// System::createDSPByType
///
///
public static unsafe Result TryCreateDspByType(this FmodSystem system, DspType type, out Dsp dsp)
{
fixed (Dsp* dspPtr = &dsp)
return PInvoke.SystemCreateDspByType(system, type, dspPtr);
}
///
///
/// Create a DSP unit with a specified built-in type index.
///
///
/// System::createDSPByType
///
///
public static Dsp CreateDspByType(this FmodSystem system, DspType type)
{
TryCreateDspByType(system, type, out var dsp).Check();
return dsp;
}
///
///
/// Create a ChannelGroup object.
///
///
/// System::createChannelGroup
///
///
public static unsafe Result TryCreateChannelGroup(
this FmodSystem system,
RefString8 name,
out ChannelGroup channelGroup
)
{
fixed (byte* namePtr = name)
fixed (ChannelGroup* channelGroupPtr = &channelGroup)
return PInvoke.SystemCreateChannelGroup(system, namePtr, channelGroupPtr);
}
///
///
/// Create a ChannelGroup object.
///
///
/// System::createChannelGroup
///
///
public static ChannelGroup CreateChannelGroup(this FmodSystem system, RefString8 name)
{
TryCreateChannelGroup(system, name, out var channelGroup).Check();
return channelGroup;
}
///
///
/// Creates a SoundGroup object.
///
///
/// System::createSoundGroup
///
///
public static unsafe Result TryCreateSoundGroup(
this FmodSystem system,
RefString8 name,
out SoundGroup soundGroup
)
{
fixed (byte* namePtr = name)
fixed (SoundGroup* soundGroupPtr = &soundGroup)
return PInvoke.SystemCreateSoundGroup(system, namePtr, soundGroupPtr);
}
///
///
/// Creates a SoundGroup object.
///
///
/// System::createSoundGroup
///
///
public static SoundGroup CreateSoundGroup(this FmodSystem system, RefString8 name)
{
TryCreateSoundGroup(system, name, out var soundGroup).Check();
return soundGroup;
}
///
///
/// 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).
///
///
/// System::createReverb3D
///
///
public static unsafe Result TryCreateReverb3d(this FmodSystem system, out Reverb3d reverb)
{
fixed (Reverb3d* reverbPtr = &reverb)
return PInvoke.SystemCreateReverb3d(system, reverbPtr);
}
///
///
/// 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).
///
///
/// System::createReverb3D
///
///
public static Reverb3d CreateReverb3d(this FmodSystem system)
{
TryCreateReverb3d(system, out var reverb).Check();
return reverb;
}
///
///
/// Plays a Sound on a Channel.
///
///
/// System::playSound
///
///
public static unsafe Result TryPlaySound(
this FmodSystem system,
Sound sound,
ChannelGroup channelGroup,
Bool32 paused,
out Channel channel
)
{
fixed (Channel* channelPtr = &channel)
return PInvoke.SystemPlaySound(system, sound, channelGroup, paused, channelPtr);
}
///
///
/// Plays a Sound on a Channel.
///
///
/// System::playSound
///
///
public static Channel PlaySound(this FmodSystem system, Sound sound, ChannelGroup channelGroup, Bool32 paused)
{
TryPlaySound(system, sound, channelGroup, paused, out var channel).Check();
return channel;
}
///
///
/// Plays a DSP along with any of its inputs on a Channel.
///
///
/// System::playDSP
///
///
public static unsafe Result TryPlayDsp(
this FmodSystem system,
Dsp dsp,
ChannelGroup channelGroup,
Bool32 paused,
out Channel channel
)
{
fixed (Channel* channelPtr = &channel)
return PInvoke.SystemPlayDsp(system, dsp, channelGroup, paused, channelPtr);
}
///
///
/// Plays a DSP along with any of its inputs on a Channel.
///
///
/// System::playDSP
///
///
public static Channel PlayDsp(this FmodSystem system, Dsp dsp, ChannelGroup channelGroup, Bool32 paused)
{
TryPlayDsp(system, dsp, channelGroup, paused, out var channel).Check();
return channel;
}
///
///
/// Retrieves a handle to a Channel by ID.
///
///
/// System::getChannel
///
///
public static unsafe Result TryGetChannel(this FmodSystem system, int channelId, out Channel channel)
{
fixed (Channel* channelPtr = &channel)
return PInvoke.SystemGetChannel(system, channelId, channelPtr);
}
///
///
/// Retrieves a handle to a Channel by ID.
///
///
/// System::getChannel
///
///
public static Channel GetChannel(this FmodSystem system, int channelId)
{
TryGetChannel(system, channelId, out var channel).Check();
return channel;
}
///
///
/// Retrieve the description structure for a built-in DSP plug-in.
///
///
/// System::getDSPInfoByType
///
///
public static unsafe Result TryGetDspInfoByType(
this FmodSystem system,
DspType type,
out DspDescription* description
)
{
fixed (DspDescription** descriptionPtr = &description)
return PInvoke.SystemGetDspInfoByType(system, type, descriptionPtr);
}
///
///
/// Retrieve the description structure for a built-in DSP plug-in.
///
///
/// System::getDSPInfoByType
///
///
public static unsafe DspDescription* GetDspInfoByType(this FmodSystem system, DspType type)
{
TryGetDspInfoByType(system, type, out var description).Check();
return description;
}
///
///
/// Retrieves the master ChannelGroup that all sounds ultimately route to.
///
///
/// System::getMasterChannelGroup
///
///
public static unsafe Result TryGetMasterChannelGroup(this FmodSystem system, out ChannelGroup channelGroup)
{
fixed (ChannelGroup* channelGroupPtr = &channelGroup)
return PInvoke.SystemGetMasterChannelGroup(system, channelGroupPtr);
}
///
///
/// Retrieves the master ChannelGroup that all sounds ultimately route to.
///
///
/// System::getMasterChannelGroup
///
///
public static ChannelGroup GetMasterChannelGroup(this FmodSystem system)
{
TryGetMasterChannelGroup(system, out var channelGroup).Check();
return channelGroup;
}
///
///
/// Retrieves the default SoundGroup, where all sounds are placed when they are created.
///
///
/// System::getMasterSoundGroup
///
///
public static unsafe Result TryGetMasterSoundGroup(this FmodSystem system, out SoundGroup soundGroup)
{
fixed (SoundGroup* soundGroupPtr = &soundGroup)
return PInvoke.SystemGetMasterSoundGroup(system, soundGroupPtr);
}
///
///
/// Retrieves the default SoundGroup, where all sounds are placed when they are created.
///
///
/// System::getMasterSoundGroup
///
///
public static SoundGroup GetMasterSoundGroup(this FmodSystem system)
{
TryGetMasterSoundGroup(system, out var soundGroup).Check();
return soundGroup;
}
///
///
/// Connect the output of the specified ChannelGroup to an audio port on the output driver.
///
///
/// System::attachChannelGroupToPort
///
///
public static Result TryAttachChannelGroupToPort(
this FmodSystem system,
PortType portType,
PortIndex portIndex,
ChannelGroup channelGroup,
Bool32 passThru
) => PInvoke.SystemAttachChannelGroupToPort(system, portType, portIndex, channelGroup, passThru);
///
///
/// Connect the output of the specified ChannelGroup to an audio port on the output driver.
///
///
/// System::attachChannelGroupToPort
///
///
public static void AttachChannelGroupToPort(
this FmodSystem system,
PortType portType,
PortIndex portIndex,
ChannelGroup channelGroup,
Bool32 passThru
) => TryAttachChannelGroupToPort(system, portType, portIndex, channelGroup, passThru).Check();
///
///
/// Disconnect the output of the specified ChannelGroup from an audio port on the output driver.
///
///
/// System::detachChannelGroupFromPort
///
///
public static Result TryDetachChannelGroupFromPort(this FmodSystem system, ChannelGroup channelGroup) =>
PInvoke.SystemDetachChannelGroupFromPort(system, channelGroup);
///
///
/// Disconnect the output of the specified ChannelGroup from an audio port on the output driver.
///
///
/// System::detachChannelGroupFromPort
///
///
public static void DetachChannelGroupFromPort(this FmodSystem system, ChannelGroup channelGroup) =>
TryDetachChannelGroupFromPort(system, channelGroup).Check();
///
///
/// Sets parameters for the global reverb environment.
///
///
/// System::setReverbProperties
///
///
public static unsafe Result TrySetReverbProperties(
this FmodSystem system,
int instance,
in ReverbProperties prop
)
{
fixed (ReverbProperties* propPtr = &prop)
return PInvoke.SystemSetReverbProperties(system, instance, propPtr);
}
///
///
/// Sets parameters for the global reverb environment.
///
///
/// System::setReverbProperties
///
///
public static void SetReverbProperties(this FmodSystem system, int instance, in ReverbProperties prop) =>
TrySetReverbProperties(system, instance, prop).Check();
///
///
/// Retrieves the current reverb environment for the specified reverb instance.
///
///
/// System::getReverbProperties
///
///
public static unsafe Result TryGetReverbProperties(
this FmodSystem system,
int instance,
out ReverbProperties prop
)
{
fixed (ReverbProperties* propPtr = &prop)
return PInvoke.SystemGetReverbProperties(system, instance, propPtr);
}
///
///
/// Retrieves the current reverb environment for the specified reverb instance.
///
///
/// System::getReverbProperties
///
///
public static ReverbProperties GetReverbProperties(this FmodSystem system, int instance)
{
TryGetReverbProperties(system, instance, out var prop).Check();
return prop;
}
///
///
/// Mutual exclusion function to lock the DSP engine (which runs asynchronously in another thread), so that
/// it will not execute.
///
///
/// 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.
///
///
/// System::lockDSP
///
///
public static Result TryLockDsp(this FmodSystem system) => PInvoke.SystemLockDsp(system);
///
///
/// Mutual exclusion function to lock the DSP engine (which runs asynchronously in another thread), so that
/// it will not execute.
///
///
/// 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.
///
///
/// System::lockDSP
///
///
public static void LockDsp(this FmodSystem system) => TryLockDsp(system).Check();
///
///
/// Mutual exclusion function to unlock the DSP engine (which runs asynchronously in another thread) and let
/// it continue executing.
///
///
/// The DSP engine must be locked with System::lockDSP before this function is called.
///
///
/// System::unlockDSP
///
///
public static Result TryUnlockDsp(this FmodSystem system) => PInvoke.SystemUnlockDsp(system);
///
///
/// Mutual exclusion function to unlock the DSP engine (which runs asynchronously in another thread) and let
/// it continue executing.
///
///
/// The DSP engine must be locked with System::lockDSP before this function is called.
///
///
/// System::unlockDSP
///
///
public static void UnlockDsp(this FmodSystem system) => TryUnlockDsp(system).Check();
///
///
/// 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.
///
///
/// System::getRecordNumDrivers
///
///
public static unsafe Result TryGetRecordNumDrivers(
this FmodSystem system,
out int numDrivers,
out int numConnected
)
{
fixed (int* numDriversPtr = &numDrivers)
fixed (int* numConnectedPtr = &numConnected)
return PInvoke.SystemGetRecordNumDrivers(system, numDriversPtr, numConnectedPtr);
}
///
///
/// 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.
///
///
/// System::getRecordNumDrivers
///
///
public static void GetRecordNumDrivers(this FmodSystem system, out int numDrivers, out int numConnected) =>
TryGetRecordNumDrivers(system, out numDrivers, out numConnected).Check();
///
///
/// Retrieves identification information about an audio device specified by its index, and specific to the
/// output mode.
///
///
/// System::getRecordDriverInfo
///
///
public static unsafe Result TryGetRecordDriverInfo(
this FmodSystem system,
int id,
byte* name,
int nameLen,
out Guid guid,
out int systemRate,
out SpeakerMode speakerMode,
out int speakerModeChannels,
out DriverState state
)
{
fixed (Guid* guidPtr = &guid)
fixed (int* systemRatePtr = &systemRate)
fixed (SpeakerMode* speakerModePtr = &speakerMode)
fixed (int* speakerModeChannelsPtr = &speakerModeChannels)
fixed (DriverState* statePtr = &state)
return PInvoke.SystemGetRecordDriverInfo(
system,
id,
name,
nameLen,
guidPtr,
systemRatePtr,
speakerModePtr,
speakerModeChannelsPtr,
statePtr
);
}
///
///
/// Retrieves identification information about an audio device specified by its index, and specific to the
/// output mode.
///
///
/// System::getRecordDriverInfo
///
///
public static unsafe void GetRecordDriverInfo(
this FmodSystem system,
int id,
byte* name,
int nameLen,
out Guid guid,
out int systemRate,
out SpeakerMode speakerMode,
out int speakerModeChannels,
out DriverState state
) =>
TryGetRecordDriverInfo(
system,
id,
name,
nameLen,
out guid,
out systemRate,
out speakerMode,
out speakerModeChannels,
out state
)
.Check();
///
///
/// Retrieves the current recording position of the record buffer in PCM samples.
///
///
/// System::getRecordPosition
///
///
public static unsafe Result TryGetRecordPosition(this FmodSystem system, int id, out uint position)
{
fixed (uint* positionPtr = &position)
return PInvoke.SystemGetRecordPosition(system, id, positionPtr);
}
///
///
/// Retrieves the current recording position of the record buffer in PCM samples.
///
///
/// System::getRecordPosition
///
///
public static uint GetRecordPosition(this FmodSystem system, int id)
{
TryGetRecordPosition(system, id, out var position).Check();
return position;
}
///
///
/// Starts the recording engine recording to a pre-created Sound object.
///
///
/// System::recordStart
///
///
public static Result TryRecordStart(this FmodSystem system, int id, Sound sound, Bool32 loop) =>
PInvoke.SystemRecordStart(system, id, sound, loop);
///
///
/// Starts the recording engine recording to a pre-created Sound object.
///
///
/// System::recordStart
///
///
public static void RecordStart(this FmodSystem system, int id, Sound sound, Bool32 loop) =>
TryRecordStart(system, id, sound, loop).Check();
///
///
/// Stops the recording engine from recording to a pre-created Sound object.
///
///
/// System::recordStop
///
///
public static Result TryRecordStop(this FmodSystem system, int id) => PInvoke.SystemRecordStop(system, id);
///
///
/// Stops the recording engine from recording to a pre-created Sound object.
///
///
/// System::recordStop
///
///
public static void RecordStop(this FmodSystem system, int id) => TryRecordStop(system, id).Check();
///
///
/// Retrieves the state of the FMOD recording API, ie if it is currently recording or not.
///
///
/// System::isRecording
///
///
public static unsafe Result TryIsRecording(this FmodSystem system, int id, out Bool32 recording)
{
fixed (Bool32* recordingPtr = &recording)
return PInvoke.SystemIsRecording(system, id, recordingPtr);
}
///
///
/// Retrieves the state of the FMOD recording API, ie if it is currently recording or not.
///
///
/// System::isRecording
///
///
public static Bool32 IsRecording(this FmodSystem system, int id)
{
TryIsRecording(system, id, out var recording).Check();
return recording;
}
///
///
/// Geometry creation function. This function will create a base geometry object which can then have
/// polygons added to it.
///
///
/// System::createGeometry
///
///
public static unsafe Result TryCreateGeometry(
this FmodSystem system,
int maxPolygons,
int maxVertices,
out Geometry geometry
)
{
fixed (Geometry* geometryPtr = &geometry)
return PInvoke.SystemCreateGeometry(system, maxPolygons, maxVertices, geometryPtr);
}
///
///
/// Geometry creation function. This function will create a base geometry object which can then have
/// polygons added to it.
///
///
/// System::createGeometry
///
///
public static Geometry CreateGeometry(this FmodSystem system, int maxPolygons, int maxVertices)
{
TryCreateGeometry(system, maxPolygons, maxVertices, out var geometry).Check();
return geometry;
}
///
///
/// Sets the maximum world size for the geometry engine for performance / precision reasons.
///
///
/// System::setGeometrySettings
///
///
public static Result TrySetGeometrySettings(this FmodSystem system, float maxWorldSize) =>
PInvoke.SystemSetGeometrySettings(system, maxWorldSize);
///
///
/// Sets the maximum world size for the geometry engine for performance / precision reasons.
///
///
/// System::setGeometrySettings
///
///
public static void SetGeometrySettings(this FmodSystem system, float maxWorldSize) =>
TrySetGeometrySettings(system, maxWorldSize).Check();
///
///
/// Retrieves the maximum world size for the geometry engine.
///
///
/// System::getGeometrySettings
///
///
public static unsafe Result TryGetGeometrySettings(this FmodSystem system, out float maxWorldSize)
{
fixed (float* maxWorldSizePtr = &maxWorldSize)
return PInvoke.SystemGetGeometrySettings(system, maxWorldSizePtr);
}
///
///
/// Retrieves the maximum world size for the geometry engine.
///
///
/// System::getGeometrySettings
///
///
public static float GetGeometrySettings(this FmodSystem system)
{
TryGetGeometrySettings(system, out var maxWorldSize).Check();
return maxWorldSize;
}
///
///
/// 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.
///
///
/// System::loadGeometry
///
///
public static unsafe Result TryLoadGeometry(
this FmodSystem system,
void* data,
int dataSize,
out Geometry geometry
)
{
fixed (Geometry* geometryPtr = &geometry)
return PInvoke.SystemLoadGeometry(system, data, dataSize, geometryPtr);
}
///
///
/// 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.
///
///
/// System::loadGeometry
///
///
public static unsafe Geometry LoadGeometry(this FmodSystem system, void* data, int dataSize)
{
TryLoadGeometry(system, data, dataSize, out var geometry).Check();
return geometry;
}
///
///
/// Calculates geometry occlusion between a listener and a sound source.
///
///
/// System::getGeometryOcclusion
///
///
public static unsafe Result TryGetGeometryOcclusion(
this FmodSystem system,
in float3 listener,
in float3 source,
out float direct,
out float reverb
)
{
fixed (float3* listenerPtr = &listener)
fixed (float3* sourcePtr = &source)
fixed (float* directPtr = &direct)
fixed (float* reverbPtr = &reverb)
return PInvoke.SystemGetGeometryOcclusion(system, listenerPtr, sourcePtr, directPtr, reverbPtr);
}
///
///
/// Calculates geometry occlusion between a listener and a sound source.
///
///
/// System::getGeometryOcclusion
///
///
public static void GetGeometryOcclusion(
this FmodSystem system,
in float3 listener,
in float3 source,
out float direct,
out float reverb
) => TryGetGeometryOcclusion(system, listener, source, out direct, out reverb).Check();
///
///
/// Set a proxy server to use for all subsequent internet connections.
///
///
/// System::setNetworkProxy
///
///
public static unsafe Result TrySetNetworkProxy(this FmodSystem system, RefString8 proxy)
{
fixed (byte* proxyPtr = proxy)
return PInvoke.SystemSetNetworkProxy(system, proxyPtr);
}
///
///
/// Set a proxy server to use for all subsequent internet connections.
///
///
/// System::setNetworkProxy
///
///
public static void SetNetworkProxy(this FmodSystem system, RefString8 proxy) =>
TrySetNetworkProxy(system, proxy).Check();
///
///
/// Retrieves the URL of the proxy server used in internet streaming.
///
///
/// System::getNetworkProxy
///
///
public static unsafe Result TryGetNetworkProxy(this FmodSystem system, byte* proxy, int proxyLen) =>
PInvoke.SystemGetNetworkProxy(system, proxy, proxyLen);
///
///
/// Retrieves the URL of the proxy server used in internet streaming.
///
///
/// System::getNetworkProxy
///
///
public static unsafe void GetNetworkProxy(this FmodSystem system, byte* proxy, int proxyLen) =>
TryGetNetworkProxy(system, proxy, proxyLen).Check();
///
///
/// Set the timeout for network streams.
///
///
/// System::setNetworkTimeout
///
///
public static Result TrySetNetworkTimeout(this FmodSystem system, int timeOut) =>
PInvoke.SystemSetNetworkTimeout(system, timeOut);
///
///
/// Set the timeout for network streams.
///
///
/// System::setNetworkTimeout
///
///
public static void SetNetworkTimeout(this FmodSystem system, int timeOut) =>
TrySetNetworkTimeout(system, timeOut).Check();
///
///
/// Retrieve the timeout value for network streams.
///
///
/// System::getNetworkTimeout
///
///
public static unsafe Result TryGetNetworkTimeout(this FmodSystem system, out int timeOut)
{
fixed (int* timeOutPtr = &timeOut)
return PInvoke.SystemGetNetworkTimeout(system, timeOutPtr);
}
///
///
/// Retrieve the timeout value for network streams.
///
///
/// System::getNetworkTimeout
///
///
public static int GetNetworkTimeout(this FmodSystem system)
{
TryGetNetworkTimeout(system, out var timeOut).Check();
return timeOut;
}
///
///
/// Sets a user value associated with a System object.
///
///
/// System::setUserData
///
///
public static Result TrySetUserData(this FmodSystem system, nint userData) =>
PInvoke.SystemSetUserData(system, userData);
///
///
/// Sets a user value associated with a System object.
///
///
/// System::setUserData
///
///
public static void SetUserData(this FmodSystem system, nint userData) =>
TrySetUserData(system, userData).Check();
///
///
/// Retrieves a user value associated with a System object.
///
///
/// System::getUserData
///
///
public static unsafe Result TryGetUserData(this FmodSystem system, out nint userData)
{
fixed (nint* userDataPtr = &userData)
return PInvoke.SystemGetUserData(system, userDataPtr);
}
///
///
/// Retrieves a user value associated with a System object.
///
///
/// System::getUserData
///
///
public static nint GetUserData(this FmodSystem system)
{
TryGetUserData(system, out var userData).Check();
return userData;
}
}
}