diff --git a/Unity Studio/AssetsFile.cs b/Unity Studio/AssetsFile.cs index a55026a..725e0d2 100644 --- a/Unity Studio/AssetsFile.cs +++ b/Unity Studio/AssetsFile.cs @@ -16,6 +16,7 @@ namespace Unity_Studio public int[] version = new int[4] { 0, 0, 0, 0 }; public string[] buildType; public int platform = 100663296; + public string platformStr = ""; //public EndianType endianType = EndianType.BigEndian; //public List preloadTable = new List(); public Dictionary preloadTable = new Dictionary(); @@ -105,21 +106,22 @@ namespace Unity_Studio a_Stream.endian = EndianType.LittleEndian; } - /*Platform list: - -2: unitypackage - 4: OSX - 5: PC - 6: Web - 7: Web_streamed - 9: iOS - 10: PS3(big) - 11: Xbox360(big) - 13: Android - 16: Google_NaCl - 21: WP8 - 25: Linux - */ - + switch (platform) + { + case -2: platformStr = "Unity Package"; break; + case 4: platformStr = "OSX"; break; + case 5: platformStr = "PC"; break; + case 6: platformStr = "Web"; break; + case 7: platformStr = "Web streamed"; break; + case 9: platformStr = "iOS"; break; + case 10: platformStr = "PS3"; break; + case 11: platformStr = "Xbox 360"; break; + case 13: platformStr = "Android"; break; + case 16: platformStr = "Google NaCl"; break; + case 21: platformStr = "WP8"; break; + case 25: platformStr = "Linux"; break; + } + int baseCount = a_Stream.ReadInt32(); for (int i = 0; i < baseCount; i++) { diff --git a/Unity Studio/AudioClip.cs b/Unity Studio/AudioClip.cs index 239cbb6..f2af2a9 100644 --- a/Unity Studio/AudioClip.cs +++ b/Unity Studio/AudioClip.cs @@ -103,9 +103,9 @@ namespace Unity_Studio { case 1: extension = ".fsb"; - preloadData.InfoText += "FSB"; + preloadData.InfoText += "FSB with substreams"; break; - case 2://FSB5 + case 2: extension = ".fsb"; preloadData.InfoText += "FSB"; break; diff --git a/Unity Studio/FMOD Studio API/fmod.cs b/Unity Studio/FMOD Studio API/fmod.cs new file mode 100644 index 0000000..b384438 --- /dev/null +++ b/Unity Studio/FMOD Studio API/fmod.cs @@ -0,0 +1,4288 @@ +/* ========================================================================================== */ +/* */ +/* FMOD Studio - C# Wrapper . Copyright (c), Firelight Technologies Pty, Ltd. 2004-2015. */ +/* */ +/* ========================================================================================== */ + +using System; +using System.Text; +using System.Runtime.InteropServices; + +namespace FMOD +{ + /* + FMOD version number. Check this against FMOD::System::getVersion / System_GetVersion + 0xaaaabbcc -> aaaa = major version number. bb = minor version number. cc = development version number. + */ + public class VERSION + { + public const int number = 0x00010702; +#if WIN64 + public const string dll = "fmod64"; +#else + public const string dll = "fmod"; +#endif + } + + public class CONSTANTS + { + public const int MAX_CHANNEL_WIDTH = 32; + public const int MAX_LISTENERS = 8; + } + + /* + FMOD types + */ + + /* + [ENUM] + [ + [DESCRIPTION] + error codes. Returned from every function. + + [REMARKS] + + [SEE_ALSO] + ] + */ + public enum RESULT : int + { + OK, /* No errors. */ + ERR_BADCOMMAND, /* Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound). */ + ERR_CHANNEL_ALLOC, /* Error trying to allocate a channel. */ + ERR_CHANNEL_STOLEN, /* The specified channel has been reused to play another sound. */ + ERR_DMA, /* DMA Failure. See debug output for more information. */ + ERR_DSP_CONNECTION, /* DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts. */ + ERR_DSP_DONTPROCESS, /* DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph. */ + ERR_DSP_FORMAT, /* DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map. */ + ERR_DSP_INUSE, /* DSP is already in the mixer's DSP network. It must be removed before being reinserted or released. */ + ERR_DSP_NOTFOUND, /* DSP connection error. Couldn't find the DSP unit specified. */ + ERR_DSP_RESERVED, /* DSP operation error. Cannot perform operation on this DSP as it is reserved by the system. */ + ERR_DSP_SILENCE, /* DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph. */ + ERR_DSP_TYPE, /* DSP operation cannot be performed on a DSP of this type. */ + ERR_FILE_BAD, /* Error loading file. */ + ERR_FILE_COULDNOTSEEK, /* Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format. */ + ERR_FILE_DISKEJECTED, /* Media was ejected while reading. */ + ERR_FILE_EOF, /* End of file unexpectedly reached while trying to read essential data (truncated?). */ + ERR_FILE_ENDOFDATA, /* End of current chunk reached while trying to read data. */ + ERR_FILE_NOTFOUND, /* File not found. */ + ERR_FORMAT, /* Unsupported file or audio format. */ + ERR_HEADER_MISMATCH, /* There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library. */ + ERR_HTTP, /* A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere. */ + ERR_HTTP_ACCESS, /* The specified resource requires authentication or is forbidden. */ + ERR_HTTP_PROXY_AUTH, /* Proxy authentication is required to access the specified resource. */ + ERR_HTTP_SERVER_ERROR, /* A HTTP server error occurred. */ + ERR_HTTP_TIMEOUT, /* The HTTP request timed out. */ + ERR_INITIALIZATION, /* FMOD was not initialized correctly to support this function. */ + ERR_INITIALIZED, /* Cannot call this command after System::init. */ + ERR_INTERNAL, /* An error occurred that wasn't supposed to. Contact support. */ + ERR_INVALID_FLOAT, /* Value passed in was a NaN, Inf or denormalized float. */ + ERR_INVALID_HANDLE, /* An invalid object handle was used. */ + ERR_INVALID_PARAM, /* An invalid parameter was passed to this function. */ + ERR_INVALID_POSITION, /* An invalid seek position was passed to this function. */ + ERR_INVALID_SPEAKER, /* An invalid speaker was passed to this function based on the current speaker mode. */ + ERR_INVALID_SYNCPOINT, /* The syncpoint did not come from this sound handle. */ + ERR_INVALID_THREAD, /* Tried to call a function on a thread that is not supported. */ + ERR_INVALID_VECTOR, /* The vectors passed in are not unit length, or perpendicular. */ + ERR_MAXAUDIBLE, /* Reached maximum audible playback count for this sound's soundgroup. */ + ERR_MEMORY, /* Not enough memory or resources. */ + ERR_MEMORY_CANTPOINT, /* Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used. */ + ERR_NEEDS3D, /* Tried to call a command on a 2d sound when the command was meant for 3d sound. */ + ERR_NEEDSHARDWARE, /* Tried to use a feature that requires hardware support. */ + ERR_NET_CONNECT, /* Couldn't connect to the specified host. */ + ERR_NET_SOCKET_ERROR, /* A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere. */ + ERR_NET_URL, /* The specified URL couldn't be resolved. */ + ERR_NET_WOULD_BLOCK, /* Operation on a non-blocking socket could not complete immediately. */ + ERR_NOTREADY, /* Operation could not be performed because specified sound/DSP connection is not ready. */ + ERR_OUTPUT_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ + ERR_OUTPUT_CREATEBUFFER, /* Error creating hardware sound buffer. */ + ERR_OUTPUT_DRIVERCALL, /* A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted. */ + ERR_OUTPUT_FORMAT, /* Soundcard does not support the specified format. */ + ERR_OUTPUT_INIT, /* Error initializing output device. */ + ERR_OUTPUT_NODRIVERS, /* The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails. */ + ERR_PLUGIN, /* An unspecified error has been returned from a plugin. */ + ERR_PLUGIN_MISSING, /* A requested output, dsp unit type or codec was not available. */ + ERR_PLUGIN_RESOURCE, /* A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback) */ + ERR_PLUGIN_VERSION, /* A plugin was built with an unsupported SDK version. */ + ERR_RECORD, /* An error occurred trying to initialize the recording device. */ + ERR_REVERB_CHANNELGROUP, /* Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection. */ + ERR_REVERB_INSTANCE, /* Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist. */ + ERR_SUBSOUNDS, /* The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound. */ + ERR_SUBSOUND_ALLOCATED, /* This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first. */ + ERR_SUBSOUND_CANTMOVE, /* Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file. */ + ERR_TAGNOTFOUND, /* The specified tag could not be found or there are no tags. */ + ERR_TOOMANYCHANNELS, /* The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat. */ + ERR_TRUNCATED, /* The retrieved string is too long to fit in the supplied buffer and has been truncated. */ + ERR_UNIMPLEMENTED, /* Something in FMOD hasn't been implemented when it should be! contact support! */ + ERR_UNINITIALIZED, /* This command failed because System::init or System::setDriver was not called. */ + ERR_UNSUPPORTED, /* A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. */ + ERR_VERSION, /* The version number of this file format is not supported. */ + ERR_EVENT_ALREADY_LOADED, /* The specified bank has already been loaded. */ + ERR_EVENT_LIVEUPDATE_BUSY, /* The live update connection failed due to the game already being connected. */ + ERR_EVENT_LIVEUPDATE_MISMATCH, /* The live update connection failed due to the game data being out of sync with the tool. */ + ERR_EVENT_LIVEUPDATE_TIMEOUT, /* The live update connection timed out. */ + ERR_EVENT_NOTFOUND, /* The requested event, bus or vca could not be found. */ + ERR_STUDIO_UNINITIALIZED, /* The Studio::System object is not yet initialized. */ + ERR_STUDIO_NOT_LOADED, /* The specified resource is not loaded, so it can't be unloaded. */ + ERR_INVALID_STRING, /* An invalid string was passed to this function. */ + ERR_ALREADY_LOCKED, /* The specified resource is already locked. */ + ERR_NOT_LOCKED, /* The specified resource is not locked, so it can't be unlocked. */ + ERR_RECORD_DISCONNECTED, /* The specified recording driver has been disconnected. */ + ERR_TOOMANYSAMPLES, /* The length provided exceed the allowable limit. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Used to distinguish if a FMOD_CHANNELCONTROL parameter is actually a channel or a channelgroup. + + [REMARKS] + Cast the FMOD_CHANNELCONTROL to an FMOD_CHANNEL/FMOD::Channel, or FMOD_CHANNELGROUP/FMOD::ChannelGroup if specific functionality is needed for either class. + Otherwise use as FMOD_CHANNELCONTROL/FMOD::ChannelControl and use that API. + + [SEE_ALSO] + Channel::setCallback + ChannelGroup::setCallback + ] + */ + public enum CHANNELCONTROL_TYPE : int + { + CHANNEL, + CHANNELGROUP + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure describing a point in 3D space. + + [REMARKS] + FMOD uses a left handed co-ordinate system by default. + To use a right handed co-ordinate system specify FMOD_INIT_3D_RIGHTHANDED from FMOD_INITFLAGS in System::init. + + [SEE_ALSO] + System::set3DListenerAttributes + System::get3DListenerAttributes + Channel::set3DAttributes + Channel::get3DAttributes + Geometry::addPolygon + Geometry::setPolygonVertex + Geometry::getPolygonVertex + Geometry::setRotation + Geometry::getRotation + Geometry::setPosition + Geometry::getPosition + Geometry::setScale + Geometry::getScale + FMOD_INITFLAGS + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct VECTOR + { + public float x; /* X co-ordinate in 3D space. */ + public float y; /* Y co-ordinate in 3D space. */ + public float z; /* Z co-ordinate in 3D space. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure describing a position, velocity and orientation. + + [REMARKS] + + [SEE_ALSO] + FMOD_VECTOR + FMOD_DSP_PARAMETER_3DATTRIBUTES + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct _3D_ATTRIBUTES + { + VECTOR position; + VECTOR velocity; + VECTOR forward; + VECTOR up; + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure that is passed into FMOD_FILE_ASYNCREAD_CALLBACK. Use the information in this structure to perform + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
+ Members marked with [w] mean the variable can be written to. The user can set the value.
+
+ Instructions: write to 'buffer', and 'bytesread' BEFORE setting 'result'.
+ As soon as result is set, FMOD will asynchronously continue internally using the data provided in this structure.
+
+ Set 'result' to the result expected from a normal file read callback.
+ If the read was successful, set it to FMOD_OK.
+ If it read some data but hit the end of the file, set it to FMOD_ERR_FILE_EOF.
+ If a bad error occurred, return FMOD_ERR_FILE_BAD
+ If a disk was ejected, return FMOD_ERR_FILE_DISKEJECTED.
+ + [SEE_ALSO] + FMOD_FILE_ASYNCREAD_CALLBACK + FMOD_FILE_ASYNCCANCEL_CALLBACK + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct ASYNCREADINFO + { + public IntPtr handle; /* [r] The file handle that was filled out in the open callback. */ + public uint offset; /* [r] Seek position, make sure you read from this file offset. */ + public uint sizebytes; /* [r] how many bytes requested for read. */ + public int priority; /* [r] 0 = low importance. 100 = extremely important (ie 'must read now or stuttering may occur') */ + + public IntPtr userdata; /* [r] User data pointer. */ + public IntPtr buffer; /* [w] Buffer to read file data into. */ + public uint bytesread; /* [w] Fill this in before setting result code to tell FMOD how many bytes were read. */ + public ASYNCREADINFO_DONE_CALLBACK done; /* [r] FMOD file system wake up function. Call this when user file read is finished. Pass result of file read as a parameter. */ + + } + + /* + [ENUM] + [ + [DESCRIPTION] + These output types are used with System::setOutput / System::getOutput, to choose which output method to use. + + [REMARKS] + To pass information to the driver when initializing fmod use the *extradriverdata* parameter in System::init for the following reasons. + + - FMOD_OUTPUTTYPE_WAVWRITER - extradriverdata is a pointer to a char * file name that the wav writer will output to. + - FMOD_OUTPUTTYPE_WAVWRITER_NRT - extradriverdata is a pointer to a char * file name that the wav writer will output to. + - FMOD_OUTPUTTYPE_DSOUND - extradriverdata is cast to a HWND type, so that FMOD can set the focus on the audio for a particular window. + - FMOD_OUTPUTTYPE_PS3 - extradriverdata is a pointer to a FMOD_PS3_EXTRADRIVERDATA struct. This can be found in fmodps3.h. + - FMOD_OUTPUTTYPE_XBOX360 - extradriverdata is a pointer to a FMOD_360_EXTRADRIVERDATA struct. This can be found in fmodxbox360.h. + + Currently these are the only FMOD drivers that take extra information. Other unknown plugins may have different requirements. + + Note! 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 + System::setSoftwareFormat + System::getSoftwareFormat + System::init + System::update + FMOD_INITFLAGS + ] + */ + public enum OUTPUTTYPE : int + { + AUTODETECT, /* Picks the best output mode for the platform. This is the default. */ + + UNKNOWN, /* All - 3rd party plugin, unknown. This is for use with System::getOutput only. */ + NOSOUND, /* All - Perform all mixing but discard the final output. */ + WAVWRITER, /* All - Writes output to a .wav file. */ + NOSOUND_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_NOSOUND. User can drive mixer with System::update at whatever rate they want. */ + WAVWRITER_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_WAVWRITER. User can drive mixer with System::update at whatever rate they want. */ + + DSOUND, /* Win - Direct Sound. (Default on Windows XP and below) */ + WINMM, /* Win - Windows Multimedia. */ + WASAPI, /* Win/WinStore/XboxOne - Windows Audio Session API. (Default on Windows Vista and above, Xbox One and Windows Store Applications) */ + ASIO, /* Win - Low latency ASIO 2.0. */ + PULSEAUDIO, /* Linux - Pulse Audio. (Default on Linux if available) */ + ALSA, /* Linux - Advanced Linux Sound Architecture. (Default on Linux if PulseAudio isn't available) */ + COREAUDIO, /* Mac/iOS - Core Audio. (Default on Mac and iOS) */ + XBOX360, /* Xbox 360 - XAudio. (Default on Xbox 360) */ + PS3, /* PS3 - Audio Out. (Default on PS3) */ + AUDIOTRACK, /* Android - Java Audio Track. (Default on Android 2.2 and below) */ + OPENSL, /* Android - OpenSL ES. (Default on Android 2.3 and above) */ + WIIU, /* Wii U - AX. (Default on Wii U) */ + AUDIOOUT, /* PS4/PSVita - Audio Out. (Default on PS4 and PS Vita) */ + + MAX, /* Maximum number of output types supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Specify the destination of log output when using the logging version of FMOD. + + [REMARKS] + TTY destination can vary depending on platform, common examples include the + Visual Studio / Xcode output window, stderr and LogCat. + + [SEE_ALSO] + FMOD_Debug_Initialize + ] + */ + public enum DEBUG_MODE : int + { + TTY, /* Default log location per platform, i.e. Visual Studio output window, stderr, LogCat, etc */ + FILE, /* Write log to specified file path */ + CALLBACK, /* Call specified callback with log information */ + } + + /* + [DEFINE] + [ + [NAME] + FMOD_DEBUG_FLAGS + + [DESCRIPTION] + Specify the requested information to be output when using the logging version of FMOD. + + [REMARKS] + + [SEE_ALSO] + FMOD_Debug_Initialize + ] + */ + [Flags] + public enum DEBUG_FLAGS : uint + { + NONE = 0x00000000, /* Disable all messages */ + ERROR = 0x00000001, /* Enable only error messages. */ + WARNING = 0x00000002, /* Enable warning and error messages. */ + LOG = 0x00000004, /* Enable informational, warning and error messages (default). */ + + TYPE_MEMORY = 0x00000100, /* Verbose logging for memory operations, only use this if you are debugging a memory related issue. */ + TYPE_FILE = 0x00000200, /* Verbose logging for file access, only use this if you are debugging a file related issue. */ + TYPE_CODEC = 0x00000400, /* Verbose logging for codec initialization, only use this if you are debugging a codec related issue. */ + TYPE_TRACE = 0x00000800, /* Verbose logging for internal errors, use this for tracking the origin of error codes. */ + + DISPLAY_TIMESTAMPS = 0x00010000, /* Display the time stamp of the log message in milliseconds. */ + DISPLAY_LINENUMBERS = 0x00020000, /* Display the source code file and line number for where the message originated. */ + DISPLAY_THREAD = 0x00040000, /* Display the thread ID of the calling function that generated the message. */ + } + + /* + [DEFINE] + [ + [NAME] + FMOD_MEMORY_TYPE + + [DESCRIPTION] + Bit fields for memory allocation type being passed into FMOD memory callbacks. + + [REMARKS] + Remember this is a bitfield. You may get more than 1 bit set (ie physical + persistent) so do not simply switch on the types! You must check each bit individually or clear out the bits that you do not want within the callback.
+ Bits can be excluded if you want during Memory_Initialize so that you never get them. + + [SEE_ALSO] + FMOD_MEMORY_ALLOC_CALLBACK + FMOD_MEMORY_REALLOC_CALLBACK + FMOD_MEMORY_FREE_CALLBACK + Memory_Initialize + ] + */ + [Flags] + public enum MEMORY_TYPE : uint + { + NORMAL = 0x00000000, /* Standard memory. */ + STREAM_FILE = 0x00000001, /* Stream file buffer, size controllable with System::setStreamBufferSize. */ + STREAM_DECODE = 0x00000002, /* Stream decode buffer, size controllable with FMOD_CREATESOUNDEXINFO::decodebuffersize. */ + SAMPLEDATA = 0x00000004, /* Sample data buffer. Raw audio data, usually PCM/MPEG/ADPCM/XMA data. */ + DSP_BUFFER = 0x00000008, /* DSP memory block allocated when more than 1 output exists on a DSP node. */ + PLUGIN = 0x00000010, /* Memory allocated by a third party plugin. */ + XBOX360_PHYSICAL = 0x00100000, /* Requires XPhysicalAlloc / XPhysicalFree. */ + PERSISTENT = 0x00200000, /* Persistent memory. Memory will be freed when System::release is called. */ + SECONDARY = 0x00400000, /* Secondary memory. Allocation should be in secondary memory. For example RSX on the PS3. */ + ALL = 0xFFFFFFFF + } + + /* + [ENUM] + [ + [DESCRIPTION] + These are speaker types defined for use with the System::setSoftwareFormat command. + + [REMARKS] + Note below the phrase 'sound channels' is used. These are the subchannels inside a sound, they are not related and + have nothing to do with the FMOD class "Channel".
+ For example a mono sound has 1 sound channel, a stereo sound has 2 sound channels, and an AC3 or 6 channel wav file have 6 "sound channels".
+
+ FMOD_SPEAKERMODE_RAW
+ ---------------------
+ This mode is for output devices that are not specifically mono/stereo/quad/surround/5.1 or 7.1, but are multichannel.
+ Use System::setSoftwareFormat to specify the number of speakers you want to address, otherwise it will default to 2 (stereo).
+ Sound channels map to speakers sequentially, so a mono sound maps to output speaker 0, stereo sound maps to output speaker 0 & 1.
+ The user assumes knowledge of the speaker order. FMOD_SPEAKER enumerations may not apply, so raw channel indices should be used.
+ Multichannel sounds map input channels to output channels 1:1.
+ Channel::setPan and Channel::setPanLevels do not work.
+ Speaker levels must be manually set with Channel::setPanMatrix.
+
+ FMOD_SPEAKERMODE_MONO
+ ---------------------
+ This mode is for a 1 speaker arrangement.
+ Panning does not work in this speaker mode.
+ Mono, stereo and multichannel sounds have each sound channel played on the one speaker unity.
+ Mix behavior for multichannel sounds can be set with Channel::setPanMatrix.
+ Channel::setPanLevels does not work.
+
+ FMOD_SPEAKERMODE_STEREO
+ -----------------------
+ This mode is for 2 speaker arrangements that have a left and right speaker.
+
  • Mono sounds default to an even distribution between left and right. They can be panned with Channel::setPan.
    +
  • Stereo sounds default to the middle, or full left in the left speaker and full right in the right speaker. +
  • They can be cross faded with Channel::setPan.
    +
  • Multichannel sounds have each sound channel played on each speaker at unity.
    +
  • Mix behavior for multichannel sounds can be set with Channel::setPanMatrix.
    +
  • Channel::setPanLevels works but only front left and right parameters are used, the rest are ignored.
    +
    + FMOD_SPEAKERMODE_QUAD
    + ------------------------
    + This mode is for 4 speaker arrangements that have a front left, front right, surround left and a surround right speaker.
    +
  • Mono sounds default to an even distribution between front left and front right. They can be panned with Channel::setPan.
    +
  • Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right.
    +
  • They can be cross faded with Channel::setPan.
    +
  • Multichannel sounds default to all of their sound channels being played on each speaker in order of input.
    +
  • Mix behavior for multichannel sounds can be set with Channel::setPanMatrix.
    +
  • Channel::setPanLevels works but rear left, rear right, center and lfe are ignored.
    +
    + FMOD_SPEAKERMODE_SURROUND
    + ------------------------
    + This mode is for 5 speaker arrangements that have a left/right/center/surround left/surround right.
    +
  • Mono sounds default to the center speaker. They can be panned with Channel::setPan.
    +
  • Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. +
  • They can be cross faded with Channel::setPan.
    +
  • Multichannel sounds default to all of their sound channels being played on each speaker in order of input. +
  • Mix behavior for multichannel sounds can be set with Channel::setPanMatrix.
    +
  • Channel::setPanLevels works but rear left / rear right are ignored.
    +
    + FMOD_SPEAKERMODE_5POINT1
    + ---------------------------------------------------------
    + This mode is for 5.1 speaker arrangements that have a left/right/center/surround left/surround right and a subwoofer speaker.
    +
  • Mono sounds default to the center speaker. They can be panned with Channel::setPan.
    +
  • Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. +
  • They can be cross faded with Channel::setPan.
    +
  • Multichannel sounds default to all of their sound channels being played on each speaker in order of input. +
  • Mix behavior for multichannel sounds can be set with Channel::setPanMatrix.
    +
  • Channel::setPanLevels works but rear left / rear right are ignored.
    +
    + FMOD_SPEAKERMODE_7POINT1
    + ------------------------
    + This mode is for 7.1 speaker arrangements that have a left/right/center/surround left/surround right/rear left/rear right + and a subwoofer speaker.
    +
  • Mono sounds default to the center speaker. They can be panned with Channel::setPan.
    +
  • Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. +
  • They can be cross faded with Channel::setPan.
    +
  • Multichannel sounds default to all of their sound channels being played on each speaker in order of input. +
  • Mix behavior for multichannel sounds can be set with Channel::setPanMatrix.
    +
  • Channel::setPanLevels works and every parameter is used to set the balance of a sound in any speaker.
    +
    + + [SEE_ALSO] + System::setSoftwareFormat + System::getSoftwareFormat + DSP::setChannelFormat + ] + */ + public enum SPEAKERMODE : int + { + DEFAULT, /* Default speaker mode based on operating system/output mode. Windows = control panel setting, Xbox = 5.1, PS3 = 7.1 etc. */ + RAW, /* There is no specific speakermode. Sound channels are mapped in order of input to output. Use System::setSoftwareFormat to specify speaker count. See remarks for more information. */ + MONO, /* The speakers are monaural. */ + STEREO, /* The speakers are stereo. */ + QUAD, /* 4 speaker setup. This includes front left, front right, surround left, surround right. */ + SURROUND, /* 5 speaker setup. This includes front left, front right, center, surround left, surround right. */ + _5POINT1, /* 5.1 speaker setup. This includes front left, front right, center, surround left, surround right and an LFE speaker. */ + _7POINT1, /* 7.1 speaker setup. This includes front left, front right, center, surround left, surround right, back left, back right and an LFE speaker. */ + + MAX, /* Maximum number of speaker modes supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Assigns an enumeration for a speaker index. + + [REMARKS] + + [SEE_ALSO] + System::setSpeakerPosition + System::getSpeakerPosition + ] + */ + public enum SPEAKER : int + { + FRONT_LEFT, + FRONT_RIGHT, + FRONT_CENTER, + LOW_FREQUENCY, + SURROUND_LEFT, + SURROUND_RIGHT, + BACK_LEFT, + BACK_RIGHT, + + MAX, /* Maximum number of speaker types supported. */ + } + + /* + [DEFINE] + [ + [NAME] + FMOD_CHANNELMASK + + [DESCRIPTION] + These are bitfields to describe for a certain number of channels in a signal, which channels are being represented.
    + For example, a signal could be 1 channel, but contain the LFE channel only.
    + + [REMARKS] + FMOD_CHANNELMASK_BACK_CENTER is not represented as an output speaker in fmod - but it is encountered in input formats and is down or upmixed appropriately to the nearest speakers.
    + + [SEE_ALSO] + DSP::setChannelFormat + DSP::getChannelFormat + FMOD_SPEAKERMODE + ] + */ + [Flags] + public enum CHANNELMASK : uint + { + FRONT_LEFT = 0x00000001, + FRONT_RIGHT = 0x00000002, + FRONT_CENTER = 0x00000004, + LOW_FREQUENCY = 0x00000008, + SURROUND_LEFT = 0x00000010, + SURROUND_RIGHT = 0x00000020, + BACK_LEFT = 0x00000040, + BACK_RIGHT = 0x00000080, + BACK_CENTER = 0x00000100, + + MONO = (FRONT_LEFT), + STEREO = (FRONT_LEFT | FRONT_RIGHT), + LRC = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER), + QUAD = (FRONT_LEFT | FRONT_RIGHT | SURROUND_LEFT | SURROUND_RIGHT), + SURROUND = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SURROUND_LEFT | SURROUND_RIGHT), + _5POINT1 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SURROUND_LEFT | SURROUND_RIGHT), + _5POINT1_REARS = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT), + _7POINT0 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SURROUND_LEFT | SURROUND_RIGHT | BACK_LEFT | BACK_RIGHT), + _7POINT1 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SURROUND_LEFT | SURROUND_RIGHT | BACK_LEFT | BACK_RIGHT) + } + + /* + [ENUM] + [ + [DESCRIPTION] + When creating a multichannel sound, FMOD will pan them to their default speaker locations, for example a 6 channel sound will default to one channel per 5.1 output speaker.
    + Another example is a stereo sound. It will default to left = front left, right = front right.
    +
    + This is for sounds that are not 'default'. For example you might have a sound that is 6 channels but actually made up of 3 stereo pairs, that should all be located in front left, front right only. + + [REMARKS] + + [SEE_ALSO] + FMOD_CREATESOUNDEXINFO + ] + */ + public enum CHANNELORDER : int + { + DEFAULT, /* Left, Right, Center, LFE, Surround Left, Surround Right, Back Left, Back Right (see FMOD_SPEAKER enumeration) */ + WAVEFORMAT, /* Left, Right, Center, LFE, Back Left, Back Right, Surround Left, Surround Right (as per Microsoft .wav WAVEFORMAT structure master order) */ + PROTOOLS, /* Left, Center, Right, Surround Left, Surround Right, LFE */ + ALLMONO, /* Mono, Mono, Mono, Mono, Mono, Mono, ... (each channel all the way up to 32 channels are treated as if they were mono) */ + ALLSTEREO, /* Left, Right, Left, Right, Left, Right, ... (each pair of channels is treated as stereo all the way up to 32 channels) */ + ALSA, /* Left, Right, Surround Left, Surround Right, Center, LFE (as per Linux ALSA channel order) */ + + MAX, /* Maximum number of channel orderings supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + These are plugin types defined for use with the System::getNumPlugins, + System::getPluginInfo and System::unloadPlugin functions. + + [REMARKS] + + [SEE_ALSO] + System::getNumPlugins + System::getPluginInfo + System::unloadPlugin + ] + */ + public enum PLUGINTYPE : int + { + OUTPUT, /* The plugin type is an output module. FMOD mixed audio will play through one of these devices */ + CODEC, /* The plugin type is a file format codec. FMOD will use these codecs to load file formats for playback. */ + DSP, /* The plugin type is a DSP unit. FMOD will use these plugins as part of its DSP network to apply effects to output or generate sound in realtime. */ + + MAX, /* Maximum number of plugin types supported. */ + } + + + + /* + [DEFINE] + [ + [NAME] + FMOD_INITFLAGS + + [DESCRIPTION] + Initialization flags. Use them with System::init in the *flags* parameter to change various behavior. + + [REMARKS] + Use System::setAdvancedSettings to adjust settings for some of the features that are enabled by these flags. + + [SEE_ALSO] + System::init + System::update + System::setAdvancedSettings + Channel::set3DOcclusion + ] + */ + [Flags] + public enum INITFLAGS : uint + { + NORMAL = 0x00000000, /* Initialize normally */ + STREAM_FROM_UPDATE = 0x00000001, /* No stream thread is created internally. Streams are driven from System::update. Mainly used with non-realtime outputs. */ + MIX_FROM_UPDATE = 0x00000002, /* Win/Wii/PS3/Xbox/Xbox 360 Only - FMOD Mixer thread is woken up to do a mix when System::update is called rather than waking periodically on its own timer. */ + _3D_RIGHTHANDED = 0x00000004, /* FMOD will treat +X as right, +Y as up and +Z as backwards (towards you). */ + CHANNEL_LOWPASS = 0x00000100, /* All FMOD_3D based voices will add a software lowpass filter effect into the DSP chain which is automatically used when Channel::set3DOcclusion is used or the geometry API. This also causes sounds to sound duller when the sound goes behind the listener, as a fake HRTF style effect. Use System::setAdvancedSettings to disable or adjust cutoff frequency for this feature. */ + CHANNEL_DISTANCEFILTER = 0x00000200, /* All FMOD_3D based voices will add a software lowpass and highpass filter effect into the DSP chain which will act as a distance-automated bandpass filter. Use System::setAdvancedSettings to adjust the center frequency. */ + PROFILE_ENABLE = 0x00010000, /* Enable TCP/IP based host which allows FMOD Designer or FMOD Profiler to connect to it, and view memory, CPU and the DSP network graph in real-time. */ + VOL0_BECOMES_VIRTUAL = 0x00020000, /* Any sounds that are 0 volume will go virtual and not be processed except for having their positions updated virtually. Use System::setAdvancedSettings to adjust what volume besides zero to switch to virtual at. */ + GEOMETRY_USECLOSEST = 0x00040000, /* With the geometry engine, only process the closest polygon rather than accumulating all polygons the sound to listener line intersects. */ + PREFER_DOLBY_DOWNMIX = 0x00080000, /* When using FMOD_SPEAKERMODE_5POINT1 with a stereo output device, use the Dolby Pro Logic II downmix algorithm instead of the SRS Circle Surround algorithm. */ + THREAD_UNSAFE = 0x00100000, /* Disables thread safety for API calls. Only use this if FMOD low level is being called from a single thread, and if Studio API is not being used! */ + PROFILE_METER_ALL = 0x00200000 /* Slower, but adds level metering for every single DSP unit in the graph. Use DSP::setMeteringEnabled to turn meters off individually. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + These definitions describe the type of song being played. + + [REMARKS] + + [SEE_ALSO] + Sound::getFormat + ] + */ + public enum SOUND_TYPE + { + UNKNOWN, /* 3rd party / unknown plugin format. */ + AIFF, /* AIFF. */ + ASF, /* Microsoft Advanced Systems Format (ie WMA/ASF/WMV). */ + DLS, /* Sound font / downloadable sound bank. */ + FLAC, /* FLAC lossless codec. */ + FSB, /* FMOD Sample Bank. */ + IT, /* Impulse Tracker. */ + MIDI, /* MIDI. extracodecdata is a pointer to an FMOD_MIDI_EXTRACODECDATA structure. */ + MOD, /* Protracker / Fasttracker MOD. */ + MPEG, /* MP2/MP3 MPEG. */ + OGGVORBIS, /* Ogg vorbis. */ + PLAYLIST, /* Information only from ASX/PLS/M3U/WAX playlists */ + RAW, /* Raw PCM data. */ + S3M, /* ScreamTracker 3. */ + USER, /* User created sound. */ + WAV, /* Microsoft WAV. */ + XM, /* FastTracker 2 XM. */ + XMA, /* Xbox360 XMA */ + AUDIOQUEUE, /* iPhone hardware decoder, supports AAC, ALAC and MP3. extracodecdata is a pointer to an FMOD_AUDIOQUEUE_EXTRACODECDATA structure. */ + AT9, /* PS4 / PSVita ATRAC 9 format */ + VORBIS, /* Vorbis */ + MEDIA_FOUNDATION,/* Windows Store Application built in system codecs */ + MEDIACODEC, /* Android MediaCodec */ + FADPCM, /* FMOD Adaptive Differential Pulse Code Modulation */ + + MAX, /* Maximum number of sound types supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + These definitions describe the native format of the hardware or software buffer that will be used. + + [REMARKS] + This is the format the native hardware or software buffer will be or is created in. + + [SEE_ALSO] + System::createSoundEx + Sound::getFormat + ] + */ + public enum SOUND_FORMAT : int + { + NONE, /* Unitialized / unknown */ + PCM8, /* 8bit integer PCM data */ + PCM16, /* 16bit integer PCM data */ + PCM24, /* 24bit integer PCM data */ + PCM32, /* 32bit integer PCM data */ + PCMFLOAT, /* 32bit floating point PCM data */ + BITSTREAM, /* Sound data is in its native compressed format. */ + + MAX /* Maximum number of sound formats supported. */ + } + + + /* + [DEFINE] + [ + [NAME] + FMOD_MODE + + [DESCRIPTION] + Sound description bitfields, bitwise OR them together for loading and describing sounds. + + [REMARKS] + By default a sound will open as a static sound that is decompressed fully into memory to PCM. (ie equivalent of FMOD_CREATESAMPLE)
    + To have a sound stream instead, use FMOD_CREATESTREAM, or use the wrapper function System::createStream.
    + Some opening modes (ie FMOD_OPENUSER, FMOD_OPENMEMORY, FMOD_OPENMEMORY_POINT, FMOD_OPENRAW) will need extra information.
    + This can be provided using the FMOD_CREATESOUNDEXINFO structure. +
    + 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, for PCM formats, only WAV, FSB, and RAW are supported. For compressed formats, only those formats supported by FMOD_CREATECOMPRESSEDSAMPLE are supported.
    + With FMOD_OPENMEMORY_POINT and FMOD_OPENRAW or PCM, if using them together, note that you must pad the data on each side by 16 bytes. This is so fmod can modify the ends of the data for looping/interpolation/mixing purposes. If a wav file, you will need to insert silence, and then reset loop points to stop the playback from playing that silence.
    +
    + Xbox 360 memory On Xbox 360 Specifying FMOD_OPENMEMORY_POINT to a virtual memory address will cause FMOD_ERR_INVALID_ADDRESS + to be returned. Use physical memory only for this functionality.
    +
    + FMOD_LOWMEM is used on a sound if you want to minimize the memory overhead, by having FMOD not allocate memory for certain + features that are not likely to be used in a game environment. These are :
    + 1. Sound::getName functionality is removed. 256 bytes per sound is saved.
    + + [SEE_ALSO] + System::createSound + System::createStream + Sound::setMode + Sound::getMode + Channel::setMode + Channel::getMode + Sound::set3DCustomRolloff + Channel::set3DCustomRolloff + Sound::getOpenState + ] + */ + [Flags] + public enum MODE : uint + { + DEFAULT = 0x00000000, /* Default for all modes listed below. FMOD_LOOP_OFF, FMOD_2D, FMOD_3D_WORLDRELATIVE, FMOD_3D_INVERSEROLLOFF */ + LOOP_OFF = 0x00000001, /* For non looping sounds. (default). Overrides FMOD_LOOP_NORMAL / FMOD_LOOP_BIDI. */ + LOOP_NORMAL = 0x00000002, /* For forward looping sounds. */ + LOOP_BIDI = 0x00000004, /* For bidirectional looping sounds. (only works on software mixed static sounds). */ + _2D = 0x00000008, /* Ignores any 3d processing. (default). */ + _3D = 0x00000010, /* Makes the sound positionable in 3D. Overrides FMOD_2D. */ + CREATESTREAM = 0x00000080, /* Decompress at runtime, streaming from the source provided (standard stream). Overrides FMOD_CREATESAMPLE. */ + CREATESAMPLE = 0x00000100, /* Decompress at loadtime, decompressing or decoding whole file into memory as the target sample format. (standard sample). */ + CREATECOMPRESSEDSAMPLE = 0x00000200, /* Load MP2, MP3, IMAADPCM or XMA into memory and leave it compressed. During playback the FMOD software mixer will decode it in realtime as a 'compressed sample'. Can only be used in combination with FMOD_SOFTWARE. */ + OPENUSER = 0x00000400, /* Opens a user created static sample or stream. Use FMOD_CREATESOUNDEXINFO to specify format and/or read callbacks. If a user created 'sample' is created with no read callback, the sample will be empty. Use FMOD_Sound_Lock and FMOD_Sound_Unlock to place sound data into the sound if this is the case. */ + OPENMEMORY = 0x00000800, /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. */ + OPENMEMORY_POINT = 0x10000000, /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use FMOD_CREATESOUNDEXINFO to specify length. This differs to FMOD_OPENMEMORY in that it uses the memory as is, without duplicating the memory into its own buffers. Cannot be freed after open, only after Sound::release. Will not work if the data is compressed and FMOD_CREATECOMPRESSEDSAMPLE is not used. */ + OPENRAW = 0x00001000, /* Will ignore file format and treat as raw pcm. User may need to declare if data is FMOD_SIGNED or FMOD_UNSIGNED */ + OPENONLY = 0x00002000, /* Just open the file, dont prebuffer or read. Good for fast opens for info, or when sound::readData is to be used. */ + ACCURATETIME = 0x00004000, /* For FMOD_CreateSound - for accurate FMOD_Sound_GetLength / FMOD_Channel_SetPosition on VBR MP3, AAC and MOD/S3M/XM/IT/MIDI files. Scans file first, so takes longer to open. FMOD_OPENONLY does not affect this. */ + MPEGSEARCH = 0x00008000, /* For corrupted / bad MP3 files. This will search all the way through the file until it hits a valid MPEG header. Normally only searches for 4k. */ + NONBLOCKING = 0x00010000, /* For opening sounds and getting streamed subsounds (seeking) asyncronously. Use Sound::getOpenState to poll the state of the sound as it opens or retrieves the subsound in the background. */ + UNIQUE = 0x00020000, /* Unique sound, can only be played one at a time */ + _3D_HEADRELATIVE = 0x00040000, /* Make the sound's position, velocity and orientation relative to the listener. */ + _3D_WORLDRELATIVE = 0x00080000, /* Make the sound's position, velocity and orientation absolute (relative to the world). (DEFAULT) */ + _3D_INVERSEROLLOFF = 0x00100000, /* This sound will follow the inverse rolloff model where mindistance = full volume, maxdistance = where sound stops attenuating, and rolloff is fixed according to the global rolloff factor. (DEFAULT) */ + _3D_LINEARROLLOFF = 0x00200000, /* This sound will follow a linear rolloff model where mindistance = full volume, maxdistance = silence. */ + _3D_LINEARSQUAREROLLOFF= 0x00400000, /* This sound will follow a linear-square rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored. */ + _3D_INVERSETAPEREDROLLOFF = 0x00800000, /* This sound will follow the inverse rolloff model at distances close to mindistance and a linear-square rolloff close to maxdistance. */ + _3D_CUSTOMROLLOFF = 0x04000000, /* This sound will follow a rolloff model defined by Sound::set3DCustomRolloff / Channel::set3DCustomRolloff. */ + _3D_IGNOREGEOMETRY = 0x40000000, /* Is not affect by geometry occlusion. If not specified in Sound::setMode, or Channel::setMode, the flag is cleared and it is affected by geometry again. */ + IGNORETAGS = 0x02000000, /* Skips id3v2/asf/etc tag checks when opening a sound, to reduce seek/read overhead when opening files (helps with CD performance). */ + LOWMEM = 0x08000000, /* Removes some features from samples to give a lower memory overhead, like Sound::getName. */ + LOADSECONDARYRAM = 0x20000000, /* Load sound into the secondary RAM of supported platform. On PS3, sounds will be loaded into RSX/VRAM. */ + VIRTUAL_PLAYFROMSTART = 0x80000000 /* For sounds that start virtual (due to being quiet or low importance), instead of swapping back to audible, and playing at the correct offset according to time, this flag makes the sound play from the start. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + These values describe what state a sound is in after FMOD_NONBLOCKING has been used to open it. + + [REMARKS] + With streams, if you are using FMOD_NONBLOCKING, note that if the user calls Sound::getSubSound, a stream will go into FMOD_OPENSTATE_SEEKING state and sound related commands will return FMOD_ERR_NOTREADY.
    + With streams, if you are using FMOD_NONBLOCKING, note that if the user calls Channel::getPosition, a stream will go into FMOD_OPENSTATE_SETPOSITION state and sound related commands will return FMOD_ERR_NOTREADY.
    + + [SEE_ALSO] + Sound::getOpenState + FMOD_MODE + ] + */ + public enum OPENSTATE : int + { + READY = 0, /* Opened and ready to play */ + LOADING, /* Initial load in progress */ + ERROR, /* Failed to open - file not found, out of memory etc. See return value of Sound::getOpenState for what happened. */ + CONNECTING, /* Connecting to remote host (internet sounds only) */ + BUFFERING, /* Buffering data */ + SEEKING, /* Seeking to subsound and re-flushing stream buffer. */ + PLAYING, /* Ready and playing, but not possible to release at this time without stalling the main thread. */ + SETPOSITION, /* Seeking within a stream to a different position. */ + + MAX, /* Maximum number of open state types. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + These flags are used with SoundGroup::setMaxAudibleBehavior to determine what happens when more sounds + are played than are specified with SoundGroup::setMaxAudible. + + [REMARKS] + When using FMOD_SOUNDGROUP_BEHAVIOR_MUTE, SoundGroup::setMuteFadeSpeed can be used to stop a sudden transition. + Instead, the time specified will be used to cross fade between the sounds that go silent and the ones that become audible. + + [SEE_ALSO] + SoundGroup::setMaxAudibleBehavior + SoundGroup::getMaxAudibleBehavior + SoundGroup::setMaxAudible + SoundGroup::getMaxAudible + SoundGroup::setMuteFadeSpeed + SoundGroup::getMuteFadeSpeed + ] + */ + public enum SOUNDGROUP_BEHAVIOR : int + { + BEHAVIOR_FAIL, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will simply fail during System::playSound. */ + BEHAVIOR_MUTE, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will be silent, then if another sound in the group stops the sound that was silent before becomes audible again. */ + BEHAVIOR_STEALLOWEST, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will steal the quietest / least important sound playing in the group. */ + + MAX, /* Maximum number of sound group behaviors. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + These callback types are used with Channel::setCallback. + + [REMARKS] + Each callback has commanddata parameters passed as int unique to the type of callback.
    + See reference to FMOD_CHANNELCONTROL_CALLBACK to determine what they might mean for each type of callback.
    +
    + Note! Currently the user must call System::update for these callbacks to trigger! + + [SEE_ALSO] + Channel::setCallback + ChannelGroup::setCallback + FMOD_CHANNELCONTROL_CALLBACK + System::update + ] + */ + public enum CHANNELCONTROL_CALLBACK_TYPE : int + { + END, /* Called when a sound ends. */ + VIRTUALVOICE, /* Called when a voice is swapped out or swapped in. */ + SYNCPOINT, /* Called when a syncpoint is encountered. Can be from wav file markers. */ + OCCLUSION, /* Called when the channel has its geometry occlusion value calculated. Can be used to clamp or change the value. */ + + MAX, /* Maximum number of callback types supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + These enums denote special types of node within a DSP chain. + + [REMARKS] + + [SEE_ALSO] + Channel::getDSP + ChannelGroup::getDSP + ] + */ + public struct CHANNELCONTROL_DSP_INDEX + { + public const int HEAD = -1; /* Head of the DSP chain. */ + public const int FADER = -2; /* Built in fader DSP. */ + public const int PANNER = -3; /* Built in panner DSP. */ + public const int TAIL = -4; /* Tail of the DSP chain. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Used to distinguish the instance type passed into FMOD_ERROR_CALLBACK. + + [REMARKS] + Cast the instance of FMOD_ERROR_CALLBACK to the appropriate class indicated by this enum. + + [SEE_ALSO] + ] + */ + public enum ERRORCALLBACK_INSTANCETYPE + { + NONE, + SYSTEM, + CHANNEL, + CHANNELGROUP, + CHANNELCONTROL, + SOUND, + SOUNDGROUP, + DSP, + DSPCONNECTION, + GEOMETRY, + REVERB3D, + STUDIO_SYSTEM, + STUDIO_EVENTDESCRIPTION, + STUDIO_EVENTINSTANCE, + STUDIO_PARAMETERINSTANCE, + STUDIO_CUEINSTANCE, + STUDIO_BUS, + STUDIO_VCA, + STUDIO_BANK, + STUDIO_COMMANDREPLAY + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure that is passed into FMOD_SYSTEM_CALLBACK for the FMOD_SYSTEM_CALLBACK_ERROR callback type. + + [REMARKS] + The instance pointer will be a type corresponding to the instanceType enum. + + [SEE_ALSO] + FMOD_ERRORCALLBACK_INSTANCETYPE + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct ERRORCALLBACK_INFO + { + public RESULT result; /* Error code result */ + public ERRORCALLBACK_INSTANCETYPE instancetype; /* Type of instance the error occurred on */ + public IntPtr instance; /* Instance pointer */ + private IntPtr functionname_internal; /* Function that the error occurred on */ + private IntPtr functionparams_internal; /* Function parameters that the error ocurred on */ + + public string functionname { get { return Marshal.PtrToStringAnsi(functionname_internal); } } + public string functionparams { get { return Marshal.PtrToStringAnsi(functionparams_internal); } } + } + + /* + [DEFINE] + [ + [NAME] + FMOD_SYSTEM_CALLBACK_TYPE + + [DESCRIPTION] + These callback types are used with System::setCallback. + + [REMARKS] + Each callback has commanddata parameters passed as void* unique to the type of callback.
    + See reference to FMOD_SYSTEM_CALLBACK to determine what they might mean for each type of callback.
    +
    + Note! Using FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED (on Mac only) requires the application to be running an event loop which will allow external changes to device list to be detected by FMOD.
    +
    + Note! The 'system' object pointer will be null for FMOD_SYSTEM_CALLBACK_THREADCREATED and FMOD_SYSTEM_CALLBACK_MEMORYALLOCATIONFAILED callbacks. + + [SEE_ALSO] + System::setCallback + System::update + DSP::addInput + ] + */ + [Flags] + public enum SYSTEM_CALLBACK_TYPE : uint + { + DEVICELISTCHANGED = 0x00000001, /* Called from System::update when the enumerated list of devices has changed. */ + DEVICELOST = 0x00000002, /* Called from System::update when an output device has been lost due to control panel parameter changes and FMOD cannot automatically recover. */ + MEMORYALLOCATIONFAILED = 0x00000004, /* Called directly when a memory allocation fails somewhere in FMOD. (NOTE - 'system' will be NULL in this callback type.)*/ + THREADCREATED = 0x00000008, /* Called directly when a thread is created. (NOTE - 'system' will be NULL in this callback type.) */ + BADDSPCONNECTION = 0x00000010, /* Called when a bad connection was made with DSP::addInput. Usually called from mixer thread because that is where the connections are made. */ + PREMIX = 0x00000020, /* Called each tick before a mix update happens. */ + POSTMIX = 0x00000040, /* Called each tick after a mix update happens. */ + ERROR = 0x00000080, /* Called when each API function returns an error code, including delayed async functions. */ + MIDMIX = 0x00000100, /* Called each tick in mix update after clocks have been updated before the main mix occurs. */ + THREADDESTROYED = 0x00000200, /* Called directly when a thread is destroyed. */ + PREUPDATE = 0x00000400, /* Called at start of System::update function. */ + POSTUPDATE = 0x00000800, /* Called at end of System::update function. */ + RECORDLISTCHANGED = 0x00001000, /* Called from System::update when the enumerated list of recording devices has changed. */ + ALL = 0xFFFFFFFF, /* Pass this mask to System::setCallback to receive all callback types. */ + } + + #region wrapperinternal + [StructLayout(LayoutKind.Sequential)] + public struct StringWrapper + { + IntPtr nativeUtf8Ptr; + + public static implicit operator string(StringWrapper fstring) + { + if (fstring.nativeUtf8Ptr == IntPtr.Zero) + { + return ""; + } + + int strlen = 0; + while (Marshal.ReadByte(fstring.nativeUtf8Ptr, strlen) != 0) + { + strlen++; + } + if (strlen > 0) + { + byte[] bytes = new byte[strlen]; + Marshal.Copy(fstring.nativeUtf8Ptr, bytes, 0, strlen); + return Encoding.UTF8.GetString(bytes, 0, strlen); + } + else + { + return ""; + } + } + } + #endregion + + /* + FMOD Callbacks + */ + public delegate RESULT ASYNCREADINFO_DONE_CALLBACK(IntPtr info, RESULT result); + + public delegate RESULT DEBUG_CALLBACK (DEBUG_FLAGS flags, string file, int line, string func, string message); + + public delegate RESULT SYSTEM_CALLBACK (IntPtr systemraw, SYSTEM_CALLBACK_TYPE type, IntPtr commanddata1, IntPtr commanddata2, IntPtr userdata); + + public delegate RESULT CHANNEL_CALLBACK (IntPtr channelraw, CHANNELCONTROL_TYPE controltype, CHANNELCONTROL_CALLBACK_TYPE type, IntPtr commanddata1, IntPtr commanddata2); + + public delegate RESULT SOUND_NONBLOCKCALLBACK (IntPtr soundraw, RESULT result); + public delegate RESULT SOUND_PCMREADCALLBACK (IntPtr soundraw, IntPtr data, uint datalen); + public delegate RESULT SOUND_PCMSETPOSCALLBACK (IntPtr soundraw, int subsound, uint position, TIMEUNIT postype); + + public delegate RESULT FILE_OPENCALLBACK (StringWrapper name, ref uint filesize, ref IntPtr handle, IntPtr userdata); + public delegate RESULT FILE_CLOSECALLBACK (IntPtr handle, IntPtr userdata); + public delegate RESULT FILE_READCALLBACK (IntPtr handle, IntPtr buffer, uint sizebytes, ref uint bytesread, IntPtr userdata); + public delegate RESULT FILE_SEEKCALLBACK (IntPtr handle, uint pos, IntPtr userdata); + public delegate RESULT FILE_ASYNCREADCALLBACK (IntPtr handle, IntPtr info, IntPtr userdata); + public delegate RESULT FILE_ASYNCCANCELCALLBACK (IntPtr handle, IntPtr userdata); + + public delegate IntPtr MEMORY_ALLOC_CALLBACK (uint size, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate IntPtr MEMORY_REALLOC_CALLBACK (IntPtr ptr, uint size, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate void MEMORY_FREE_CALLBACK (IntPtr ptr, MEMORY_TYPE type, StringWrapper sourcestr); + + public delegate float CB_3D_ROLLOFFCALLBACK (IntPtr channelraw, float distance); + + /* + [ENUM] + [ + [DESCRIPTION] + List of interpolation types that the FMOD Ex software mixer supports. + + [REMARKS] + The default resampler type is FMOD_DSP_RESAMPLER_LINEAR.
    + Use System::setSoftwareFormat to tell FMOD the resampling quality you require for FMOD_SOFTWARE based sounds. + + [SEE_ALSO] + System::setSoftwareFormat + System::getSoftwareFormat + ] + */ + public enum DSP_RESAMPLER : int + { + DEFAULT, /* Default interpolation method. Currently equal to FMOD_DSP_RESAMPLER_LINEAR. */ + NOINTERP, /* No interpolation. High frequency aliasing hiss will be audible depending on the sample rate of the sound. */ + LINEAR, /* Linear interpolation (default method). Fast and good quality, causes very slight lowpass effect on low frequency sounds. */ + CUBIC, /* Cubic interpolation. Slower than linear interpolation but better quality. */ + SPLINE, /* 5 point spline interpolation. Slowest resampling method but best quality. */ + + MAX, /* Maximum number of resample methods supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + List of connection types between 2 DSP nodes. + + [REMARKS] + FMOD_DSP_CONNECTION_TYPE_STANDARD
    + ----------------------------------
    + Default DSPConnection type. Audio is mixed from the input to the output DSP's audible buffer, meaning it will be part of the audible signal. A standard connection will execute its input DSP if it has not been executed before.
    +
    + FMOD_DSP_CONNECTION_TYPE_SIDECHAIN
    + ----------------------------------
    + Sidechain DSPConnection type. Audio is mixed from the input to the output DSP's sidechain buffer, meaning it will NOT be part of the audible signal. A sidechain connection will execute its input DSP if it has not been executed before.
    + The purpose of the seperate sidechain buffer in a DSP, is so that the DSP effect can privately access for analysis purposes. An example of use in this case, could be a compressor which analyzes the signal, to control its own effect parameters (ie a compression level or gain).
    +
    + For the effect developer, to accept sidechain data, the sidechain data will appear in the FMOD_DSP_STATE struct which is passed into the read callback of a DSP unit.
    + FMOD_DSP_STATE::sidechaindata and FMOD_DSP::sidechainchannels will hold the mixed result of any sidechain data flowing into it.
    +
    + FMOD_DSP_CONNECTION_TYPE_SEND
    + -----------------------------
    + Send DSPConnection type. Audio is mixed from the input to the output DSP's audible buffer, meaning it will be part of the audible signal. A send connection will NOT execute its input DSP if it has not been executed before.
    + A send connection will only read what exists at the input's buffer at the time of executing the output DSP unit (which can be considered the 'return')
    +
    + FMOD_DSP_CONNECTION_TYPE_SEND_SIDECHAIN
    + ---------------------------------------
    + Send sidechain DSPConnection type. Audio is mixed from the input to the output DSP's sidechain buffer, meaning it will NOT be part of the audible signal. A send sidechain connection will NOT execute its input DSP if it has not been executed before.
    + A send sidechain connection will only read what exists at the input's buffer at the time of executing the output DSP unit (which can be considered the 'sidechain return'). +
    + For the effect developer, to accept sidechain data, the sidechain data will appear in the FMOD_DSP_STATE struct which is passed into the read callback of a DSP unit.
    + FMOD_DSP_STATE::sidechaindata and FMOD_DSP::sidechainchannels will hold the mixed result of any sidechain data flowing into it. + + [SEE_ALSO] + DSP::addInput + DSPConnection::getType + ] + */ + public enum DSPCONNECTION_TYPE : int + { + STANDARD, /* Default connection type. Audio is mixed from the input to the output DSP's audible buffer. */ + SIDECHAIN, /* Sidechain connection type. Audio is mixed from the input to the output DSP's sidechain buffer. */ + SEND, /* Send connection type. Audio is mixed from the input to the output DSP's audible buffer, but the input is NOT executed, only copied from. A standard connection or sidechain needs to make an input execute to generate data. */ + SEND_SIDECHAIN, /* Send sidechain connection type. Audio is mixed from the input to the output DSP's sidechain buffer, but the input is NOT executed, only copied from. A standard connection or sidechain needs to make an input execute to generate data. */ + + MAX, /* Maximum number of DSP connection types supported. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + List of tag types that could be stored within a sound. These include id3 tags, metadata from netstreams and vorbis/asf data. + + [REMARKS] + + [SEE_ALSO] + Sound::getTag + ] + */ + public enum TAGTYPE : int + { + UNKNOWN = 0, + ID3V1, + ID3V2, + VORBISCOMMENT, + SHOUTCAST, + ICECAST, + ASF, + MIDI, + PLAYLIST, + FMOD, + USER, + + MAX /* Maximum number of tag types supported. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + List of data types that can be returned by Sound::getTag + + [REMARKS] + + [SEE_ALSO] + Sound::getTag + ] + */ + public enum TAGDATATYPE : int + { + BINARY = 0, + INT, + FLOAT, + STRING, + STRING_UTF16, + STRING_UTF16BE, + STRING_UTF8, + CDTOC, + + MAX /* Maximum number of tag datatypes supported. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure describing a piece of tag data. + + [REMARKS] + Members marked with [w] mean the user sets the value before passing it to the function. + Members marked with [r] mean FMOD sets the value to be used after the function exits. + + [SEE_ALSO] + Sound::getTag + TAGTYPE + TAGDATATYPE + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct TAG + { + public TAGTYPE type; /* [r] The type of this tag. */ + public TAGDATATYPE datatype; /* [r] The type of data that this tag contains */ + private IntPtr name_internal;/* [r] The name of this tag i.e. "TITLE", "ARTIST" etc. */ + public IntPtr data; /* [r] Pointer to the tag data - its format is determined by the datatype member */ + public uint datalen; /* [r] Length of the data contained in this tag */ + public bool updated; /* [r] True if this tag has been updated since last being accessed with Sound::getTag */ + + public string name { get { return Marshal.PtrToStringAnsi(name_internal); } } + } + + + /* + [DEFINE] + [ + [NAME] + FMOD_TIMEUNIT + + [DESCRIPTION] + List of time types that can be returned by Sound::getLength and used with Channel::setPosition or Channel::getPosition. + + [REMARKS] + Do not combine flags except FMOD_TIMEUNIT_BUFFERED. + + [SEE_ALSO] + Sound::getLength + Channel::setPosition + Channel::getPosition + ] + */ + [Flags] + public enum TIMEUNIT : uint + { + MS = 0x00000001, /* Milliseconds. */ + PCM = 0x00000002, /* PCM Samples, related to milliseconds * samplerate / 1000. */ + PCMBYTES = 0x00000004, /* Bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes). */ + RAWBYTES = 0x00000008, /* Raw file bytes of (compressed) sound data (does not include headers). Only used by Sound::getLength and Channel::getPosition. */ + PCMFRACTION = 0x00000010, /* Fractions of 1 PCM sample. Unsigned int range 0 to 0xFFFFFFFF. Used for sub-sample granularity for DSP purposes. */ + MODORDER = 0x00000100, /* MOD/S3M/XM/IT. Order in a sequenced module format. Use Sound::getFormat to determine the format. */ + MODROW = 0x00000200, /* MOD/S3M/XM/IT. Current row in a sequenced module format. Sound::getLength will return the number if rows in the currently playing or seeked to pattern. */ + MODPATTERN = 0x00000400, /* MOD/S3M/XM/IT. Current pattern in a sequenced module format. Sound::getLength will return the number of patterns in the song and Channel::getPosition will return the currently playing pattern. */ + BUFFERED = 0x10000000, /* Time value as seen by buffered stream. This is always ahead of audible time, and is only used for processing. */ + } + + /* + [DEFINE] + [ + [NAME] + FMOD_PORT_INDEX + + [DESCRIPTION] + + [REMARKS] + + [SEE_ALSO] + System::AttachChannelGroupToPort + ] + */ + public struct PORT_INDEX + { + public const ulong NONE = 0xFFFFFFFFFFFFFFFF; + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Use this structure with System::createSound when more control is needed over loading. + The possible reasons to use this with System::createSound are: + + - Loading a file from memory. + - Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length. + - To create a user created / non file based sound. + - To specify a starting subsound to seek to within a multi-sample sounds (ie FSB/DLS) when created as a stream. + - To specify which subsounds to load for multi-sample sounds (ie FSB/DLS) so that memory is saved and only a subset is actually loaded/read from disk. + - To specify 'piggyback' read and seek callbacks for capture of sound data as fmod reads and decodes it. Useful for ripping decoded PCM data from sounds as they are loaded / played. + - To specify a MIDI DLS sample set file to load when opening a MIDI file. + + See below on what members to fill for each of the above types of sound you want to create. + + [REMARKS] + This structure is optional! Specify 0 or NULL in System::createSound if you don't need it! + + Loading a file from memory. + + - Create the sound using the FMOD_OPENMEMORY flag. + - Mandatory. Specify 'length' for the size of the memory block in bytes. + - Other flags are optional. + + Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length. + + - Mandatory. Specify 'fileoffset' and 'length'. + - Other flags are optional. + + To create a user created / non file based sound. + + - Create the sound using the FMOD_OPENUSER flag. + - Mandatory. Specify 'defaultfrequency, 'numchannels' and 'format'. + - Other flags are optional. + + To specify a starting subsound to seek to and flush with, within a multi-sample stream (ie FSB/DLS). + + - Mandatory. Specify 'initialsubsound'. + + To specify which subsounds to load for multi-sample sounds (ie FSB/DLS) so that memory is saved and only a subset is actually loaded/read from disk. + + - Mandatory. Specify 'inclusionlist' and 'inclusionlistnum'. + + To specify 'piggyback' read and seek callbacks for capture of sound data as fmod reads and decodes it. Useful for ripping decoded PCM data from sounds as they are loaded / played. + + - Mandatory. Specify 'pcmreadcallback' and 'pcmseekcallback'. + + To specify a MIDI DLS sample set file to load when opening a MIDI file. + + - Mandatory. Specify 'dlsname'. + + Setting the 'decodebuffersize' is for cpu intensive codecs that may be causing stuttering, not file intensive codecs (ie those from CD or netstreams) 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 have a stuttering effect, then it is using more cpu than the decode buffer playback rate can keep up with. Increasing the decode buffersize will most likely 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. + + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value. + + [SEE_ALSO] + System::createSound + System::setStreamBufferSize + FMOD_MODE + FMOD_SOUND_FORMAT + FMOD_SOUND_TYPE + FMOD_CHANNELMASK + FMOD_CHANNELORDER + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct CREATESOUNDEXINFO + { + public int cbsize; /* [w] Size of this structure. This is used so the structure can be expanded in the future and still work on older versions of FMOD Ex. */ + public uint length; /* [w] Optional. Specify 0 to ignore. Size in bytes of file to load, or sound to create (in this case only if FMOD_OPENUSER is used). Required if loading from memory. If 0 is specified, then it will use the size of the file (unless loading from memory then an error will be returned). */ + public uint fileoffset; /* [w] Optional. Specify 0 to ignore. Offset from start of the file to start loading from. This is useful for loading files from inside big data files. */ + public int numchannels; /* [w] Optional. Specify 0 to ignore. Number of channels in a sound specified only if OPENUSER is used. */ + public int defaultfrequency; /* [w] Optional. Specify 0 to ignore. Default frequency of sound in a sound specified only if OPENUSER is used. Other formats use the frequency determined by the file format. */ + public SOUND_FORMAT format; /* [w] Optional. Specify 0 or SOUND_FORMAT_NONE to ignore. Format of the sound specified only if OPENUSER is used. Other formats use the format determined by the file format. */ + public uint decodebuffersize; /* [w] Optional. Specify 0 to ignore. For streams. This determines the size of the double buffer (in PCM samples) that a stream uses. Use this for user created streams if you want to determine the size of the callback buffer passed to you. Specify 0 to use FMOD's default size which is currently equivalent to 400ms of the sound format created/loaded. */ + public int initialsubsound; /* [w] Optional. Specify 0 to ignore. In a multi-sample file format such as .FSB/.DLS/.SF2, specify the initial subsound to seek to, only if CREATESTREAM is used. */ + public int numsubsounds; /* [w] Optional. Specify 0 to ignore or have no subsounds. In a user created multi-sample sound, specify the number of subsounds within the sound that are accessable with Sound::getSubSound / SoundGetSubSound. */ + public IntPtr inclusionlist; /* [w] Optional. Specify 0 to ignore. In a multi-sample format such as .FSB/.DLS/.SF2 it may be desirable to specify only a subset of sounds to be loaded out of the whole file. This is an array of subsound indicies to load into memory when created. */ + public int inclusionlistnum; /* [w] Optional. Specify 0 to ignore. This is the number of integers contained within the */ + public SOUND_PCMREADCALLBACK pcmreadcallback; /* [w] Optional. Specify 0 to ignore. Callback to 'piggyback' on FMOD's read functions and accept or even write PCM data while FMOD is opening the sound. Used for user sounds created with OPENUSER or for capturing decoded data as FMOD reads it. */ + public SOUND_PCMSETPOSCALLBACK pcmsetposcallback; /* [w] Optional. Specify 0 to ignore. Callback for when the user calls a seeking function such as Channel::setPosition within a multi-sample sound, and for when it is opened.*/ + public SOUND_NONBLOCKCALLBACK nonblockcallback; /* [w] Optional. Specify 0 to ignore. Callback for successful completion, or error while loading a sound that used the FMOD_NONBLOCKING flag.*/ + public IntPtr dlsname; /* [w] Optional. Specify 0 to ignore. Filename for a DLS or SF2 sample set when loading a MIDI file. If not specified, on windows it will attempt to open /windows/system32/drivers/gm.dls, otherwise the MIDI will fail to open. */ + public IntPtr encryptionkey; /* [w] Optional. Specify 0 to ignore. Key for encrypted FSB file. Without this key an encrypted FSB file will not load. */ + public int maxpolyphony; /* [w] Optional. Specify 0 to ingore. For sequenced formats with dynamic channel allocation such as .MID and .IT, this specifies the maximum voice count allowed while playing. .IT defaults to 64. .MID defaults to 32. */ + public IntPtr userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the sound during creation. Access via Sound::getUserData. */ + public SOUND_TYPE suggestedsoundtype; /* [w] Optional. Specify 0 or FMOD_SOUND_TYPE_UNKNOWN to ignore. Instead of scanning all codec types, use this to speed up loading by making it jump straight to this codec. */ + public FILE_OPENCALLBACK fileuseropen; /* [w] Optional. Specify 0 to ignore. Callback for opening this file. */ + public FILE_CLOSECALLBACK fileuserclose; /* [w] Optional. Specify 0 to ignore. Callback for closing this file. */ + public FILE_READCALLBACK fileuserread; /* [w] Optional. Specify 0 to ignore. Callback for reading from this file. */ + public FILE_SEEKCALLBACK fileuserseek; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ + public FILE_ASYNCREADCALLBACK fileuserasyncread; /* [w] Optional. Specify 0 to ignore. Callback for asyncronously reading from this file. */ + public FILE_ASYNCCANCELCALLBACK fileuserasynccancel; /* [w] Optional. Specify 0 to ignore. Callback for cancelling an asyncronous read. */ + public IntPtr fileuserdata; /* [w] Optional. Specify 0 to ignore. User data to be passed into the file callbacks. */ + public CHANNELORDER channelorder; /* [w] Optional. Specify 0 to ignore. Use this to differ the way fmod maps multichannel sounds to speakers. See FMOD_CHANNELORDER for more. */ + public CHANNELMASK channelmask; /* [w] Optional. Specify 0 to ignore. Use this to differ the way fmod maps multichannel sounds to speakers. See FMOD_CHANNELMASK for more. */ + public IntPtr initialsoundgroup; /* [w] Optional. Specify 0 to ignore. Specify a sound group if required, to put sound in as it is created. */ + public uint initialseekposition; /* [w] Optional. Specify 0 to ignore. For streams. Specify an initial position to seek the stream to. */ + public TIMEUNIT initialseekpostype; /* [w] Optional. Specify 0 to ignore. For streams. Specify the time unit for the position set in initialseekposition. */ + public int ignoresetfilesystem; /* [w] Optional. Specify 0 to ignore. Set to 1 to use fmod's built in file system. Ignores setFileSystem callbacks and also FMOD_CREATESOUNEXINFO file callbacks. Useful for specific cases where you don't want to use your own file system but want to use fmod's file system (ie net streaming). */ + public uint audioqueuepolicy; /* [w] Optional. Specify 0 or FMOD_AUDIOQUEUE_CODECPOLICY_DEFAULT to ignore. Policy used to determine whether hardware or software is used for decoding, see FMOD_AUDIOQUEUE_CODECPOLICY for options (iOS >= 3.0 required, otherwise only hardware is available) */ + public uint minmidigranularity; /* [w] Optional. Specify 0 to ignore. Allows you to set a minimum desired MIDI mixer granularity. Values smaller than 512 give greater than default accuracy at the cost of more CPU and vise versa. Specify 0 for default (512 samples). */ + public int nonblockthreadid; /* [w] Optional. Specify 0 to ignore. Specifies a thread index to execute non blocking load on. Allows for up to 5 threads to be used for loading at once. This is to avoid one load blocking another. Maximum value = 4. */ + } + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure defining a reverb environment for FMOD_SOFTWARE based sounds only.
    + + [REMARKS] + Note the default reverb properties are the same as the FMOD_PRESET_GENERIC preset.
    + Note that integer values that typically range from -10,000 to 1000 are represented in decibels, + and are of a logarithmic scale, not linear, wheras float values are always linear.
    +
    + The numerical values listed below are the maximum, minimum and default values for each variable respectively.
    +
    + Hardware voice / Platform Specific reverb support.
    + WII See FMODWII.H for hardware specific reverb functionality.
    + 3DS See FMOD3DS.H for hardware specific reverb functionality.
    + PSP See FMODWII.H for hardware specific reverb functionality.
    +
    + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + Members marked with [r/w] are either read or write depending on if you are using System::setReverbProperties (w) or System::getReverbProperties (r). + + [SEE_ALSO] + System::setReverbProperties + System::getReverbProperties + FMOD_REVERB_PRESETS + ] + */ +#pragma warning disable 414 + [StructLayout(LayoutKind.Sequential)] + public struct REVERB_PROPERTIES + { /* MIN MAX DEFAULT DESCRIPTION */ + public float DecayTime; /* [r/w] 0.0 20000.0 1500.0 Reverberation decay time in ms */ + public float EarlyDelay; /* [r/w] 0.0 300.0 7.0 Initial reflection delay time */ + public float LateDelay; /* [r/w] 0.0 100 11.0 Late reverberation delay time relative to initial reflection */ + public float HFReference; /* [r/w] 20.0 20000.0 5000 Reference high frequency (hz) */ + public float HFDecayRatio; /* [r/w] 10.0 100.0 50.0 High-frequency to mid-frequency decay time ratio */ + public float Diffusion; /* [r/w] 0.0 100.0 100.0 Value that controls the echo density in the late reverberation decay. */ + public float Density; /* [r/w] 0.0 100.0 100.0 Value that controls the modal density in the late reverberation decay */ + public float LowShelfFrequency; /* [r/w] 20.0 1000.0 250.0 Reference low frequency (hz) */ + public float LowShelfGain; /* [r/w] -36.0 12.0 0.0 Relative room effect level at low frequencies */ + public float HighCut; /* [r/w] 20.0 20000.0 20000.0 Relative room effect level at high frequencies */ + public float EarlyLateMix; /* [r/w] 0.0 100.0 50.0 Early reflections level relative to room effect */ + public float WetLevel; /* [r/w] -80.0 20.0 -6.0 Room effect level (at mid frequencies) + * */ + #region wrapperinternal + public 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) + { + DecayTime = decayTime; + EarlyDelay = earlyDelay; + LateDelay = lateDelay; + HFReference = hfReference; + HFDecayRatio = hfDecayRatio; + Diffusion = diffusion; + Density = density; + LowShelfFrequency = lowShelfFrequency; + LowShelfGain = lowShelfGain; + HighCut = highCut; + EarlyLateMix = earlyLateMix; + WetLevel = wetLevel; + } + #endregion + } +#pragma warning restore 414 + + /* + [DEFINE] + [ + [NAME] + FMOD_REVERB_PRESETS + + [DESCRIPTION] + A set of predefined environment PARAMETERS, created by Creative Labs + These are used to initialize an FMOD_REVERB_PROPERTIES structure statically. + ie + FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_GENERIC; + + [SEE_ALSO] + System::setReverbProperties + ] + */ + public class PRESET + { + /* Instance Env Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel Revb RevDel ModTm ModDp HFRef LFRef Diffus Densty FLAGS */ + public static REVERB_PROPERTIES OFF() { return new REVERB_PROPERTIES( 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f );} + public static REVERB_PROPERTIES GENERIC() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f );} + public static REVERB_PROPERTIES PADDEDCELL() { return new REVERB_PROPERTIES( 170, 1, 2, 5000, 10, 100, 100, 250, 0, 160, 84, -7.8f );} + public static REVERB_PROPERTIES ROOM() { return new REVERB_PROPERTIES( 400, 2, 3, 5000, 83, 100, 100, 250, 0, 6050, 88, -9.4f );} + public static REVERB_PROPERTIES BATHROOM() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 54, 100, 60, 250, 0, 2900, 83, 0.5f );} + public static REVERB_PROPERTIES LIVINGROOM() { return new REVERB_PROPERTIES( 500, 3, 4, 5000, 10, 100, 100, 250, 0, 160, 58, -19.0f );} + public static REVERB_PROPERTIES STONEROOM() { return new REVERB_PROPERTIES( 2300, 12, 17, 5000, 64, 100, 100, 250, 0, 7800, 71, -8.5f );} + public static REVERB_PROPERTIES AUDITORIUM() { return new REVERB_PROPERTIES( 4300, 20, 30, 5000, 59, 100, 100, 250, 0, 5850, 64, -11.7f );} + public static REVERB_PROPERTIES CONCERTHALL() { return new REVERB_PROPERTIES( 3900, 20, 29, 5000, 70, 100, 100, 250, 0, 5650, 80, -9.8f );} + public static REVERB_PROPERTIES CAVE() { return new REVERB_PROPERTIES( 2900, 15, 22, 5000, 100, 100, 100, 250, 0, 20000, 59, -11.3f );} + public static REVERB_PROPERTIES ARENA() { return new REVERB_PROPERTIES( 7200, 20, 30, 5000, 33, 100, 100, 250, 0, 4500, 80, -9.6f );} + public static REVERB_PROPERTIES HANGAR() { return new REVERB_PROPERTIES( 10000, 20, 30, 5000, 23, 100, 100, 250, 0, 3400, 72, -7.4f );} + public static REVERB_PROPERTIES CARPETTEDHALLWAY() { return new REVERB_PROPERTIES( 300, 2, 30, 5000, 10, 100, 100, 250, 0, 500, 56, -24.0f );} + public static REVERB_PROPERTIES HALLWAY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 59, 100, 100, 250, 0, 7800, 87, -5.5f );} + public static REVERB_PROPERTIES STONECORRIDOR() { return new REVERB_PROPERTIES( 270, 13, 20, 5000, 79, 100, 100, 250, 0, 9000, 86, -6.0f );} + public static REVERB_PROPERTIES ALLEY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 86, 100, 100, 250, 0, 8300, 80, -9.8f );} + public static REVERB_PROPERTIES FOREST() { return new REVERB_PROPERTIES( 1500, 162, 88, 5000, 54, 79, 100, 250, 0, 760, 94, -12.3f );} + public static REVERB_PROPERTIES CITY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 67, 50, 100, 250, 0, 4050, 66, -26.0f );} + public static REVERB_PROPERTIES MOUNTAINS() { return new REVERB_PROPERTIES( 1500, 300, 100, 5000, 21, 27, 100, 250, 0, 1220, 82, -24.0f );} + public static REVERB_PROPERTIES QUARRY() { return new REVERB_PROPERTIES( 1500, 61, 25, 5000, 83, 100, 100, 250, 0, 3400, 100, -5.0f );} + public static REVERB_PROPERTIES PLAIN() { return new REVERB_PROPERTIES( 1500, 179, 100, 5000, 50, 21, 100, 250, 0, 1670, 65, -28.0f );} + public static REVERB_PROPERTIES PARKINGLOT() { return new REVERB_PROPERTIES( 1700, 8, 12, 5000, 100, 100, 100, 250, 0, 20000, 56, -19.5f );} + public static REVERB_PROPERTIES SEWERPIPE() { return new REVERB_PROPERTIES( 2800, 14, 21, 5000, 14, 80, 60, 250, 0, 3400, 66, 1.2f );} + public static REVERB_PROPERTIES UNDERWATER() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 10, 100, 100, 250, 0, 500, 92, 7.0f );} + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Settings for advanced features like configuring memory and cpu usage for the FMOD_CREATECOMPRESSEDSAMPLE feature. + + [REMARKS] + maxMPEGCodecs / maxADPCMCodecs / maxXMACodecs will determine the maximum cpu usage of playing realtime samples. Use this to lower potential excess cpu usage and also control memory usage.
    + + [SEE_ALSO] + System::setAdvancedSettings + System::getAdvancedSettings + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct ADVANCEDSETTINGS + { + public int cbSize; /* [w] Size of this structure. Use sizeof(FMOD_ADVANCEDSETTINGS) */ + public int maxMPEGCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. MPEG codecs consume 30,528 bytes per instance and this number will determine how many MPEG channels can be played simultaneously. Default = 32. */ + public int maxADPCMCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. ADPCM codecs consume 3,128 bytes per instance and this number will determine how many ADPCM channels can be played simultaneously. Default = 32. */ + public int maxXMACodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. XMA codecs consume 14,836 bytes per instance and this number will determine how many XMA channels can be played simultaneously. Default = 32. */ + public int maxVorbisCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. Vorbis codecs consume 23,256 bytes per instance and this number will determine how many Vorbis channels can be played simultaneously. Default = 32. */ + public int maxAT9Codecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. AT9 codecs consume 8,720 bytes per instance and this number will determine how many AT9 channels can be played simultaneously. Default = 32. */ + public int maxFADPCMCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. This number will determine how many FADPCM channels can be played simultaneously. Default = 32. */ + public int maxPCMCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with PS3 only. PCM codecs consume 12,672 bytes per instance and this number will determine how many streams and PCM voices can be played simultaneously. Default = 16. */ + public int ASIONumChannels; /* [r/w] Optional. Specify 0 to ignore. Number of channels available on the ASIO device. */ + public IntPtr ASIOChannelList; /* [r/w] Optional. Specify 0 to ignore. Pointer to an array of strings (number of entries defined by ASIONumChannels) with ASIO channel names. */ + public IntPtr ASIOSpeakerList; /* [r/w] Optional. Specify 0 to ignore. Pointer to a list of speakers that the ASIO channels map to. This can be called after System::init to remap ASIO output. */ + public float HRTFMinAngle; /* [r/w] Optional. For use with FMOD_INIT_HRTF_LOWPASS. The angle range (0-360) of a 3D sound in relation to the listener, at which the HRTF function begins to have an effect. 0 = in front of the listener. 180 = from 90 degrees to the left of the listener to 90 degrees to the right. 360 = behind the listener. Default = 180.0. */ + public float HRTFMaxAngle; /* [r/w] Optional. For use with FMOD_INIT_HRTF_LOWPASS. The angle range (0-360) of a 3D sound in relation to the listener, at which the HRTF function has maximum effect. 0 = front of the listener. 180 = from 90 degrees to the left of the listener to 90 degrees to the right. 360 = behind the listener. Default = 360.0. */ + public float HRTFFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_HRTF_LOWPASS. The cutoff frequency of the HRTF's lowpass filter function when at maximum effect. (i.e. at HRTFMaxAngle). Default = 4000.0. */ + public float vol0virtualvol; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_VOL0_BECOMES_VIRTUAL. If this flag is used, and the volume is below this, then the sound will become virtual. Use this value to raise the threshold to a different point where a sound goes virtual. */ + public uint defaultDecodeBufferSize; /* [r/w] Optional. Specify 0 to ignore. For streams. This determines the default size of the double buffer (in milliseconds) that a stream uses. Default = 400ms */ + public ushort profilePort; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_PROFILE_ENABLE. Specify the port to listen on for connections by the profiler application. */ + public uint geometryMaxFadeTime; /* [r/w] Optional. Specify 0 to ignore. The maximum time in miliseconds it takes for a channel to fade to the new level when its occlusion changes. */ + public float distanceFilterCenterFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_DISTANCE_FILTERING. The default center frequency in Hz for the distance filtering effect. Default = 1500.0. */ + public int reverb3Dinstance; /* [r/w] Optional. Specify 0 to ignore. Out of 0 to 3, 3d reverb spheres will create a phyical reverb unit on this instance slot. See FMOD_REVERB_PROPERTIES. */ + public int DSPBufferPoolSize; /* [r/w] Optional. Specify 0 to ignore. Number of buffers in DSP buffer pool. Each buffer will be DSPBlockSize * sizeof(float) * SpeakerModeChannelCount. ie 7.1 @ 1024 DSP block size = 8 * 1024 * 4 = 32kb. Default = 8. */ + public uint stackSizeStream; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD Stream thread in bytes. Useful for custom codecs that use excess stack. Default 49,152 (48kb) */ + public uint stackSizeNonBlocking; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD_NONBLOCKING loading thread. Useful for custom codecs that use excess stack. Default 65,536 (64kb) */ + public uint stackSizeMixer; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD mixer thread. Useful for custom dsps that use excess stack. Default 49,152 (48kb) */ + public DSP_RESAMPLER resamplerMethod; /* [r/w] Optional. Specify 0 to ignore. Resampling method used with fmod's software mixer. See FMOD_DSP_RESAMPLER for details on methods. */ + public uint commandQueueSize; /* [r/w] Optional. Specify 0 to ignore. Specify the command queue size for thread safe processing. Default 2048 (2kb) */ + public uint randomSeed; /* [r/w] Optional. Specify 0 to ignore. Seed value that FMOD will use to initialize its internal random number generators. */ + } + + /* + [DEFINE] + [ + [NAME] + FMOD_DRIVER_STATE + + [DESCRIPTION] + Flags that provide additional information about a particular driver. + + [REMARKS] + + [SEE_ALSO] + System::getRecordDriverInfo + ] + */ + [Flags] + public enum DRIVER_STATE : uint + { + CONNECTED = 0x00000001, /* Device is currently plugged in. */ + DEFAULT = 0x00000002, /* Device is the users preferred choice. */ + } + + /* + FMOD System factory functions. Use this to create an FMOD System Instance. below you will see System init/close to get started. + */ + public class Factory + { + public static RESULT System_Create(out System system) + { + system = null; + + RESULT result = RESULT.OK; + IntPtr rawPtr = new IntPtr(); + + result = FMOD_System_Create(out rawPtr); + if (result != RESULT.OK) + { + return result; + } + + system = new System(rawPtr); + + return result; + } + + + #region importfunctions + + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Create (out IntPtr system); + + #endregion + } + + public class Memory + { + public static RESULT Initialize(IntPtr poolmem, int poollen, MEMORY_ALLOC_CALLBACK useralloc, MEMORY_REALLOC_CALLBACK userrealloc, MEMORY_FREE_CALLBACK userfree, MEMORY_TYPE memtypeflags) + { + return FMOD_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree, memtypeflags); + } + + public static RESULT GetStats(out int currentalloced, out int maxalloced) + { + return GetStats(out currentalloced, out maxalloced, false); + } + + public static RESULT GetStats(out int currentalloced, out int maxalloced, bool blocking) + { + return FMOD_Memory_GetStats(out currentalloced, out maxalloced, blocking); + } + + + #region importfunctions + + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Memory_Initialize(IntPtr poolmem, int poollen, MEMORY_ALLOC_CALLBACK useralloc, MEMORY_REALLOC_CALLBACK userrealloc, MEMORY_FREE_CALLBACK userfree, MEMORY_TYPE memtypeflags); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Memory_GetStats(out int currentalloced, out int maxalloced, bool blocking); + + #endregion + } + + public class Debug + { + public static RESULT Initialize(DEBUG_FLAGS flags, DEBUG_MODE mode, DEBUG_CALLBACK callback, string filename) + { + return FMOD_Debug_Initialize(flags, mode, callback, filename); + } + + + #region importfunctions + + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Debug_Initialize(DEBUG_FLAGS flags, DEBUG_MODE mode, DEBUG_CALLBACK callback, string filename); + + #endregion + } + + public class HandleBase + { + public HandleBase(IntPtr newPtr) + { + rawPtr = newPtr; + } + + public bool isValid() + { + return rawPtr != IntPtr.Zero; + } + + public IntPtr getRaw() + { + return rawPtr; + } + + protected IntPtr rawPtr; + + #region equality + + public override bool Equals(Object obj) + { + return Equals(obj as HandleBase); + } + public bool Equals(HandleBase p) + { + // Equals if p not null and handle is the same + return ((object)p != null && rawPtr == p.rawPtr); + } + public override int GetHashCode() + { + return rawPtr.ToInt32(); + } + public static bool operator ==(HandleBase a, HandleBase b) + { + // If both are null, or both are same instance, return true. + if (Object.ReferenceEquals(a, b)) + { + return true; + } + // If one is null, but not both, return false. + if (((object)a == null) || ((object)b == null)) + { + return false; + } + // Return true if the handle matches + return (a.rawPtr == b.rawPtr); + } + public static bool operator !=(HandleBase a, HandleBase b) + { + return !(a == b); + } + #endregion + + } + + /* + 'System' API. + */ + public class System : HandleBase + { + public RESULT release () + { + RESULT result = FMOD_System_Release(rawPtr); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + + + // Pre-init functions. + public RESULT setOutput (OUTPUTTYPE output) + { + return FMOD_System_SetOutput(rawPtr, output); + } + public RESULT getOutput (out OUTPUTTYPE output) + { + return FMOD_System_GetOutput(rawPtr, out output); + } + public RESULT getNumDrivers (out int numdrivers) + { + return FMOD_System_GetNumDrivers(rawPtr, out numdrivers); + } + public RESULT getDriverInfo (int id, StringBuilder name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_System_GetDriverInfo(rawPtr, id, stringMem, namelen, out guid, out systemrate, out speakermode, out speakermodechannels); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT setDriver (int driver) + { + return FMOD_System_SetDriver(rawPtr, driver); + } + public RESULT getDriver (out int driver) + { + return FMOD_System_GetDriver(rawPtr, out driver); + } + public RESULT setSoftwareChannels (int numsoftwarechannels) + { + return FMOD_System_SetSoftwareChannels(rawPtr, numsoftwarechannels); + } + public RESULT getSoftwareChannels (out int numsoftwarechannels) + { + return FMOD_System_GetSoftwareChannels(rawPtr, out numsoftwarechannels); + } + public RESULT setSoftwareFormat (int samplerate, SPEAKERMODE speakermode, int numrawspeakers) + { + return FMOD_System_SetSoftwareFormat(rawPtr, samplerate, speakermode, numrawspeakers); + } + public RESULT getSoftwareFormat (out int samplerate, out SPEAKERMODE speakermode, out int numrawspeakers) + { + return FMOD_System_GetSoftwareFormat(rawPtr, out samplerate, out speakermode, out numrawspeakers); + } + public RESULT setDSPBufferSize (uint bufferlength, int numbuffers) + { + return FMOD_System_SetDSPBufferSize(rawPtr, bufferlength, numbuffers); + } + public RESULT getDSPBufferSize (out uint bufferlength, out int numbuffers) + { + return FMOD_System_GetDSPBufferSize(rawPtr, out bufferlength, out numbuffers); + } + public RESULT setFileSystem (FILE_OPENCALLBACK useropen, FILE_CLOSECALLBACK userclose, FILE_READCALLBACK userread, FILE_SEEKCALLBACK userseek, FILE_ASYNCREADCALLBACK userasyncread, FILE_ASYNCCANCELCALLBACK userasynccancel, int blockalign) + { + return FMOD_System_SetFileSystem(rawPtr, useropen, userclose, userread, userseek, userasyncread, userasynccancel, blockalign); + } + public RESULT attachFileSystem (FILE_OPENCALLBACK useropen, FILE_CLOSECALLBACK userclose, FILE_READCALLBACK userread, FILE_SEEKCALLBACK userseek) + { + return FMOD_System_AttachFileSystem(rawPtr, useropen, userclose, userread, userseek); + } + public RESULT setAdvancedSettings (ref ADVANCEDSETTINGS settings) + { + settings.cbSize = Marshal.SizeOf(settings); + return FMOD_System_SetAdvancedSettings(rawPtr, ref settings); + } + public RESULT getAdvancedSettings (ref ADVANCEDSETTINGS settings) + { + settings.cbSize = Marshal.SizeOf(settings); + return FMOD_System_GetAdvancedSettings(rawPtr, ref settings); + } + public RESULT setCallback (SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask) + { + return FMOD_System_SetCallback(rawPtr, callback, callbackmask); + } + + // Plug-in support. + public RESULT setPluginPath (string path) + { + return FMOD_System_SetPluginPath(rawPtr, Encoding.UTF8.GetBytes(path + Char.MinValue)); + } + public RESULT loadPlugin (string filename, out uint handle, uint priority) + { + return FMOD_System_LoadPlugin(rawPtr, Encoding.UTF8.GetBytes(filename + Char.MinValue), out handle, priority); + } + public RESULT loadPlugin (string filename, out uint handle) + { + return loadPlugin(filename, out handle, 0); + } + public RESULT unloadPlugin (uint handle) + { + return FMOD_System_UnloadPlugin(rawPtr, handle); + } + public RESULT getNumPlugins (PLUGINTYPE plugintype, out int numplugins) + { + return FMOD_System_GetNumPlugins(rawPtr, plugintype, out numplugins); + } + public RESULT getPluginHandle (PLUGINTYPE plugintype, int index, out uint handle) + { + return FMOD_System_GetPluginHandle(rawPtr, plugintype, index, out handle); + } + public RESULT getPluginInfo (uint handle, out PLUGINTYPE plugintype, StringBuilder name, int namelen, out uint version) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_System_GetPluginInfo(rawPtr, handle, out plugintype, stringMem, namelen, out version); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT setOutputByPlugin (uint handle) + { + return FMOD_System_SetOutputByPlugin(rawPtr, handle); + } + public RESULT getOutputByPlugin (out uint handle) + { + return FMOD_System_GetOutputByPlugin(rawPtr, out handle); + } + public RESULT createDSPByPlugin(uint handle, out DSP dsp) + { + dsp = null; + + IntPtr dspraw; + RESULT result = FMOD_System_CreateDSPByPlugin(rawPtr, handle, out dspraw); + dsp = new DSP(dspraw); + + return result; + } + public RESULT getDSPInfoByPlugin(uint handle, out IntPtr description) + { + return FMOD_System_GetDSPInfoByPlugin(rawPtr, handle, out description); + } + /* + public RESULT registerCodec(ref CODEC_DESCRIPTION description, out uint handle, uint priority) + { + return FMOD_System_RegisterCodec(rawPtr, ref description, out handle, priority); + } + */ + public RESULT registerDSP(ref DSP_DESCRIPTION description, out uint handle) + { + return FMOD_System_RegisterDSP(rawPtr, ref description, out handle); + } + /* + public RESULT registerOutput(ref OUTPUT_DESCRIPTION description, out uint handle) + { + return FMOD_System_RegisterOutput(rawPtr, ref description, out handle); + } + */ + + // Init/Close. + public RESULT init (int maxchannels, INITFLAGS flags, IntPtr extradriverdata) + { + return FMOD_System_Init(rawPtr, maxchannels, flags, extradriverdata); + } + public RESULT close () + { + return FMOD_System_Close(rawPtr); + } + + + // General post-init system functions. + public RESULT update () + { + return FMOD_System_Update(rawPtr); + } + + public RESULT setSpeakerPosition(SPEAKER speaker, float x, float y, bool active) + { + return FMOD_System_SetSpeakerPosition(rawPtr, speaker, x, y, active); + } + public RESULT getSpeakerPosition(SPEAKER speaker, out float x, out float y, out bool active) + { + return FMOD_System_GetSpeakerPosition(rawPtr, speaker, out x, out y, out active); + } + public RESULT setStreamBufferSize(uint filebuffersize, TIMEUNIT filebuffersizetype) + { + return FMOD_System_SetStreamBufferSize(rawPtr, filebuffersize, filebuffersizetype); + } + public RESULT getStreamBufferSize(out uint filebuffersize, out TIMEUNIT filebuffersizetype) + { + return FMOD_System_GetStreamBufferSize(rawPtr, out filebuffersize, out filebuffersizetype); + } + public RESULT set3DSettings (float dopplerscale, float distancefactor, float rolloffscale) + { + return FMOD_System_Set3DSettings(rawPtr, dopplerscale, distancefactor, rolloffscale); + } + public RESULT get3DSettings (out float dopplerscale, out float distancefactor, out float rolloffscale) + { + return FMOD_System_Get3DSettings(rawPtr, out dopplerscale, out distancefactor, out rolloffscale); + } + public RESULT set3DNumListeners (int numlisteners) + { + return FMOD_System_Set3DNumListeners(rawPtr, numlisteners); + } + public RESULT get3DNumListeners (out int numlisteners) + { + return FMOD_System_Get3DNumListeners(rawPtr, out numlisteners); + } + public RESULT set3DListenerAttributes(int listener, ref VECTOR pos, ref VECTOR vel, ref VECTOR forward, ref VECTOR up) + { + return FMOD_System_Set3DListenerAttributes(rawPtr, listener, ref pos, ref vel, ref forward, ref up); + } + public RESULT get3DListenerAttributes(int listener, out VECTOR pos, out VECTOR vel, out VECTOR forward, out VECTOR up) + { + return FMOD_System_Get3DListenerAttributes(rawPtr, listener, out pos, out vel, out forward, out up); + } + public RESULT set3DRolloffCallback (CB_3D_ROLLOFFCALLBACK callback) + { + return FMOD_System_Set3DRolloffCallback (rawPtr, callback); + } + public RESULT mixerSuspend () + { + return FMOD_System_MixerSuspend(rawPtr); + } + public RESULT mixerResume () + { + return FMOD_System_MixerResume(rawPtr); + } + public RESULT getDefaultMixMatrix (SPEAKERMODE sourcespeakermode, SPEAKERMODE targetspeakermode, float[] matrix, int matrixhop) + { + return FMOD_System_GetDefaultMixMatrix(rawPtr, sourcespeakermode, targetspeakermode, matrix, matrixhop); + } + public RESULT getSpeakerModeChannels (SPEAKERMODE mode, out int channels) + { + return FMOD_System_GetSpeakerModeChannels(rawPtr, mode, out channels); + } + + // System information functions. + public RESULT getVersion (out uint version) + { + return FMOD_System_GetVersion(rawPtr, out version); + } + public RESULT getOutputHandle (out IntPtr handle) + { + return FMOD_System_GetOutputHandle(rawPtr, out handle); + } + public RESULT getChannelsPlaying (out int channels) + { + return FMOD_System_GetChannelsPlaying(rawPtr, out channels); + } + public RESULT getChannelsReal (out int channels) + { + return FMOD_System_GetChannelsReal(rawPtr, out channels); + } + public RESULT getCPUUsage (out float dsp, out float stream, out float geometry, out float update, out float total) + { + return FMOD_System_GetCPUUsage(rawPtr, out dsp, out stream, out geometry, out update, out total); + } + public RESULT getSoundRAM (out int currentalloced, out int maxalloced, out int total) + { + return FMOD_System_GetSoundRAM(rawPtr, out currentalloced, out maxalloced, out total); + } + + // Sound/DSP/Channel/FX creation and retrieval. + public RESULT createSound (string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + sound = null; + + byte[] stringData; + stringData = Encoding.UTF8.GetBytes(name + Char.MinValue); + + exinfo.cbsize = Marshal.SizeOf(exinfo); + + IntPtr soundraw; + RESULT result = FMOD_System_CreateSound(rawPtr, stringData, mode, ref exinfo, out soundraw); + sound = new Sound(soundraw); + + return result; + } + public RESULT createSound (byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + sound = null; + + exinfo.cbsize = Marshal.SizeOf(exinfo); + + IntPtr soundraw; + RESULT result = FMOD_System_CreateSound(rawPtr, data, mode, ref exinfo, out soundraw); + sound = new Sound(soundraw); + + return result; + } + public RESULT createSound (string name, MODE mode, out Sound sound) + { + CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); + exinfo.cbsize = Marshal.SizeOf(exinfo); + + return createSound(name, mode, ref exinfo, out sound); + } + public RESULT createStream (string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + sound = null; + + byte[] stringData; + stringData = Encoding.UTF8.GetBytes(name + Char.MinValue); + + exinfo.cbsize = Marshal.SizeOf(exinfo); + + IntPtr soundraw; + RESULT result = FMOD_System_CreateStream(rawPtr, stringData, mode, ref exinfo, out soundraw); + sound = new Sound(soundraw); + + return result; + } + public RESULT createStream (byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + sound = null; + + exinfo.cbsize = Marshal.SizeOf(exinfo); + + IntPtr soundraw; + RESULT result = FMOD_System_CreateStream(rawPtr, data, mode, ref exinfo, out soundraw); + sound = new Sound(soundraw); + + return result; + } + public RESULT createStream (string name, MODE mode, out Sound sound) + { + CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); + exinfo.cbsize = Marshal.SizeOf(exinfo); + + return createStream(name, mode, ref exinfo, out sound); + } + public RESULT createDSP (ref DSP_DESCRIPTION description, out DSP dsp) + { + dsp = null; + + IntPtr dspraw; + RESULT result = FMOD_System_CreateDSP(rawPtr, ref description, out dspraw); + dsp = new DSP(dspraw); + + return result; + } + public RESULT createDSPByType (DSP_TYPE type, out DSP dsp) + { + dsp = null; + + IntPtr dspraw; + RESULT result = FMOD_System_CreateDSPByType(rawPtr, type, out dspraw); + dsp = new DSP(dspraw); + + return result; + } + public RESULT createChannelGroup (string name, out ChannelGroup channelgroup) + { + channelgroup = null; + + byte[] stringData = Encoding.UTF8.GetBytes(name + Char.MinValue); + + IntPtr channelgroupraw; + RESULT result = FMOD_System_CreateChannelGroup(rawPtr, stringData, out channelgroupraw); + channelgroup = new ChannelGroup(channelgroupraw); + + return result; + } + public RESULT createSoundGroup (string name, out SoundGroup soundgroup) + { + soundgroup = null; + + byte[] stringData = Encoding.UTF8.GetBytes(name + Char.MinValue); + + IntPtr soundgroupraw; + RESULT result = FMOD_System_CreateSoundGroup(rawPtr, stringData, out soundgroupraw); + soundgroup = new SoundGroup(soundgroupraw); + + return result; + } + public RESULT createReverb3D (out Reverb3D reverb) + { + IntPtr reverbraw; + RESULT result = FMOD_System_CreateReverb3D(rawPtr, out reverbraw); + reverb = new Reverb3D(reverbraw); + + return result; + } + public RESULT playSound (Sound sound, ChannelGroup channelGroup, bool paused, out Channel channel) + { + channel = null; + + IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : IntPtr.Zero; + + IntPtr channelraw; + RESULT result = FMOD_System_PlaySound(rawPtr, sound.getRaw(), channelGroupRaw, paused, out channelraw); + channel = new Channel(channelraw); + + return result; + } + public RESULT playDSP (DSP dsp, ChannelGroup channelGroup, bool paused, out Channel channel) + { + channel = null; + + IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : IntPtr.Zero; + + IntPtr channelraw; + RESULT result = FMOD_System_PlayDSP(rawPtr, dsp.getRaw(), channelGroupRaw, paused, out channelraw); + channel = new Channel(channelraw); + + return result; + } + public RESULT getChannel (int channelid, out Channel channel) + { + channel = null; + + IntPtr channelraw; + RESULT result = FMOD_System_GetChannel(rawPtr, channelid, out channelraw); + channel = new Channel(channelraw); + + return result; + } + public RESULT getMasterChannelGroup (out ChannelGroup channelgroup) + { + channelgroup = null; + + IntPtr channelgroupraw; + RESULT result = FMOD_System_GetMasterChannelGroup(rawPtr, out channelgroupraw); + channelgroup = new ChannelGroup(channelgroupraw); + + return result; + } + public RESULT getMasterSoundGroup (out SoundGroup soundgroup) + { + soundgroup = null; + + IntPtr soundgroupraw; + RESULT result = FMOD_System_GetMasterSoundGroup(rawPtr, out soundgroupraw); + soundgroup = new SoundGroup(soundgroupraw); + + return result; + } + + // Routing to ports. + public RESULT attachChannelGroupToPort(uint portType, ulong portIndex, ChannelGroup channelgroup, bool passThru = false) + { + return FMOD_System_AttachChannelGroupToPort(rawPtr, portType, portIndex, channelgroup.getRaw(), passThru); + } + public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup) + { + return FMOD_System_DetachChannelGroupFromPort(rawPtr, channelgroup.getRaw()); + } + + // Reverb api. + public RESULT setReverbProperties (int instance, ref REVERB_PROPERTIES prop) + { + return FMOD_System_SetReverbProperties(rawPtr, instance, ref prop); + } + public RESULT getReverbProperties (int instance, out REVERB_PROPERTIES prop) + { + return FMOD_System_GetReverbProperties(rawPtr, instance, out prop); + } + + // System level DSP functionality. + public RESULT lockDSP () + { + return FMOD_System_LockDSP(rawPtr); + } + public RESULT unlockDSP () + { + return FMOD_System_UnlockDSP(rawPtr); + } + + // Recording api + public RESULT getRecordNumDrivers (out int numdrivers, out int numconnected) + { + return FMOD_System_GetRecordNumDrivers(rawPtr, out numdrivers, out numconnected); + } + public RESULT getRecordDriverInfo(int id, StringBuilder name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_System_GetRecordDriverInfo(rawPtr, id, stringMem, namelen, out guid, out systemrate, out speakermode, out speakermodechannels, out state); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getRecordPosition (int id, out uint position) + { + return FMOD_System_GetRecordPosition(rawPtr, id, out position); + } + public RESULT recordStart (int id, Sound sound, bool loop) + { + return FMOD_System_RecordStart(rawPtr, id, sound.getRaw(), loop); + } + public RESULT recordStop (int id) + { + return FMOD_System_RecordStop(rawPtr, id); + } + public RESULT isRecording (int id, out bool recording) + { + return FMOD_System_IsRecording(rawPtr, id, out recording); + } + + // Geometry api + public RESULT createGeometry (int maxpolygons, int maxvertices, out Geometry geometry) + { + geometry = null; + + IntPtr geometryraw; + RESULT result = FMOD_System_CreateGeometry(rawPtr, maxpolygons, maxvertices, out geometryraw); + geometry = new Geometry(geometryraw); + + return result; + } + public RESULT setGeometrySettings (float maxworldsize) + { + return FMOD_System_SetGeometrySettings(rawPtr, maxworldsize); + } + public RESULT getGeometrySettings (out float maxworldsize) + { + return FMOD_System_GetGeometrySettings(rawPtr, out maxworldsize); + } + public RESULT loadGeometry(IntPtr data, int datasize, out Geometry geometry) + { + geometry = null; + + IntPtr geometryraw; + RESULT result = FMOD_System_LoadGeometry(rawPtr, data, datasize, out geometryraw); + geometry = new Geometry(geometryraw); + + return result; + } + public RESULT getGeometryOcclusion (ref VECTOR listener, ref VECTOR source, out float direct, out float reverb) + { + return FMOD_System_GetGeometryOcclusion(rawPtr, ref listener, ref source, out direct, out reverb); + } + + // Network functions + public RESULT setNetworkProxy (string proxy) + { + return FMOD_System_SetNetworkProxy(rawPtr, Encoding.UTF8.GetBytes(proxy + Char.MinValue)); + } + public RESULT getNetworkProxy (StringBuilder proxy, int proxylen) + { + IntPtr stringMem = Marshal.AllocHGlobal(proxy.Capacity); + + RESULT result = FMOD_System_GetNetworkProxy(rawPtr, stringMem, proxylen); + + StringMarshalHelper.NativeToBuilder(proxy, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT setNetworkTimeout (int timeout) + { + return FMOD_System_SetNetworkTimeout(rawPtr, timeout); + } + public RESULT getNetworkTimeout(out int timeout) + { + return FMOD_System_GetNetworkTimeout(rawPtr, out timeout); + } + + // Userdata set/get + public RESULT setUserData (IntPtr userdata) + { + return FMOD_System_SetUserData(rawPtr, userdata); + } + public RESULT getUserData (out IntPtr userdata) + { + return FMOD_System_GetUserData(rawPtr, out userdata); + } + + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Release (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetOutput (IntPtr system, OUTPUTTYPE output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetOutput (IntPtr system, out OUTPUTTYPE output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetNumDrivers (IntPtr system, out int numdrivers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetDriverInfo (IntPtr system, int id, IntPtr name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetDriver (IntPtr system, int driver); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetDriver (IntPtr system, out int driver); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetSoftwareChannels (IntPtr system, int numsoftwarechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetSoftwareChannels (IntPtr system, out int numsoftwarechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetSoftwareFormat (IntPtr system, int samplerate, SPEAKERMODE speakermode, int numrawspeakers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetSoftwareFormat (IntPtr system, out int samplerate, out SPEAKERMODE speakermode, out int numrawspeakers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetDSPBufferSize (IntPtr system, uint bufferlength, int numbuffers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetDSPBufferSize (IntPtr system, out uint bufferlength, out int numbuffers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetFileSystem (IntPtr system, FILE_OPENCALLBACK useropen, FILE_CLOSECALLBACK userclose, FILE_READCALLBACK userread, FILE_SEEKCALLBACK userseek, FILE_ASYNCREADCALLBACK userasyncread, FILE_ASYNCCANCELCALLBACK userasynccancel, int blockalign); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_AttachFileSystem (IntPtr system, FILE_OPENCALLBACK useropen, FILE_CLOSECALLBACK userclose, FILE_READCALLBACK userread, FILE_SEEKCALLBACK userseek); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetPluginPath (IntPtr system, byte[] path); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_LoadPlugin (IntPtr system, byte[] filename, out uint handle, uint priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_UnloadPlugin (IntPtr system, uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetNumPlugins (IntPtr system, PLUGINTYPE plugintype, out int numplugins); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetPluginHandle (IntPtr system, PLUGINTYPE plugintype, int index, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetPluginInfo (IntPtr system, uint handle, out PLUGINTYPE plugintype, IntPtr name, int namelen, out uint version); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateDSPByPlugin (IntPtr system, uint handle, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetOutputByPlugin (IntPtr system, uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetOutputByPlugin (IntPtr system, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetDSPInfoByPlugin (IntPtr system, uint handle, out IntPtr description); + [DllImport(VERSION.dll)] + //private static extern RESULT FMOD_System_RegisterCodec (IntPtr system, out CODEC_DESCRIPTION description, out uint handle, uint priority); + //[DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_RegisterDSP (IntPtr system, ref DSP_DESCRIPTION description, out uint handle); + [DllImport(VERSION.dll)] + //private static extern RESULT FMOD_System_RegisterOutput (IntPtr system, ref OUTPUT_DESCRIPTION description, out uint handle); + //[DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Init (IntPtr system, int maxchannels, INITFLAGS flags, IntPtr extradriverdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Close (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Update (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Set3DRolloffCallback (IntPtr system, CB_3D_ROLLOFFCALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_MixerSuspend (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_MixerResume (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetDefaultMixMatrix (IntPtr system, SPEAKERMODE sourcespeakermode, SPEAKERMODE targetspeakermode, float[] matrix, int matrixhop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetSpeakerModeChannels (IntPtr system, SPEAKERMODE mode, out int channels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetCallback (IntPtr system, SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetSpeakerPosition (IntPtr system, SPEAKER speaker, float x, float y, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetSpeakerPosition (IntPtr system, SPEAKER speaker, out float x, out float y, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Set3DSettings (IntPtr system, float dopplerscale, float distancefactor, float rolloffscale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Get3DSettings (IntPtr system, out float dopplerscale, out float distancefactor, out float rolloffscale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Set3DNumListeners (IntPtr system, int numlisteners); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Get3DNumListeners (IntPtr system, out int numlisteners); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Set3DListenerAttributes(IntPtr system, int listener, ref VECTOR pos, ref VECTOR vel, ref VECTOR forward, ref VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_Get3DListenerAttributes(IntPtr system, int listener, out VECTOR pos, out VECTOR vel, out VECTOR forward, out VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetStreamBufferSize (IntPtr system, uint filebuffersize, TIMEUNIT filebuffersizetype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetStreamBufferSize (IntPtr system, out uint filebuffersize, out TIMEUNIT filebuffersizetype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetVersion (IntPtr system, out uint version); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetOutputHandle (IntPtr system, out IntPtr handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetChannelsPlaying (IntPtr system, out int channels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetChannelsReal (IntPtr system, out int channels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetCPUUsage (IntPtr system, out float dsp, out float stream, out float geometry, out float update, out float total); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetSoundRAM (IntPtr system, out int currentalloced, out int maxalloced, out int total); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateSound (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateStream (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateDSP (IntPtr system, ref DSP_DESCRIPTION description, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateDSPByType (IntPtr system, DSP_TYPE type, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateChannelGroup (IntPtr system, byte[] name, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateSoundGroup (IntPtr system, byte[] name, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateReverb3D (IntPtr system, out IntPtr reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_PlaySound (IntPtr system, IntPtr sound, IntPtr channelGroup, bool paused, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_PlayDSP (IntPtr system, IntPtr dsp, IntPtr channelGroup, bool paused, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetChannel (IntPtr system, int channelid, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetMasterChannelGroup (IntPtr system, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetMasterSoundGroup (IntPtr system, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_AttachChannelGroupToPort (IntPtr system, uint portType, ulong portIndex, IntPtr channelgroup, bool passThru); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_DetachChannelGroupFromPort(IntPtr system, IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetReverbProperties (IntPtr system, int instance, ref REVERB_PROPERTIES prop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetReverbProperties (IntPtr system, int instance, out REVERB_PROPERTIES prop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_LockDSP (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_UnlockDSP (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetRecordNumDrivers (IntPtr system, out int numdrivers, out int numconnected); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetRecordDriverInfo (IntPtr system, int id, IntPtr name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetRecordPosition (IntPtr system, int id, out uint position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_RecordStart (IntPtr system, int id, IntPtr sound, bool loop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_RecordStop (IntPtr system, int id); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_IsRecording (IntPtr system, int id, out bool recording); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_CreateGeometry (IntPtr system, int maxpolygons, int maxvertices, out IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetGeometrySettings (IntPtr system, float maxworldsize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetGeometrySettings (IntPtr system, out float maxworldsize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_LoadGeometry (IntPtr system, IntPtr data, int datasize, out IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetGeometryOcclusion (IntPtr system, ref VECTOR listener, ref VECTOR source, out float direct, out float reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetNetworkProxy (IntPtr system, byte[] proxy); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetNetworkProxy (IntPtr system, IntPtr proxy, int proxylen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetNetworkTimeout (IntPtr system, int timeout); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetNetworkTimeout (IntPtr system, out int timeout); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_SetUserData (IntPtr system, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_System_GetUserData (IntPtr system, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public System(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'Sound' API. + */ + public class Sound : HandleBase + { + public RESULT release () + { + RESULT result = FMOD_Sound_Release(rawPtr); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + public RESULT getSystemObject (out System system) + { + system = null; + + IntPtr systemraw; + RESULT result = FMOD_Sound_GetSystemObject(rawPtr, out systemraw); + system = new System(systemraw); + + return result; + } + + // Standard sound manipulation functions. + public RESULT @lock (uint offset, uint length, out IntPtr ptr1, out IntPtr ptr2, out uint len1, out uint len2) + { + return FMOD_Sound_Lock(rawPtr, offset, length, out ptr1, out ptr2, out len1, out len2); + } + public RESULT unlock (IntPtr ptr1, IntPtr ptr2, uint len1, uint len2) + { + return FMOD_Sound_Unlock(rawPtr, ptr1, ptr2, len1, len2); + } + public RESULT setDefaults (float frequency, int priority) + { + return FMOD_Sound_SetDefaults(rawPtr, frequency, priority); + } + public RESULT getDefaults (out float frequency, out int priority) + { + return FMOD_Sound_GetDefaults(rawPtr, out frequency, out priority); + } + public RESULT set3DMinMaxDistance (float min, float max) + { + return FMOD_Sound_Set3DMinMaxDistance(rawPtr, min, max); + } + public RESULT get3DMinMaxDistance (out float min, out float max) + { + return FMOD_Sound_Get3DMinMaxDistance(rawPtr, out min, out max); + } + public RESULT set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD_Sound_Set3DConeSettings(rawPtr, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings (out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD_Sound_Get3DConeSettings(rawPtr, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DCustomRolloff (ref VECTOR points, int numpoints) + { + return FMOD_Sound_Set3DCustomRolloff(rawPtr, ref points, numpoints); + } + public RESULT get3DCustomRolloff (out IntPtr points, out int numpoints) + { + return FMOD_Sound_Get3DCustomRolloff(rawPtr, out points, out numpoints); + } + public RESULT getSubSound (int index, out Sound subsound) + { + subsound = null; + + IntPtr subsoundraw; + RESULT result = FMOD_Sound_GetSubSound(rawPtr, index, out subsoundraw); + subsound = new Sound(subsoundraw); + + return result; + } + public RESULT getSubSoundParent(out Sound parentsound) + { + parentsound = null; + + IntPtr subsoundraw; + RESULT result = FMOD_Sound_GetSubSoundParent(rawPtr, out subsoundraw); + parentsound = new Sound(subsoundraw); + + return result; + } + public RESULT getName (StringBuilder name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_Sound_GetName(rawPtr, stringMem, namelen); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getLength (out uint length, TIMEUNIT lengthtype) + { + return FMOD_Sound_GetLength(rawPtr, out length, lengthtype); + } + public RESULT getFormat (out SOUND_TYPE type, out SOUND_FORMAT format, out int channels, out int bits) + { + return FMOD_Sound_GetFormat(rawPtr, out type, out format, out channels, out bits); + } + public RESULT getNumSubSounds (out int numsubsounds) + { + return FMOD_Sound_GetNumSubSounds(rawPtr, out numsubsounds); + } + public RESULT getNumTags (out int numtags, out int numtagsupdated) + { + return FMOD_Sound_GetNumTags(rawPtr, out numtags, out numtagsupdated); + } + public RESULT getTag (string name, int index, out TAG tag) + { + return FMOD_Sound_GetTag(rawPtr, name, index, out tag); + } + public RESULT getOpenState (out OPENSTATE openstate, out uint percentbuffered, out bool starving, out bool diskbusy) + { + return FMOD_Sound_GetOpenState(rawPtr, out openstate, out percentbuffered, out starving, out diskbusy); + } + public RESULT readData (IntPtr buffer, uint lenbytes, out uint read) + { + return FMOD_Sound_ReadData(rawPtr, buffer, lenbytes, out read); + } + public RESULT seekData (uint pcm) + { + return FMOD_Sound_SeekData(rawPtr, pcm); + } + public RESULT setSoundGroup (SoundGroup soundgroup) + { + return FMOD_Sound_SetSoundGroup(rawPtr, soundgroup.getRaw()); + } + public RESULT getSoundGroup (out SoundGroup soundgroup) + { + soundgroup = null; + + IntPtr soundgroupraw; + RESULT result = FMOD_Sound_GetSoundGroup(rawPtr, out soundgroupraw); + soundgroup = new SoundGroup(soundgroupraw); + + return result; + } + + // Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks. + public RESULT getNumSyncPoints (out int numsyncpoints) + { + return FMOD_Sound_GetNumSyncPoints(rawPtr, out numsyncpoints); + } + public RESULT getSyncPoint (int index, out IntPtr point) + { + return FMOD_Sound_GetSyncPoint(rawPtr, index, out point); + } + public RESULT getSyncPointInfo (IntPtr point, StringBuilder name, int namelen, out uint offset, TIMEUNIT offsettype) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_Sound_GetSyncPointInfo(rawPtr, point, stringMem, namelen, out offset, offsettype); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT addSyncPoint (uint offset, TIMEUNIT offsettype, string name, out IntPtr point) + { + return FMOD_Sound_AddSyncPoint(rawPtr, offset, offsettype, name, out point); + } + public RESULT deleteSyncPoint (IntPtr point) + { + return FMOD_Sound_DeleteSyncPoint(rawPtr, point); + } + + // Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time. + public RESULT setMode (MODE mode) + { + return FMOD_Sound_SetMode(rawPtr, mode); + } + public RESULT getMode (out MODE mode) + { + return FMOD_Sound_GetMode(rawPtr, out mode); + } + public RESULT setLoopCount (int loopcount) + { + return FMOD_Sound_SetLoopCount(rawPtr, loopcount); + } + public RESULT getLoopCount (out int loopcount) + { + return FMOD_Sound_GetLoopCount(rawPtr, out loopcount); + } + public RESULT setLoopPoints (uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype) + { + return FMOD_Sound_SetLoopPoints(rawPtr, loopstart, loopstarttype, loopend, loopendtype); + } + public RESULT getLoopPoints (out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype) + { + return FMOD_Sound_GetLoopPoints(rawPtr, out loopstart, loopstarttype, out loopend, loopendtype); + } + + // For MOD/S3M/XM/IT/MID sequenced formats only. + public RESULT getMusicNumChannels (out int numchannels) + { + return FMOD_Sound_GetMusicNumChannels(rawPtr, out numchannels); + } + public RESULT setMusicChannelVolume (int channel, float volume) + { + return FMOD_Sound_SetMusicChannelVolume(rawPtr, channel, volume); + } + public RESULT getMusicChannelVolume (int channel, out float volume) + { + return FMOD_Sound_GetMusicChannelVolume(rawPtr, channel, out volume); + } + public RESULT setMusicSpeed(float speed) + { + return FMOD_Sound_SetMusicSpeed(rawPtr, speed); + } + public RESULT getMusicSpeed(out float speed) + { + return FMOD_Sound_GetMusicSpeed(rawPtr, out speed); + } + + // Userdata set/get. + public RESULT setUserData (IntPtr userdata) + { + return FMOD_Sound_SetUserData(rawPtr, userdata); + } + public RESULT getUserData (out IntPtr userdata) + { + return FMOD_Sound_GetUserData(rawPtr, out userdata); + } + + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Release (IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetSystemObject (IntPtr sound, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Lock (IntPtr sound, uint offset, uint length, out IntPtr ptr1, out IntPtr ptr2, out uint len1, out uint len2); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Unlock (IntPtr sound, IntPtr ptr1, IntPtr ptr2, uint len1, uint len2); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetDefaults (IntPtr sound, float frequency, int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetDefaults (IntPtr sound, out float frequency, out int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Set3DMinMaxDistance (IntPtr sound, float min, float max); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Get3DMinMaxDistance (IntPtr sound, out float min, out float max); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Set3DConeSettings (IntPtr sound, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Get3DConeSettings (IntPtr sound, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Set3DCustomRolloff (IntPtr sound, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_Get3DCustomRolloff (IntPtr sound, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetSubSound (IntPtr sound, int index, out IntPtr subsound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetSubSoundParent (IntPtr sound, out IntPtr parentsound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetName (IntPtr sound, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetLength (IntPtr sound, out uint length, TIMEUNIT lengthtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetFormat (IntPtr sound, out SOUND_TYPE type, out SOUND_FORMAT format, out int channels, out int bits); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetNumSubSounds (IntPtr sound, out int numsubsounds); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetNumTags (IntPtr sound, out int numtags, out int numtagsupdated); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetTag (IntPtr sound, string name, int index, out TAG tag); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetOpenState (IntPtr sound, out OPENSTATE openstate, out uint percentbuffered, out bool starving, out bool diskbusy); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_ReadData (IntPtr sound, IntPtr buffer, uint lenbytes, out uint read); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SeekData (IntPtr sound, uint pcm); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetSoundGroup (IntPtr sound, IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetSoundGroup (IntPtr sound, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetNumSyncPoints (IntPtr sound, out int numsyncpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetSyncPoint (IntPtr sound, int index, out IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetSyncPointInfo (IntPtr sound, IntPtr point, IntPtr name, int namelen, out uint offset, TIMEUNIT offsettype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_AddSyncPoint (IntPtr sound, uint offset, TIMEUNIT offsettype, string name, out IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_DeleteSyncPoint (IntPtr sound, IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetMode (IntPtr sound, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetMode (IntPtr sound, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetLoopCount (IntPtr sound, int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetLoopCount (IntPtr sound, out int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetLoopPoints (IntPtr sound, uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetLoopPoints (IntPtr sound, out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetMusicNumChannels (IntPtr sound, out int numchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetMusicChannelVolume (IntPtr sound, int channel, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetMusicChannelVolume (IntPtr sound, int channel, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetMusicSpeed (IntPtr sound, float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetMusicSpeed (IntPtr sound, out float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_SetUserData (IntPtr sound, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Sound_GetUserData (IntPtr sound, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public Sound(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'ChannelControl' API + */ + public class ChannelControl : HandleBase + { + public RESULT getSystemObject(out System system) + { + system = null; + + IntPtr systemraw; + RESULT result = FMOD_ChannelGroup_GetSystemObject(rawPtr, out systemraw); + system = new System(systemraw); + + return result; + } + + // General control functionality for Channels and ChannelGroups. + public RESULT stop() + { + return FMOD_ChannelGroup_Stop(rawPtr); + } + public RESULT setPaused(bool paused) + { + return FMOD_ChannelGroup_SetPaused(rawPtr, paused); + } + public RESULT getPaused(out bool paused) + { + return FMOD_ChannelGroup_GetPaused(rawPtr, out paused); + } + public RESULT setVolume(float volume) + { + return FMOD_ChannelGroup_SetVolume(rawPtr, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD_ChannelGroup_GetVolume(rawPtr, out volume); + } + public RESULT setVolumeRamp(bool ramp) + { + return FMOD_ChannelGroup_SetVolumeRamp(rawPtr, ramp); + } + public RESULT getVolumeRamp(out bool ramp) + { + return FMOD_ChannelGroup_GetVolumeRamp(rawPtr, out ramp); + } + public RESULT getAudibility(out float audibility) + { + return FMOD_ChannelGroup_GetAudibility(rawPtr, out audibility); + } + public RESULT setPitch(float pitch) + { + return FMOD_ChannelGroup_SetPitch(rawPtr, pitch); + } + public RESULT getPitch(out float pitch) + { + return FMOD_ChannelGroup_GetPitch(rawPtr, out pitch); + } + public RESULT setMute(bool mute) + { + return FMOD_ChannelGroup_SetMute(rawPtr, mute); + } + public RESULT getMute(out bool mute) + { + return FMOD_ChannelGroup_GetMute(rawPtr, out mute); + } + public RESULT setReverbProperties(int instance, float wet) + { + return FMOD_ChannelGroup_SetReverbProperties(rawPtr, instance, wet); + } + public RESULT getReverbProperties(int instance, out float wet) + { + return FMOD_ChannelGroup_GetReverbProperties(rawPtr, instance, out wet); + } + public RESULT setLowPassGain(float gain) + { + return FMOD_ChannelGroup_SetLowPassGain(rawPtr, gain); + } + public RESULT getLowPassGain(out float gain) + { + return FMOD_ChannelGroup_GetLowPassGain(rawPtr, out gain); + } + public RESULT setMode(MODE mode) + { + return FMOD_ChannelGroup_SetMode(rawPtr, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD_ChannelGroup_GetMode(rawPtr, out mode); + } + public RESULT setCallback(CHANNEL_CALLBACK callback) + { + return FMOD_ChannelGroup_SetCallback(rawPtr, callback); + } + public RESULT isPlaying(out bool isplaying) + { + return FMOD_ChannelGroup_IsPlaying(rawPtr, out isplaying); + } + + // Panning and level adjustment. + public RESULT setPan(float pan) + { + return FMOD_ChannelGroup_SetPan(rawPtr, pan); + } + public RESULT setMixLevelsOutput(float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright) + { + return FMOD_ChannelGroup_SetMixLevelsOutput(rawPtr, frontleft, frontright, center, lfe, + surroundleft, surroundright, backleft, backright); + } + public RESULT setMixLevelsInput(float[] levels, int numlevels) + { + return FMOD_ChannelGroup_SetMixLevelsInput(rawPtr, levels, numlevels); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop) + { + return FMOD_ChannelGroup_SetMixMatrix(rawPtr, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop) + { + return FMOD_ChannelGroup_GetMixMatrix(rawPtr, matrix, out outchannels, out inchannels, inchannel_hop); + } + + // Clock based functionality. + public RESULT getDSPClock(out ulong dspclock, out ulong parentclock) + { + return FMOD_ChannelGroup_GetDSPClock(rawPtr, out dspclock, out parentclock); + } + public RESULT setDelay(ulong dspclock_start, ulong dspclock_end, bool stopchannels) + { + return FMOD_ChannelGroup_SetDelay(rawPtr, dspclock_start, dspclock_end, stopchannels); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels) + { + return FMOD_ChannelGroup_GetDelay(rawPtr, out dspclock_start, out dspclock_end, out stopchannels); + } + public RESULT addFadePoint(ulong dspclock, float volume) + { + return FMOD_ChannelGroup_AddFadePoint(rawPtr, dspclock, volume); + } + public RESULT setFadePointRamp(ulong dspclock, float volume) + { + return FMOD_ChannelGroup_SetFadePointRamp(rawPtr, dspclock, volume); + } + public RESULT removeFadePoints(ulong dspclock_start, ulong dspclock_end) + { + return FMOD_ChannelGroup_RemoveFadePoints(rawPtr, dspclock_start, dspclock_end); + } + public RESULT getFadePoints(ref uint numpoints, ulong[] point_dspclock, float[] point_volume) + { + return FMOD_ChannelGroup_GetFadePoints(rawPtr, ref numpoints, point_dspclock, point_volume); + } + + // DSP effects. + public RESULT getDSP(int index, out DSP dsp) + { + dsp = null; + + IntPtr dspraw; + RESULT result = FMOD_ChannelGroup_GetDSP(rawPtr, index, out dspraw); + dsp = new DSP(dspraw); + + return result; + } + public RESULT addDSP(int index, DSP dsp) + { + return FMOD_ChannelGroup_AddDSP(rawPtr, index, dsp.getRaw()); + } + public RESULT removeDSP(DSP dsp) + { + return FMOD_ChannelGroup_RemoveDSP(rawPtr, dsp.getRaw()); + } + public RESULT getNumDSPs(out int numdsps) + { + return FMOD_ChannelGroup_GetNumDSPs(rawPtr, out numdsps); + } + public RESULT setDSPIndex(DSP dsp, int index) + { + return FMOD_ChannelGroup_SetDSPIndex(rawPtr, dsp.getRaw(), index); + } + public RESULT getDSPIndex(DSP dsp, out int index) + { + return FMOD_ChannelGroup_GetDSPIndex(rawPtr, dsp.getRaw(), out index); + } + public RESULT overridePanDSP(DSP pan) + { + return FMOD_ChannelGroup_OverridePanDSP(rawPtr, pan.getRaw()); + } + + // 3D functionality. + public RESULT set3DAttributes(ref VECTOR pos, ref VECTOR vel, ref VECTOR alt_pan_pos) + { + return FMOD_ChannelGroup_Set3DAttributes(rawPtr, ref pos, ref vel, ref alt_pan_pos); + } + public RESULT get3DAttributes(out VECTOR pos, out VECTOR vel, out VECTOR alt_pan_pos) + { + return FMOD_ChannelGroup_Get3DAttributes(rawPtr, out pos, out vel, out alt_pan_pos); + } + public RESULT set3DMinMaxDistance(float mindistance, float maxdistance) + { + return FMOD_ChannelGroup_Set3DMinMaxDistance(rawPtr, mindistance, maxdistance); + } + public RESULT get3DMinMaxDistance(out float mindistance, out float maxdistance) + { + return FMOD_ChannelGroup_Get3DMinMaxDistance(rawPtr, out mindistance, out maxdistance); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD_ChannelGroup_Set3DConeSettings(rawPtr, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD_ChannelGroup_Get3DConeSettings(rawPtr, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DConeOrientation(ref VECTOR orientation) + { + return FMOD_ChannelGroup_Set3DConeOrientation(rawPtr, ref orientation); + } + public RESULT get3DConeOrientation(out VECTOR orientation) + { + return FMOD_ChannelGroup_Get3DConeOrientation(rawPtr, out orientation); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD_ChannelGroup_Set3DCustomRolloff(rawPtr, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD_ChannelGroup_Get3DCustomRolloff(rawPtr, out points, out numpoints); + } + public RESULT set3DOcclusion(float directocclusion, float reverbocclusion) + { + return FMOD_ChannelGroup_Set3DOcclusion(rawPtr, directocclusion, reverbocclusion); + } + public RESULT get3DOcclusion(out float directocclusion, out float reverbocclusion) + { + return FMOD_ChannelGroup_Get3DOcclusion(rawPtr, out directocclusion, out reverbocclusion); + } + public RESULT set3DSpread(float angle) + { + return FMOD_ChannelGroup_Set3DSpread(rawPtr, angle); + } + public RESULT get3DSpread(out float angle) + { + return FMOD_ChannelGroup_Get3DSpread(rawPtr, out angle); + } + public RESULT set3DLevel(float level) + { + return FMOD_ChannelGroup_Set3DLevel(rawPtr, level); + } + public RESULT get3DLevel(out float level) + { + return FMOD_ChannelGroup_Get3DLevel(rawPtr, out level); + } + public RESULT set3DDopplerLevel(float level) + { + return FMOD_ChannelGroup_Set3DDopplerLevel(rawPtr, level); + } + public RESULT get3DDopplerLevel(out float level) + { + return FMOD_ChannelGroup_Get3DDopplerLevel(rawPtr, out level); + } + public RESULT set3DDistanceFilter(bool custom, float customLevel, float centerFreq) + { + return FMOD_ChannelGroup_Set3DDistanceFilter(rawPtr, custom, customLevel, centerFreq); + } + public RESULT get3DDistanceFilter(out bool custom, out float customLevel, out float centerFreq) + { + return FMOD_ChannelGroup_Get3DDistanceFilter(rawPtr, out custom, out customLevel, out centerFreq); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD_ChannelGroup_SetUserData(rawPtr, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_ChannelGroup_GetUserData(rawPtr, out userdata); + } + + #region importfunctions + + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Stop(IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetPaused(IntPtr channelgroup, bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetPaused(IntPtr channelgroup, out bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetVolume(IntPtr channelgroup, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetVolumeRamp(IntPtr channelgroup, bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetVolumeRamp(IntPtr channelgroup, out bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetAudibility(IntPtr channelgroup, out float audibility); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetPitch(IntPtr channelgroup, float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetPitch(IntPtr channelgroup, out float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetMute(IntPtr channelgroup, bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetMute(IntPtr channelgroup, out bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetReverbProperties(IntPtr channelgroup, int instance, float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetReverbProperties(IntPtr channelgroup, int instance, out float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetLowPassGain(IntPtr channelgroup, float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetLowPassGain(IntPtr channelgroup, out float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetMode(IntPtr channelgroup, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetMode(IntPtr channelgroup, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetCallback(IntPtr channelgroup, CHANNEL_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_IsPlaying(IntPtr channelgroup, out bool isplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetPan(IntPtr channelgroup, float pan); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetMixLevelsOutput(IntPtr channelgroup, float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetMixLevelsInput(IntPtr channelgroup, float[] levels, int numlevels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetMixMatrix(IntPtr channelgroup, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetMixMatrix(IntPtr channelgroup, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetDSPClock(IntPtr channelgroup, out ulong dspclock, out ulong parentclock); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetDelay(IntPtr channelgroup, ulong dspclock_start, ulong dspclock_end, bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetDelay(IntPtr channelgroup, out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_AddFadePoint(IntPtr channelgroup, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetFadePointRamp(IntPtr channelgroup, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_RemoveFadePoints(IntPtr channelgroup, ulong dspclock_start, ulong dspclock_end); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetFadePoints(IntPtr channelgroup, ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DAttributes(IntPtr channelgroup, ref VECTOR pos, ref VECTOR vel, ref VECTOR alt_pan_pos); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DAttributes(IntPtr channelgroup, out VECTOR pos, out VECTOR vel, out VECTOR alt_pan_pos); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DMinMaxDistance(IntPtr channelgroup, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DMinMaxDistance(IntPtr channelgroup, out float mindistance, out float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DConeSettings(IntPtr channelgroup, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DConeSettings(IntPtr channelgroup, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DConeOrientation(IntPtr channelgroup, ref VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DConeOrientation(IntPtr channelgroup, out VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DCustomRolloff(IntPtr channelgroup, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DCustomRolloff(IntPtr channelgroup, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DOcclusion(IntPtr channelgroup, float directocclusion, float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DOcclusion(IntPtr channelgroup, out float directocclusion, out float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DSpread(IntPtr channelgroup, float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DSpread(IntPtr channelgroup, out float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DLevel(IntPtr channelgroup, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DLevel(IntPtr channelgroup, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DDopplerLevel(IntPtr channelgroup, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DDopplerLevel(IntPtr channelgroup, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Set3DDistanceFilter(IntPtr channelgroup, bool custom, float customLevel, float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Get3DDistanceFilter(IntPtr channelgroup, out bool custom, out float customLevel, out float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetSystemObject(IntPtr channelgroup, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetVolume(IntPtr channelgroup, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetDSP(IntPtr channelgroup, int index, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_AddDSP(IntPtr channelgroup, int index, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_RemoveDSP(IntPtr channelgroup, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetNumDSPs(IntPtr channelgroup, out int numdsps); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetDSPIndex(IntPtr channelgroup, IntPtr dsp, int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetDSPIndex(IntPtr channelgroup, IntPtr dsp, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_OverridePanDSP(IntPtr channelgroup, IntPtr pan); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_SetUserData(IntPtr channelgroup, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetUserData(IntPtr channelgroup, out IntPtr userdata); + + #endregion + + #region wrapperinternal + + protected ChannelControl(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'Channel' API + */ + public class Channel : ChannelControl + { + // Channel specific control functionality. + public RESULT setFrequency (float frequency) + { + return FMOD_Channel_SetFrequency(getRaw(), frequency); + } + public RESULT getFrequency (out float frequency) + { + return FMOD_Channel_GetFrequency(getRaw(), out frequency); + } + public RESULT setPriority (int priority) + { + return FMOD_Channel_SetPriority(getRaw(), priority); + } + public RESULT getPriority (out int priority) + { + return FMOD_Channel_GetPriority(getRaw(), out priority); + } + public RESULT setPosition (uint position, TIMEUNIT postype) + { + return FMOD_Channel_SetPosition(getRaw(), position, postype); + } + public RESULT getPosition (out uint position, TIMEUNIT postype) + { + return FMOD_Channel_GetPosition(getRaw(), out position, postype); + } + public RESULT setChannelGroup (ChannelGroup channelgroup) + { + return FMOD_Channel_SetChannelGroup(getRaw(), channelgroup.getRaw()); + } + public RESULT getChannelGroup (out ChannelGroup channelgroup) + { + channelgroup = null; + + IntPtr channelgroupraw; + RESULT result = FMOD_Channel_GetChannelGroup(getRaw(), out channelgroupraw); + channelgroup = new ChannelGroup(channelgroupraw); + + return result; + } + public RESULT setLoopCount(int loopcount) + { + return FMOD_Channel_SetLoopCount(getRaw(), loopcount); + } + public RESULT getLoopCount(out int loopcount) + { + return FMOD_Channel_GetLoopCount(getRaw(), out loopcount); + } + public RESULT setLoopPoints(uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype) + { + return FMOD_Channel_SetLoopPoints(getRaw(), loopstart, loopstarttype, loopend, loopendtype); + } + public RESULT getLoopPoints(out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype) + { + return FMOD_Channel_GetLoopPoints(getRaw(), out loopstart, loopstarttype, out loopend, loopendtype); + } + + // Information only functions. + public RESULT isVirtual (out bool isvirtual) + { + return FMOD_Channel_IsVirtual(getRaw(), out isvirtual); + } + public RESULT getCurrentSound (out Sound sound) + { + sound = null; + + IntPtr soundraw; + RESULT result = FMOD_Channel_GetCurrentSound(getRaw(), out soundraw); + sound = new Sound(soundraw); + + return result; + } + public RESULT getIndex (out int index) + { + return FMOD_Channel_GetIndex(getRaw(), out index); + } + + #region importfunctions + + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetFrequency (IntPtr channel, float frequency); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetFrequency (IntPtr channel, out float frequency); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetPriority (IntPtr channel, int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetPriority (IntPtr channel, out int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetChannelGroup (IntPtr channel, IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetChannelGroup (IntPtr channel, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_IsVirtual (IntPtr channel, out bool isvirtual); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetCurrentSound (IntPtr channel, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetIndex (IntPtr channel, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetPosition (IntPtr channel, uint position, TIMEUNIT postype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetPosition (IntPtr channel, out uint position, TIMEUNIT postype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetMode (IntPtr channel, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetMode (IntPtr channel, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetLoopCount (IntPtr channel, int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetLoopCount (IntPtr channel, out int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetLoopPoints (IntPtr channel, uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetLoopPoints (IntPtr channel, out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_SetUserData (IntPtr channel, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Channel_GetUserData (IntPtr channel, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public Channel(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'ChannelGroup' API + */ + public class ChannelGroup : ChannelControl + { + public RESULT release () + { + RESULT result = FMOD_ChannelGroup_Release(getRaw()); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + + // Nested channel groups. + public RESULT addGroup (ChannelGroup group) + { + return FMOD_ChannelGroup_AddGroup(getRaw(), group.getRaw()); + } + public RESULT getNumGroups (out int numgroups) + { + return FMOD_ChannelGroup_GetNumGroups(getRaw(), out numgroups); + } + public RESULT getGroup (int index, out ChannelGroup group) + { + group = null; + + IntPtr groupraw; + RESULT result = FMOD_ChannelGroup_GetGroup(getRaw(), index, out groupraw); + group = new ChannelGroup(groupraw); + + return result; + } + public RESULT getParentGroup (out ChannelGroup group) + { + group = null; + + IntPtr groupraw; + RESULT result = FMOD_ChannelGroup_GetParentGroup(getRaw(), out groupraw); + group = new ChannelGroup(groupraw); + + return result; + } + + // Information only functions. + public RESULT getName (StringBuilder name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_ChannelGroup_GetName(getRaw(), stringMem, namelen); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getNumChannels (out int numchannels) + { + return FMOD_ChannelGroup_GetNumChannels(getRaw(), out numchannels); + } + public RESULT getChannel (int index, out Channel channel) + { + channel = null; + + IntPtr channelraw; + RESULT result = FMOD_ChannelGroup_GetChannel(getRaw(), index, out channelraw); + channel = new Channel(channelraw); + + return result; + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_Release (IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_AddGroup (IntPtr channelgroup, IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetNumGroups (IntPtr channelgroup, out int numgroups); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetGroup (IntPtr channelgroup, int index, out IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetParentGroup (IntPtr channelgroup, out IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetName (IntPtr channelgroup, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetNumChannels (IntPtr channelgroup, out int numchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_ChannelGroup_GetChannel (IntPtr channelgroup, int index, out IntPtr channel); + #endregion + + #region wrapperinternal + + public ChannelGroup(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'SoundGroup' API + */ + public class SoundGroup : HandleBase + { + public RESULT release () + { + RESULT result = FMOD_SoundGroup_Release(getRaw()); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + + public RESULT getSystemObject (out System system) + { + system = null; + + IntPtr systemraw; + RESULT result = FMOD_SoundGroup_GetSystemObject(rawPtr, out systemraw); + system = new System(systemraw); + + return result; + } + + // SoundGroup control functions. + public RESULT setMaxAudible (int maxaudible) + { + return FMOD_SoundGroup_SetMaxAudible(rawPtr, maxaudible); + } + public RESULT getMaxAudible (out int maxaudible) + { + return FMOD_SoundGroup_GetMaxAudible(rawPtr, out maxaudible); + } + public RESULT setMaxAudibleBehavior (SOUNDGROUP_BEHAVIOR behavior) + { + return FMOD_SoundGroup_SetMaxAudibleBehavior(rawPtr, behavior); + } + public RESULT getMaxAudibleBehavior (out SOUNDGROUP_BEHAVIOR behavior) + { + return FMOD_SoundGroup_GetMaxAudibleBehavior(rawPtr, out behavior); + } + public RESULT setMuteFadeSpeed (float speed) + { + return FMOD_SoundGroup_SetMuteFadeSpeed(rawPtr, speed); + } + public RESULT getMuteFadeSpeed (out float speed) + { + return FMOD_SoundGroup_GetMuteFadeSpeed(rawPtr, out speed); + } + public RESULT setVolume (float volume) + { + return FMOD_SoundGroup_SetVolume(rawPtr, volume); + } + public RESULT getVolume (out float volume) + { + return FMOD_SoundGroup_GetVolume(rawPtr, out volume); + } + public RESULT stop () + { + return FMOD_SoundGroup_Stop(rawPtr); + } + + // Information only functions. + public RESULT getName (StringBuilder name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(name.Capacity); + + RESULT result = FMOD_SoundGroup_GetName(rawPtr, stringMem, namelen); + + StringMarshalHelper.NativeToBuilder(name, stringMem); + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getNumSounds (out int numsounds) + { + return FMOD_SoundGroup_GetNumSounds(rawPtr, out numsounds); + } + public RESULT getSound (int index, out Sound sound) + { + sound = null; + + IntPtr soundraw; + RESULT result = FMOD_SoundGroup_GetSound(rawPtr, index, out soundraw); + sound = new Sound(soundraw); + + return result; + } + public RESULT getNumPlaying (out int numplaying) + { + return FMOD_SoundGroup_GetNumPlaying(rawPtr, out numplaying); + } + + // Userdata set/get. + public RESULT setUserData (IntPtr userdata) + { + return FMOD_SoundGroup_SetUserData(rawPtr, userdata); + } + public RESULT getUserData (out IntPtr userdata) + { + return FMOD_SoundGroup_GetUserData(rawPtr, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_Release (IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetSystemObject (IntPtr soundgroup, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_SetMaxAudible (IntPtr soundgroup, int maxaudible); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetMaxAudible (IntPtr soundgroup, out int maxaudible); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_SetMaxAudibleBehavior(IntPtr soundgroup, SOUNDGROUP_BEHAVIOR behavior); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetMaxAudibleBehavior(IntPtr soundgroup, out SOUNDGROUP_BEHAVIOR behavior); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_SetMuteFadeSpeed (IntPtr soundgroup, float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetMuteFadeSpeed (IntPtr soundgroup, out float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_SetVolume (IntPtr soundgroup, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetVolume (IntPtr soundgroup, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_Stop (IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetName (IntPtr soundgroup, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetNumSounds (IntPtr soundgroup, out int numsounds); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetSound (IntPtr soundgroup, int index, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetNumPlaying (IntPtr soundgroup, out int numplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_SetUserData (IntPtr soundgroup, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_SoundGroup_GetUserData (IntPtr soundgroup, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public SoundGroup(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'DSP' API + */ + public class DSP : HandleBase + { + public RESULT release () + { + RESULT result = FMOD_DSP_Release(getRaw()); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + public RESULT getSystemObject (out System system) + { + system = null; + + IntPtr systemraw; + RESULT result = FMOD_DSP_GetSystemObject(rawPtr, out systemraw); + system = new System(systemraw); + + return result; + } + + // Connection / disconnection / input and output enumeration. + public RESULT addInput(DSP target, out DSPConnection connection, DSPCONNECTION_TYPE type) + { + connection = null; + + IntPtr dspconnectionraw; + RESULT result = FMOD_DSP_AddInput(rawPtr, target.getRaw(), out dspconnectionraw, type); + connection = new DSPConnection(dspconnectionraw); + + return result; + } + public RESULT disconnectFrom (DSP target, DSPConnection connection) + { + return FMOD_DSP_DisconnectFrom(rawPtr, target.getRaw(), connection.getRaw()); + } + public RESULT disconnectAll (bool inputs, bool outputs) + { + return FMOD_DSP_DisconnectAll(rawPtr, inputs, outputs); + } + public RESULT getNumInputs (out int numinputs) + { + return FMOD_DSP_GetNumInputs(rawPtr, out numinputs); + } + public RESULT getNumOutputs (out int numoutputs) + { + return FMOD_DSP_GetNumOutputs(rawPtr, out numoutputs); + } + public RESULT getInput (int index, out DSP input, out DSPConnection inputconnection) + { + input = null; + inputconnection = null; + + IntPtr dspinputraw; + IntPtr dspconnectionraw; + RESULT result = FMOD_DSP_GetInput(rawPtr, index, out dspinputraw, out dspconnectionraw); + input = new DSP(dspinputraw); + inputconnection = new DSPConnection(dspconnectionraw); + + return result; + } + public RESULT getOutput (int index, out DSP output, out DSPConnection outputconnection) + { + output = null; + outputconnection = null; + + IntPtr dspoutputraw; + IntPtr dspconnectionraw; + RESULT result = FMOD_DSP_GetOutput(rawPtr, index, out dspoutputraw, out dspconnectionraw); + output = new DSP(dspoutputraw); + outputconnection = new DSPConnection(dspconnectionraw); + + return result; + } + + // DSP unit control. + public RESULT setActive (bool active) + { + return FMOD_DSP_SetActive(rawPtr, active); + } + public RESULT getActive (out bool active) + { + return FMOD_DSP_GetActive(rawPtr, out active); + } + public RESULT setBypass(bool bypass) + { + return FMOD_DSP_SetBypass(rawPtr, bypass); + } + public RESULT getBypass(out bool bypass) + { + return FMOD_DSP_GetBypass(rawPtr, out bypass); + } + public RESULT setWetDryMix(float prewet, float postwet, float dry) + { + return FMOD_DSP_SetWetDryMix(rawPtr, prewet, postwet, dry); + } + public RESULT getWetDryMix(out float prewet, out float postwet, out float dry) + { + return FMOD_DSP_GetWetDryMix(rawPtr, out prewet, out postwet, out dry); + } + public RESULT setChannelFormat(CHANNELMASK channelmask, int numchannels, SPEAKERMODE source_speakermode) + { + return FMOD_DSP_SetChannelFormat(rawPtr, channelmask, numchannels, source_speakermode); + } + public RESULT getChannelFormat(out CHANNELMASK channelmask, out int numchannels, out SPEAKERMODE source_speakermode) + { + return FMOD_DSP_GetChannelFormat(rawPtr, out channelmask, out numchannels, out source_speakermode); + } + public RESULT getOutputChannelFormat(CHANNELMASK inmask, int inchannels, SPEAKERMODE inspeakermode, out CHANNELMASK outmask, out int outchannels, out SPEAKERMODE outspeakermode) + { + return FMOD_DSP_GetOutputChannelFormat(rawPtr, inmask, inchannels, inspeakermode, out outmask, out outchannels, out outspeakermode); + } + public RESULT reset () + { + return FMOD_DSP_Reset(rawPtr); + } + + // DSP parameter control. + public RESULT setParameterFloat(int index, float value) + { + return FMOD_DSP_SetParameterFloat(rawPtr, index, value); + } + public RESULT setParameterInt(int index, int value) + { + return FMOD_DSP_SetParameterInt(rawPtr, index, value); + } + public RESULT setParameterBool(int index, bool value) + { + return FMOD_DSP_SetParameterBool(rawPtr, index, value); + } + public RESULT setParameterData(int index, byte[] data) + { + return FMOD_DSP_SetParameterData(rawPtr, index, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0), (uint)data.Length); + } + public RESULT getParameterFloat(int index, out float value) + { + IntPtr valuestr = IntPtr.Zero; + return FMOD_DSP_GetParameterFloat(rawPtr, index, out value, valuestr, 0); + } + public RESULT getParameterInt(int index, out int value) + { + IntPtr valuestr = IntPtr.Zero; + return FMOD_DSP_GetParameterInt(rawPtr, index, out value, valuestr, 0); + } + public RESULT getParameterBool(int index, out bool value) + { + return FMOD_DSP_GetParameterBool(rawPtr, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterData(int index, out IntPtr data, out uint length) + { + return FMOD_DSP_GetParameterData(rawPtr, index, out data, out length, IntPtr.Zero, 0); + } + public RESULT getNumParameters (out int numparams) + { + return FMOD_DSP_GetNumParameters(rawPtr, out numparams); + } + public RESULT getParameterInfo (int index, out DSP_PARAMETER_DESC desc) + { + IntPtr descPtr; + RESULT result = FMOD_DSP_GetParameterInfo(rawPtr, index, out descPtr); + if (result == RESULT.OK) + { + desc = (DSP_PARAMETER_DESC)Marshal.PtrToStructure(descPtr, typeof(DSP_PARAMETER_DESC)); + } + else + { + desc = new DSP_PARAMETER_DESC(); + } + return result; + } + public RESULT getDataParameterIndex(int datatype, out int index) + { + return FMOD_DSP_GetDataParameterIndex (rawPtr, datatype, out index); + } + public RESULT showConfigDialog (IntPtr hwnd, bool show) + { + return FMOD_DSP_ShowConfigDialog (rawPtr, hwnd, show); + } + + // DSP attributes. + public RESULT getInfo (StringBuilder name, out uint version, out int channels, out int configwidth, out int configheight) + { + IntPtr nameMem = Marshal.AllocHGlobal(32); + RESULT result = FMOD_DSP_GetInfo(rawPtr, nameMem, out version, out channels, out configwidth, out configheight); + StringMarshalHelper.NativeToBuilder(name, nameMem); + Marshal.FreeHGlobal(nameMem); + return result; + } + public RESULT getType (out DSP_TYPE type) + { + return FMOD_DSP_GetType(rawPtr, out type); + } + public RESULT getIdle (out bool idle) + { + return FMOD_DSP_GetIdle(rawPtr, out idle); + } + + // Userdata set/get. + public RESULT setUserData (IntPtr userdata) + { + return FMOD_DSP_SetUserData(rawPtr, userdata); + } + public RESULT getUserData (out IntPtr userdata) + { + return FMOD_DSP_GetUserData(rawPtr, out userdata); + } + + // Metering. + public RESULT setMeteringEnabled(bool inputEnabled, bool outputEnabled) + { + return FMOD_DSP_SetMeteringEnabled(rawPtr, inputEnabled, outputEnabled); + } + public RESULT getMeteringEnabled(out bool inputEnabled, out bool outputEnabled) + { + return FMOD_DSP_GetMeteringEnabled(rawPtr, out inputEnabled, out outputEnabled); + } + + public RESULT getMeteringInfo(DSP_METERING_INFO inputInfo, DSP_METERING_INFO outputInfo) + { + return FMOD_DSP_GetMeteringInfo(rawPtr, inputInfo, outputInfo); + } + + #region importfunctions + + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_Release (IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetSystemObject (IntPtr dsp, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_AddInput (IntPtr dsp, IntPtr target, out IntPtr connection, DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_DisconnectFrom (IntPtr dsp, IntPtr target, IntPtr connection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_DisconnectAll (IntPtr dsp, bool inputs, bool outputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetNumInputs (IntPtr dsp, out int numinputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetNumOutputs (IntPtr dsp, out int numoutputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetInput (IntPtr dsp, int index, out IntPtr input, out IntPtr inputconnection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetOutput (IntPtr dsp, int index, out IntPtr output, out IntPtr outputconnection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetActive (IntPtr dsp, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetActive (IntPtr dsp, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetBypass (IntPtr dsp, bool bypass); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetBypass (IntPtr dsp, out bool bypass); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetWetDryMix (IntPtr dsp, float prewet, float postwet, float dry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetWetDryMix (IntPtr dsp, out float prewet, out float postwet, out float dry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetChannelFormat (IntPtr dsp, CHANNELMASK channelmask, int numchannels, SPEAKERMODE source_speakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetChannelFormat (IntPtr dsp, out CHANNELMASK channelmask, out int numchannels, out SPEAKERMODE source_speakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetOutputChannelFormat (IntPtr dsp, CHANNELMASK inmask, int inchannels, SPEAKERMODE inspeakermode, out CHANNELMASK outmask, out int outchannels, out SPEAKERMODE outspeakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_Reset (IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetParameterFloat (IntPtr dsp, int index, float value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetParameterInt (IntPtr dsp, int index, int value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetParameterBool (IntPtr dsp, int index, bool value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetParameterData (IntPtr dsp, int index, IntPtr data, uint length); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetParameterFloat (IntPtr dsp, int index, out float value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetParameterInt (IntPtr dsp, int index, out int value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetParameterBool (IntPtr dsp, int index, out bool value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetParameterData (IntPtr dsp, int index, out IntPtr data, out uint length, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetNumParameters (IntPtr dsp, out int numparams); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetParameterInfo (IntPtr dsp, int index, out IntPtr desc); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetDataParameterIndex (IntPtr dsp, int datatype, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_ShowConfigDialog (IntPtr dsp, IntPtr hwnd, bool show); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetInfo (IntPtr dsp, IntPtr name, out uint version, out int channels, out int configwidth, out int configheight); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetType (IntPtr dsp, out DSP_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetIdle (IntPtr dsp, out bool idle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_SetUserData (IntPtr dsp, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSP_GetUserData (IntPtr dsp, out IntPtr userdata); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD_DSP_SetMeteringEnabled (IntPtr dsp, bool inputEnabled, bool outputEnabled); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD_DSP_GetMeteringEnabled (IntPtr dsp, out bool inputEnabled, out bool outputEnabled); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD_DSP_GetMeteringInfo (IntPtr dsp, [Out] DSP_METERING_INFO inputInfo, [Out] DSP_METERING_INFO outputInfo); + #endregion + + #region wrapperinternal + + public DSP(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'DSPConnection' API + */ + public class DSPConnection : HandleBase + { + public RESULT getInput (out DSP input) + { + input = null; + + IntPtr dspraw; + RESULT result = FMOD_DSPConnection_GetInput(rawPtr, out dspraw); + input = new DSP(dspraw); + + return result; + } + public RESULT getOutput (out DSP output) + { + output = null; + + IntPtr dspraw; + RESULT result = FMOD_DSPConnection_GetOutput(rawPtr, out dspraw); + output = new DSP(dspraw); + + return result; + } + public RESULT setMix (float volume) + { + return FMOD_DSPConnection_SetMix(rawPtr, volume); + } + public RESULT getMix (out float volume) + { + return FMOD_DSPConnection_GetMix(rawPtr, out volume); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop) + { + return FMOD_DSPConnection_SetMixMatrix(rawPtr, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop) + { + return FMOD_DSPConnection_GetMixMatrix(rawPtr, matrix, out outchannels, out inchannels, inchannel_hop); + } + public RESULT getType(out DSPCONNECTION_TYPE type) + { + return FMOD_DSPConnection_GetType(rawPtr, out type); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD_DSPConnection_SetUserData(rawPtr, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_DSPConnection_GetUserData(rawPtr, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_GetInput (IntPtr dspconnection, out IntPtr input); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_GetOutput (IntPtr dspconnection, out IntPtr output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_SetMix (IntPtr dspconnection, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_GetMix (IntPtr dspconnection, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_SetMixMatrix (IntPtr dspconnection, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_GetMixMatrix (IntPtr dspconnection, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_GetType (IntPtr dspconnection, out DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_SetUserData (IntPtr dspconnection, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_DSPConnection_GetUserData (IntPtr dspconnection, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public DSPConnection(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + /* + 'Geometry' API + */ + public class Geometry : HandleBase + { + public RESULT release () + { + RESULT result = FMOD_Geometry_Release(getRaw()); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + + // Polygon manipulation. + public RESULT addPolygon (float directocclusion, float reverbocclusion, bool doublesided, int numvertices, VECTOR[] vertices, out int polygonindex) + { + return FMOD_Geometry_AddPolygon(rawPtr, directocclusion, reverbocclusion, doublesided, numvertices, vertices, out polygonindex); + } + public RESULT getNumPolygons (out int numpolygons) + { + return FMOD_Geometry_GetNumPolygons(rawPtr, out numpolygons); + } + public RESULT getMaxPolygons (out int maxpolygons, out int maxvertices) + { + return FMOD_Geometry_GetMaxPolygons(rawPtr, out maxpolygons, out maxvertices); + } + public RESULT getPolygonNumVertices (int index, out int numvertices) + { + return FMOD_Geometry_GetPolygonNumVertices(rawPtr, index, out numvertices); + } + public RESULT setPolygonVertex (int index, int vertexindex, ref VECTOR vertex) + { + return FMOD_Geometry_SetPolygonVertex(rawPtr, index, vertexindex, ref vertex); + } + public RESULT getPolygonVertex (int index, int vertexindex, out VECTOR vertex) + { + return FMOD_Geometry_GetPolygonVertex(rawPtr, index, vertexindex, out vertex); + } + public RESULT setPolygonAttributes (int index, float directocclusion, float reverbocclusion, bool doublesided) + { + return FMOD_Geometry_SetPolygonAttributes(rawPtr, index, directocclusion, reverbocclusion, doublesided); + } + public RESULT getPolygonAttributes (int index, out float directocclusion, out float reverbocclusion, out bool doublesided) + { + return FMOD_Geometry_GetPolygonAttributes(rawPtr, index, out directocclusion, out reverbocclusion, out doublesided); + } + + // Object manipulation. + public RESULT setActive (bool active) + { + return FMOD_Geometry_SetActive(rawPtr, active); + } + public RESULT getActive (out bool active) + { + return FMOD_Geometry_GetActive(rawPtr, out active); + } + public RESULT setRotation (ref VECTOR forward, ref VECTOR up) + { + return FMOD_Geometry_SetRotation(rawPtr, ref forward, ref up); + } + public RESULT getRotation (out VECTOR forward, out VECTOR up) + { + return FMOD_Geometry_GetRotation(rawPtr, out forward, out up); + } + public RESULT setPosition (ref VECTOR position) + { + return FMOD_Geometry_SetPosition(rawPtr, ref position); + } + public RESULT getPosition (out VECTOR position) + { + return FMOD_Geometry_GetPosition(rawPtr, out position); + } + public RESULT setScale (ref VECTOR scale) + { + return FMOD_Geometry_SetScale(rawPtr, ref scale); + } + public RESULT getScale (out VECTOR scale) + { + return FMOD_Geometry_GetScale(rawPtr, out scale); + } + public RESULT save (IntPtr data, out int datasize) + { + return FMOD_Geometry_Save(rawPtr, data, out datasize); + } + + // Userdata set/get. + public RESULT setUserData (IntPtr userdata) + { + return FMOD_Geometry_SetUserData(rawPtr, userdata); + } + public RESULT getUserData (out IntPtr userdata) + { + return FMOD_Geometry_GetUserData(rawPtr, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_Release (IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_AddPolygon (IntPtr geometry, float directocclusion, float reverbocclusion, bool doublesided, int numvertices, VECTOR[] vertices, out int polygonindex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetNumPolygons (IntPtr geometry, out int numpolygons); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetMaxPolygons (IntPtr geometry, out int maxpolygons, out int maxvertices); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetPolygonNumVertices(IntPtr geometry, int index, out int numvertices); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetPolygonVertex (IntPtr geometry, int index, int vertexindex, ref VECTOR vertex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetPolygonVertex (IntPtr geometry, int index, int vertexindex, out VECTOR vertex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetPolygonAttributes (IntPtr geometry, int index, float directocclusion, float reverbocclusion, bool doublesided); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetPolygonAttributes (IntPtr geometry, int index, out float directocclusion, out float reverbocclusion, out bool doublesided); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetActive (IntPtr geometry, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetActive (IntPtr geometry, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetRotation (IntPtr geometry, ref VECTOR forward, ref VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetRotation (IntPtr geometry, out VECTOR forward, out VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetPosition (IntPtr geometry, ref VECTOR position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetPosition (IntPtr geometry, out VECTOR position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetScale (IntPtr geometry, ref VECTOR scale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetScale (IntPtr geometry, out VECTOR scale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_Save (IntPtr geometry, IntPtr data, out int datasize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_SetUserData (IntPtr geometry, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Geometry_GetUserData (IntPtr geometry, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public Geometry(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + + /* + 'Reverb3D' API + */ + public class Reverb3D : HandleBase + { + public RESULT release() + { + RESULT result = FMOD_Reverb3D_Release(getRaw()); + if (result == RESULT.OK) + { + rawPtr = IntPtr.Zero; + } + return result; + } + + // Reverb manipulation. + public RESULT set3DAttributes(ref VECTOR position, float mindistance, float maxdistance) + { + return FMOD_Reverb3D_Set3DAttributes(rawPtr, ref position, mindistance, maxdistance); + } + public RESULT get3DAttributes(ref VECTOR position, ref float mindistance, ref float maxdistance) + { + return FMOD_Reverb3D_Get3DAttributes(rawPtr, ref position, ref mindistance, ref maxdistance); + } + public RESULT setProperties(ref REVERB_PROPERTIES properties) + { + return FMOD_Reverb3D_SetProperties(rawPtr, ref properties); + } + public RESULT getProperties(ref REVERB_PROPERTIES properties) + { + return FMOD_Reverb3D_GetProperties(rawPtr, ref properties); + } + public RESULT setActive(bool active) + { + return FMOD_Reverb3D_SetActive(rawPtr, active); + } + public RESULT getActive(out bool active) + { + return FMOD_Reverb3D_GetActive(rawPtr, out active); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD_Reverb3D_SetUserData(rawPtr, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_Reverb3D_GetUserData(rawPtr, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_Release(IntPtr reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_Set3DAttributes(IntPtr reverb, ref VECTOR position, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_Get3DAttributes(IntPtr reverb, ref VECTOR position, ref float mindistance, ref float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_SetProperties(IntPtr reverb, ref REVERB_PROPERTIES properties); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_GetProperties(IntPtr reverb, ref REVERB_PROPERTIES properties); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_SetActive(IntPtr reverb, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_GetActive(IntPtr reverb, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_SetUserData(IntPtr reverb, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD_Reverb3D_GetUserData(IntPtr reverb, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public Reverb3D(IntPtr raw) + : base(raw) + { + } + + #endregion + } + + class StringMarshalHelper + { + static internal void NativeToBuilder(StringBuilder builder, IntPtr nativeMem) + { + byte[] bytes = new byte[builder.Capacity]; + Marshal.Copy(nativeMem, bytes, 0, builder.Capacity); + int strlen = Array.IndexOf(bytes, (byte)0); + if (strlen > 0) + { + String str = Encoding.UTF8.GetString(bytes, 0, strlen); + builder.Append(str); + } + } + } +} diff --git a/Unity Studio/FMOD Studio API/fmod_dsp.cs b/Unity Studio/FMOD Studio API/fmod_dsp.cs new file mode 100644 index 0000000..3720877 --- /dev/null +++ b/Unity Studio/FMOD Studio API/fmod_dsp.cs @@ -0,0 +1,1785 @@ +/*$ preserve start $*/ +/* ========================================================================================== */ +/* FMOD Studio - DSP header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2015. */ +/* */ +/* Use this header if you are interested in delving deeper into the FMOD software mixing / */ +/* DSP engine. In this header you can find parameter structures for FMOD system registered */ +/* DSP effects and generators. */ +/* */ +/* ========================================================================================== */ + +using System; +using System.Text; +using System.Runtime.InteropServices; + +namespace FMOD +{ +/*$ preserve end $*/ + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure for FMOD_DSP_PROCESS_CALLBACK input and output buffers. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_DESCRIPTION + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_BUFFER_ARRAY + { + public int numbuffers; /* [r/w] number of buffers */ + public int[] buffernumchannels; /* [r/w] array of number of channels for each buffer */ + public CHANNELMASK[] bufferchannelmask; /* [r/w] array of channel masks for each buffer */ + public IntPtr[] buffers; /* [r/w] array of buffers */ + public SPEAKERMODE speakermode; /* [r/w] speaker mode for all buffers in the array */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Operation type for FMOD_DSP_PROCESS_CALLBACK. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_DESCRIPTION + ] + */ + public enum DSP_PROCESS_OPERATION + { + PROCESS_PERFORM = 0, /* Process the incoming audio in 'inbufferarray' and output to 'outbufferarray'. */ + PROCESS_QUERY /* The DSP is being queried for the expected output format and whether it needs to process audio or should be bypassed. The function should return any value other than FMOD_OK if audio can pass through unprocessed. If audio is to be processed, 'outbufferarray' must be filled with the expected output format, channel count and mask. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Complex number structure used for holding FFT frequency domain-data for FMOD_FFTREAL and FMOD_IFFTREAL DSP callbacks. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_STATE_SYSTEMCALLBACKS + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct COMPLEX + { + public float real; /* Real component */ + public float imag; /* Imaginary component */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Flags for the FMOD_DSP_PAN_SUM_SURROUND_MATRIX callback. + + [REMARKS] + This functionality is experimental, please contact support@fmod.org for more information. + + [SEE_ALSO] + FMOD_DSP_STATE_PAN_CALLBACKS + ] + */ + public enum DSP_PAN_SURROUND_FLAGS + { + DEFAULT = 0, + ROTATION_NOT_BIASED = 1, + } + + /* + DSP callbacks + */ + public delegate RESULT DSP_CREATECALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_RELEASECALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_RESETCALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SETPOSITIONCALLBACK (ref DSP_STATE dsp_state, uint pos); + public delegate RESULT DSP_READCALLBACK (ref DSP_STATE dsp_state, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, ref int outchannels); + public delegate RESULT DSP_SHOULDIPROCESS_CALLBACK (ref DSP_STATE dsp_state, bool inputsidle, uint length, CHANNELMASK inmask, int inchannels, SPEAKERMODE speakermode); + public delegate RESULT DSP_PROCESS_CALLBACK (ref DSP_STATE dsp_state, uint length, ref DSP_BUFFER_ARRAY inbufferarray, ref DSP_BUFFER_ARRAY outbufferarray, bool inputsidle, DSP_PROCESS_OPERATION op); + + public delegate RESULT DSP_SETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, float value); + public delegate RESULT DSP_SETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, int value); + public delegate RESULT DSP_SETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, bool value); + public delegate RESULT DSP_SETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, IntPtr data, uint length); + public delegate RESULT DSP_GETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, ref float value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, ref int value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, ref bool value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, ref IntPtr data, ref uint length, IntPtr valuestr); + + public delegate RESULT DSP_SYSTEM_REGISTER_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SYSTEM_DEREGISTER_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SYSTEM_MIX_CALLBACK (ref DSP_STATE dsp_state, int stage); + + public delegate RESULT DSP_SYSTEM_GETSAMPLERATE (ref DSP_STATE dsp_state, ref int rate); + public delegate RESULT DSP_SYSTEM_GETBLOCKSIZE (ref DSP_STATE dsp_state, ref uint blocksize); + public delegate RESULT DSP_SYSTEM_GETSPEAKERMODE (ref DSP_STATE dsp_state, ref int speakermode_mixer, ref int speakermode_output); + + public delegate RESULT DSP_DFT_FFTREAL (ref DSP_STATE dsp_state, int size, IntPtr signal, IntPtr dft, IntPtr window, int signalhop); + public delegate RESULT DSP_DFT_IFFTREAL (ref DSP_STATE dsp_state, int size, IntPtr dft, IntPtr signal, IntPtr window, int signalhop); + + public delegate RESULT DSP_PAN_SUM_MONO_MATRIX (ref DSP_STATE dsp_state, int sourceSpeakerMode, float lowFrequencyGain, float overallGain, IntPtr matrix); + public delegate RESULT DSP_PAN_SUM_STEREO_MATRIX (ref DSP_STATE dsp_state, int sourceSpeakerMode, float pan, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_SUM_SURROUND_MATRIX (ref DSP_STATE dsp_state, int sourceSpeakerMode, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix, DSP_PAN_SURROUND_FLAGS flags); + public delegate RESULT DSP_PAN_SUM_MONO_TO_SURROUND_MATRIX (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_SUM_STEREO_TO_SURROUND_MATRIX(ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_3D_GET_ROLLOFF_GAIN (ref DSP_STATE dsp_state, DSP_PAN_3D_ROLLOFF_TYPE rolloff, float distance, float mindistance, float maxdistance, out float gain); + + + /* + [ENUM] + [ + [DESCRIPTION] + These definitions can be used for creating FMOD defined special effects or DSP units. + + [REMARKS] + To get them to be active, first create the unit, then add it somewhere into the DSP network, either at the front of the network near the soundcard unit to affect the global output (by using System::getDSPHead), or on a single channel (using Channel::getDSPHead). + + [SEE_ALSO] + System::createDSPByType + ] + */ + public enum DSP_TYPE :int + { + UNKNOWN, /* This unit was created via a non FMOD plugin so has an unknown purpose. */ + MIXER, /* This unit does nothing but take inputs and mix them together then feed the result to the soundcard unit. */ + OSCILLATOR, /* This unit generates sine/square/saw/triangle or noise tones. */ + LOWPASS, /* This unit filters sound using a high quality, resonant lowpass filter algorithm but consumes more CPU time. */ + ITLOWPASS, /* This unit filters sound using a resonant lowpass filter algorithm that is used in Impulse Tracker, but with limited cutoff range (0 to 8060hz). */ + HIGHPASS, /* This unit filters sound using a resonant highpass filter algorithm. */ + ECHO, /* This unit produces an echo on the sound and fades out at the desired rate. */ + FADER, /* This unit pans and scales the volume of a unit. */ + FLANGE, /* This unit produces a flange effect on the sound. */ + DISTORTION, /* This unit distorts the sound. */ + NORMALIZE, /* This unit normalizes or amplifies the sound to a certain level. */ + LIMITER, /* This unit limits the sound to a certain level.*/ + PARAMEQ, /* This unit attenuates or amplifies a selected frequency range. */ + PITCHSHIFT, /* This unit bends the pitch of a sound without changing the speed of playback. */ + CHORUS, /* This unit produces a chorus effect on the sound. */ + VSTPLUGIN, /* This unit allows the use of Steinberg VST plugins */ + WINAMPPLUGIN, /* This unit allows the use of Nullsoft Winamp plugins */ + ITECHO, /* This unit produces an echo on the sound and fades out at the desired rate as is used in Impulse Tracker. */ + COMPRESSOR, /* This unit implements dynamic compression (linked multichannel, wideband) */ + SFXREVERB, /* This unit implements SFX reverb */ + LOWPASS_SIMPLE, /* This unit filters sound using a simple lowpass with no resonance, but has flexible cutoff and is fast. */ + DELAY, /* This unit produces different delays on individual channels of the sound. */ + TREMOLO, /* This unit produces a tremolo / chopper effect on the sound. */ + LADSPAPLUGIN, /* This unit allows the use of LADSPA standard plugins. */ + SEND, /* This unit sends a copy of the signal to a return DSP anywhere in the DSP tree. */ + RETURN, /* This unit receives signals from a number of send DSPs. */ + HIGHPASS_SIMPLE, /* This unit filters sound using a simple highpass with no resonance, but has flexible cutoff and is fast. */ + PAN, /* This unit pans the signal, possibly upmixing or downmixing as well. */ + THREE_EQ, /* This unit is a three-band equalizer. */ + FFT, /* This unit simply analyzes the signal and provides spectrum information back through getParameter. */ + LOUDNESS_METER, /* This unit analyzes the loudness and true peak of the signal. */ + ENVELOPEFOLLOWER, /* This unit tracks the envelope of the input/sidechain signal */ + CONVOLUTIONREVERB, /* This unit implements convolution reverb. */ + CHANNELMIX, /* This unit provides per signal channel gain, and output channel mapping to allow 1 multichannel signal made up of many groups of signals to map to a single output signal. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + DSP parameter types. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DESC + ] + */ + public enum DSP_PARAMETER_TYPE + { + FLOAT = 0, + INT, + BOOL, + DATA, + } + + + /* + [ENUM] + [ + [DESCRIPTION] + DSP float parameter mappings. These determine how values are mapped across dials and automation curves. + + [REMARKS] + FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO generates a mapping based on range and units. For example, if the units are in Hertz and the range is with-in the audio spectrum, a Bark scale will be chosen. Logarithmic scales may also be generated for ranges above zero spanning several orders of magnitude. + + [SEE_ALSO] + FMOD_DSP_PARAMETER_FLOAT_MAPPING + ] + */ + public enum DSP_PARAMETER_FLOAT_MAPPING_TYPE + { + DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR = 0, /* Values mapped linearly across range. */ + DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO, /* A mapping is automatically chosen based on range and units. See remarks. */ + DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR, /* Values mapped in a piecewise linear fashion defined by FMOD_DSP_PARAMETER_DESC_FLOAT::mapping.piecewiselinearmapping. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure to define a piecewise linear mapping. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE + FMOD_DSP_PARAMETER_FLOAT_MAPPING + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR + { + public int numpoints; /* [w] The number of pairs in the piecewise mapping (at least 2). */ + public IntPtr pointparamvalues; /* [w] The values in the parameter's units for each point */ + public IntPtr pointpositions; /* [w] The positions along the control's scale (e.g. dial angle) corresponding to each parameter value. The range of this scale is arbitrary and all positions will be relative to the minimum and maximum values (e.g. [0,1,3] is equivalent to [1,2,4] and [2,4,8]). If this array is zero, pointparamvalues will be distributed with equal spacing. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure to define a mapping for a DSP unit's float parameter. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE + FMOD_DSP_PARAMETER_DESC_FLOAT + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FLOAT_MAPPING + { + public DSP_PARAMETER_FLOAT_MAPPING_TYPE type; + public DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping; /* [w] Only required for FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR type mapping. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure to define a float parameter for a DSP unit. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + System::createDSP + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_PARAMETER_DESC + FMOD_DSP_PARAMETER_FLOAT_MAPPING + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_FLOAT + { + public float min; /* [w] Minimum parameter value. */ + public float max; /* [w] Maximum parameter value. */ + public float defaultval; /* [w] Default parameter value. */ + public DSP_PARAMETER_FLOAT_MAPPING mapping; /* [w] How the values are distributed across dials and automation curves (e.g. linearly, exponentially etc). */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure to define a int parameter for a DSP unit. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + System::createDSP + DSP::setParameterInt + DSP::getParameterInt + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_INT + { + public int min; /* [w] Minimum parameter value. */ + public int max; /* [w] Maximum parameter value. */ + public int defaultval; /* [w] Default parameter value. */ + public bool goestoinf; /* [w] Whether the last value represents infiniy. */ + public IntPtr valuenames; /* [w] Names for each value. There should be as many strings as there are possible values (max - min + 1). Optional. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure to define a boolean parameter for a DSP unit. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + System::createDSP + DSP::setParameterBool + DSP::getParameterBool + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_BOOL + { + public bool defaultval; /* [w] Default parameter value. */ + public IntPtr valuenames; /* [w] Names for false and true, respectively. There should be two strings. Optional. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure to define a data parameter for a DSP unit. Use 0 or above for custom types. This parameter will be treated specially by the system if set to one of the FMOD_DSP_PARAMETER_DATA_TYPE values. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + System::createDSP + DSP::setParameterData + DSP::getParameterData + FMOD_DSP_PARAMETER_DATA_TYPE + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_DATA + { + public int datatype; /* [w] The type of data for this parameter. Use 0 or above for custom types or set to one of the FMOD_DSP_PARAMETER_DATA_TYPE values. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + + [REMARKS] + Members marked with [w] mean the user sets the value before passing it to the function.
    + Members marked with [r] mean FMOD sets the value to be used after the function exits.
    +
    + The step parameter tells the gui or application that the parameter has a certain granularity.
    + For example in the example of cutoff frequency with a range from 100.0 to 22050.0 you might only want the selection to be in 10hz increments. For this you would simply use 10.0 as the step value.
    + For a boolean, you can use min = 0.0, max = 1.0, step = 1.0. This way the only possible values are 0.0 and 1.0.
    + Some applications may detect min = 0.0, max = 1.0, step = 1.0 and replace a graphical slider bar with a checkbox instead.
    + A step value of 1.0 would simulate integer values only.
    + A step value of 0.0 would mean the full floating point range is accessable.
    + + [SEE_ALSO] + System::createDSP + System::getDSP + ] + */ + [StructLayout(LayoutKind.Explicit)] + public struct DSP_PARAMETER_DESC_UNION + { + [FieldOffset(0)] + public DSP_PARAMETER_DESC_FLOAT floatdesc; /* [w] Struct containing information about the parameter in floating point format. Use when type is FMOD_DSP_PARAMETER_TYPE_FLOAT. */ + [FieldOffset(0)] + public DSP_PARAMETER_DESC_INT intdesc; /* [w] Struct containing information about the parameter in integer format. Use when type is FMOD_DSP_PARAMETER_TYPE_INT. */ + [FieldOffset(0)] + public DSP_PARAMETER_DESC_BOOL booldesc; /* [w] Struct containing information about the parameter in boolean format. Use when type is FMOD_DSP_PARAMETER_TYPE_BOOL. */ + [FieldOffset(0)] + public DSP_PARAMETER_DESC_DATA datadesc; /* [w] Struct containing information about the parameter in data format. Use when type is FMOD_DSP_PARAMETER_TYPE_DATA. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC + { + public DSP_PARAMETER_TYPE type; /* [w] Type of this parameter. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public char[] name; /* [w] Name of the parameter to be displayed (ie "Cutoff frequency"). */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public char[] label; /* [w] Short string to be put next to value to denote the unit type (ie "hz"). */ + public string description; /* [w] Description of the parameter to be displayed as a help item / tooltip for this parameter. */ + + public DSP_PARAMETER_DESC_UNION desc; + } + + /* + [ENUM] + [ + [DESCRIPTION] + Built-in types for the 'datatype' member of FMOD_DSP_PARAMETER_DESC_DATA. Data parameters of type other than FMOD_DSP_PARAMETER_DATA_TYPE_USER will be treated specially by the system. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DESC_DATA + FMOD_DSP_PARAMETER_OVERALLGAIN + FMOD_DSP_PARAMETER_3DATTRIBUTES + FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI + FMOD_DSP_PARAMETER_SIDECHAIN + ] + */ + public enum DSP_PARAMETER_DATA_TYPE + { + DSP_PARAMETER_DATA_TYPE_USER = 0, /* The default data type. All user data types should be 0 or above. */ + DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1, /* The data type for FMOD_DSP_PARAMETER_OVERALLGAIN parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2, /* The data type for FMOD_DSP_PARAMETER_3DATTRIBUTES parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3, /* The data type for FMOD_DSP_PARAMETER_SIDECHAIN parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_FFT = -4, /* The data type for FMOD_DSP_PARAMETER_FFT parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5, /* The data type for FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI parameters. There should a maximum of one per DSP. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure for data parameters of type FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN. + A parameter of this type is used in effects that affect the overgain of the signal in a predictable way. + This parameter is read by the system to determine the effect's gain for voice virtualization. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DATA_TYPE + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_OVERALLGAIN + { + public float linear_gain; /* [r] The overall linear gain of the effect on the direct signal path */ + public float linear_gain_additive; /* [r] Additive gain, for parallel signal paths */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure for data parameters of type FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES. + A parameter of this type is used in effects that respond to a sound's 3D position. + The system will set this parameter automatically if a sound's position changes. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DATA_TYPE + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_3DATTRIBUTES + { + public _3D_ATTRIBUTES relative; /* [w] The position of the sound relative to the listener. */ + public _3D_ATTRIBUTES absolute; /* [w] The position of the sound in world coordinates. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure for data parameters of type FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES. + A parameter of this type is used in effects that respond to a sound's 3D position. + The system will set this parameter automatically if a sound's position changes. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DATA_TYPE + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_3DATTRIBUTES_MULTI + { + public int numlisteners; /* [w] The number of listeners. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public _3D_ATTRIBUTES[] relative; /* [w] The position of the sound relative to the listeners. */ + public _3D_ATTRIBUTES absolute; /* [w] The position of the sound in world coordinates. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure for data parameters of type FMOD_DSP_PARAMETER_DATA_TYPE_SIDECHAIN. + A parameter of this type is declared for effects which support sidechaining. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DATA_TYPE + FMOD_DSP_PARAMETER_DESC + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_SIDECHAIN + { + public int sidechainenable; /* [r/w] Whether sidechains are enabled. */ + } + + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Structure for data parameters of type FMOD_DSP_PARAMETER_DATA_TYPE_FFT. + A parameter of this type is declared for the FMOD_DSP_TYPE_FFT effect. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    +
    + Notes on the spectrum data member. Values inside the float buffer are typically between 0 and 1.0.
    + Each top level array represents one PCM channel of data.
    + Address data as spectrum[channel][bin]. A bin is 1 fft window entry.
    + Only read/display half of the buffer typically for analysis as the 2nd half is usually the same data reversed due to the nature of the way FFT works.
    + + [SEE_ALSO] + FMOD_DSP_PARAMETER_DATA_TYPE + FMOD_DSP_PARAMETER_DESC + FMOD_DSP_PARAMETER_DATA_TYPE_FFT + FMOD_DSP_TYPE + FMOD_DSP_FFT + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FFT + { + public int length; /* [r] Number of entries in this spectrum window. Divide this by the output rate to get the hz per entry. */ + public int numchannels; /* [r] Number of channels in spectrum. */ + + [MarshalAs(UnmanagedType.ByValArray,SizeConst=32)] + private IntPtr[] spectrum_internal; /* [r] Per channel spectrum arrays. See remarks for more. */ + + public float[][] spectrum + { + get + { + var buffer = new float[numchannels][]; + + for (int i = 0; i < numchannels; ++i) + { + buffer[i] = new float[length]; + Marshal.Copy(spectrum_internal[i], buffer[i], 0, length); + } + + return buffer; + } + } + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + When creating a DSP unit, declare one of these and provide the relevant callbacks and name for FMOD to use when it creates and uses a DSP unit of this type. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    +
    + There are 2 different ways to change a parameter in this architecture.
    + One is to use DSP::setParameterFloat / DSP::setParameterInt / DSP::setParameterBool / DSP::setParameterData. This is platform independant and is dynamic, so new unknown plugins can have their parameters enumerated and used.
    + The other is to use DSP::showConfigDialog. This is platform specific and requires a GUI, and will display a dialog box to configure the plugin.
    + + [SEE_ALSO] + System::createDSP + DSP::setParameterFloat + DSP::setParameterInt + DSP::setParameterBool + DSP::setParameterData + FMOD_DSP_STATE + FMOD_DSP_CREATE_CALLBACK + FMOD_DSP_RELEASE_CALLBACK + FMOD_DSP_RESET_CALLBACK + FMOD_DSP_READ_CALLBACK + FMOD_DSP_PROCESS_CALLBACK + FMOD_DSP_SETPOSITION_CALLBACK + FMOD_DSP_PARAMETER_DESC + FMOD_DSP_SETPARAM_FLOAT_CALLBACK + FMOD_DSP_SETPARAM_INT_CALLBACK + FMOD_DSP_SETPARAM_BOOL_CALLBACK + FMOD_DSP_SETPARAM_DATA_CALLBACK + FMOD_DSP_GETPARAM_FLOAT_CALLBACK + FMOD_DSP_GETPARAM_INT_CALLBACK + FMOD_DSP_GETPARAM_BOOL_CALLBACK + FMOD_DSP_GETPARAM_DATA_CALLBACK + FMOD_DSP_SHOULDIPROCESS_CALLBACK + FMOD_DSP_SYSTEM_REGISTER_CALLBACK + FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK + FMOD_DSP_SYSTEM_MIX_CALLBACK + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_DESCRIPTION + { + public uint pluginsdkversion; /* [w] The plugin SDK version this plugin is built for. set to this to FMOD_PLUGIN_SDK_VERSION defined above. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public char[] name; /* [w] Name of the unit to be displayed in the network. */ + public uint version; /* [w] Plugin writer's version number. */ + public int numinputbuffers; /* [w] Number of input buffers to process. Use 0 for DSPs that only generate sound and 1 for effects that process incoming sound. */ + public int numoutputbuffers; /* [w] Number of audio output buffers. Only one output buffer is currently supported. */ + public DSP_CREATECALLBACK create; /* [w] Create callback. This is called when DSP unit is created. Can be null. */ + public DSP_RELEASECALLBACK release; /* [w] Release callback. This is called just before the unit is freed so the user can do any cleanup needed for the unit. Can be null. */ + public DSP_RESETCALLBACK reset; /* [w] Reset callback. This is called by the user to reset any history buffers that may need resetting for a filter, when it is to be used or re-used for the first time to its initial clean state. Use to avoid clicks or artifacts. */ + public DSP_READCALLBACK read; /* [w] Read callback. Processing is done here. Can be null. */ + public DSP_PROCESS_CALLBACK process; /* [w] Process callback. Can be specified instead of the read callback if any channel format changes occur between input and output. This also replaces shouldiprocess and should return an error if the effect is to be bypassed. Can be null. */ + public DSP_SETPOSITIONCALLBACK setposition; /* [w] Setposition callback. This is called if the unit wants to update its position info but not process data. Can be null. */ + + public int numparameters; /* [w] Number of parameters used in this filter. The user finds this with DSP::getNumParameters */ + public IntPtr paramdesc; /* [w] Variable number of parameter structures. */ + public DSP_SETPARAM_FLOAT_CALLBACK setparameterfloat; /* [w] This is called when the user calls DSP.setParameterFloat. Can be null. */ + public DSP_SETPARAM_INT_CALLBACK setparameterint; /* [w] This is called when the user calls DSP.setParameterInt. Can be null. */ + public DSP_SETPARAM_BOOL_CALLBACK setparameterbool; /* [w] This is called when the user calls DSP.setParameterBool. Can be null. */ + public DSP_SETPARAM_DATA_CALLBACK setparameterdata; /* [w] This is called when the user calls DSP.setParameterData. Can be null. */ + public DSP_GETPARAM_FLOAT_CALLBACK getparameterfloat; /* [w] This is called when the user calls DSP.getParameterFloat. Can be null. */ + public DSP_GETPARAM_INT_CALLBACK getparameterint; /* [w] This is called when the user calls DSP.getParameterInt. Can be null. */ + public DSP_GETPARAM_BOOL_CALLBACK getparameterbool; /* [w] This is called when the user calls DSP.getParameterBool. Can be null. */ + public DSP_GETPARAM_DATA_CALLBACK getparameterdata; /* [w] This is called when the user calls DSP.getParameterData. Can be null. */ + public DSP_SHOULDIPROCESS_CALLBACK shouldiprocess; /* [w] This is called before processing. You can detect if inputs are idle and return FMOD_OK to process, or any other error code to avoid processing the effect. Use a count down timer to allow effect tails to process before idling! */ + public IntPtr userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the DSP unit during creation. Access via DSP::getUserData. */ + + public DSP_SYSTEM_REGISTER_CALLBACK sys_register; /* [w] Register callback. This is called when DSP unit is loaded/registered. Useful for 'global'/per system object init for plugin. Can be null. */ + public DSP_SYSTEM_DEREGISTER_CALLBACK sys_deregister; /* [w] Deregister callback. This is called when DSP unit is unloaded/deregistered. Useful as 'global'/per system object shutdown for plugin. Can be null. */ + public DSP_SYSTEM_MIX_CALLBACK sys_mix; /* [w] System mix stage callback. This is called when the mixer starts to execute or is just finishing executing. Useful for 'global'/per system object once a mix update calls for a plugin. Can be null. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Struct containing DFT callbacks for plugins, to enable a plugin to perform optimized time-frequency domain conversion. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_STATE_SYSTEMCALLBACKS + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_DFTCALLBACKS + { + public DSP_DFT_FFTREAL fftreal; /* [r] Callback for performing an FFT on a real signal. */ + public DSP_DFT_IFFTREAL inversefftreal; /* [r] Callback for performing an inverse FFT to get a real signal. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Struct containing panning helper callbacks for plugins. + + [REMARKS] + These are experimental, please contact support@fmod.org for more information. + + [SEE_ALSO] + FMOD_DSP_STATE_SYSTEMCALLBACKS + FMOD_PAN_SURROUND_FLAGS + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_PAN_CALLBACKS + { + public DSP_PAN_SUM_MONO_MATRIX summonomatrix; + public DSP_PAN_SUM_STEREO_MATRIX sumstereomatrix; + public DSP_PAN_SUM_SURROUND_MATRIX sumsurroundmatrix; + public DSP_PAN_SUM_MONO_TO_SURROUND_MATRIX summonotosurroundmatrix; + public DSP_PAN_SUM_STEREO_TO_SURROUND_MATRIX sumstereotosurroundmatrix; + public DSP_PAN_3D_GET_ROLLOFF_GAIN getrolloffgain; + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + Struct containing System level callbacks for plugins, to enable a plugin to query information about the system or allocate memory using FMOD's (and therefore possibly the game's) allocators. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_DSP_STATE + FMOD_DSP_STATE_DFTCALLBACKS + FMOD_DSP_STATE_PAN_CALLBACKS + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_SYSTEMCALLBACKS + { + MEMORY_ALLOC_CALLBACK alloc; /* [r] Memory allocation callback. Use this for all dynamic memory allocation within the plugin. */ + MEMORY_REALLOC_CALLBACK realloc; /* [r] Memory reallocation callback. */ + MEMORY_FREE_CALLBACK free; /* [r] Memory free callback. */ + DSP_SYSTEM_GETSAMPLERATE getsamplerate; /* [r] Callback for getting the system samplerate. */ + DSP_SYSTEM_GETBLOCKSIZE getblocksize; /* [r] Callback for getting the system's block size. DSPs will be requested to process blocks of varying length up to this size.*/ + IntPtr dft; /* [r] Struct containing callbacks for performing FFTs and inverse FFTs. */ + IntPtr pancallbacks; /* [r] Pointer to a structure of callbacks for calculating pan, up-mix and down-mix matrices. */ + DSP_SYSTEM_GETSPEAKERMODE getspeakermode; /* [r] Callback for getting the system's speaker modes. One is the mixer's default speaker mode, the other is the output mode the system is downmixing or upmixing to.*/ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + DSP plugin structure that is passed into each callback. + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    +
    + 'systemobject' is an integer that relates to the System object that created the DSP or registered the DSP plugin. If only 1 System object is created then it should be 0. A second object would be 1 and so on. + FMOD_DSP_STATE_SYSTEMCALLBACKS::getsamplerate and FMOD_DSP_STATE_SYSTEMCALLBACKS::getblocksize could return different results so it could be relevant to plugin developers to monitor which object is being used. + + [SEE_ALSO] + FMOD_DSP_DESCRIPTION + FMOD_DSP_STATE_SYSTEMCALLBACKS + ] + */ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE + { + public IntPtr instance; /* [r] Handle to the DSP hand the user created. Not to be modified. C++ users cast to FMOD::DSP to use. */ + public IntPtr plugindata; /* [r/w] Plugin writer created data the output author wants to attach to this object. */ + public uint channelmask; /* [r] Specifies which speakers the DSP effect is active on */ + public int source_speakermode; /* [r] Specifies which speaker mode the signal originated for information purposes, ie in case panning needs to be done differently. */ + public IntPtr sidechaindata; /* [r] The mixed result of all incoming sidechains is stored at this pointer address. */ + public int sidechainchannels; /* [r] The number of channels of pcm data stored within the sidechain buffer. */ + public IntPtr callbacks; /* [r] Struct containing callbacks for system level functionality. */ + public int systemobject; /* [r] FMOD::System object index, relating to the System object that created this DSP. */ + } + + /* + [STRUCTURE] + [ + [DESCRIPTION] + DSP metering info used for retrieving metering info + + [REMARKS] + Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
    + Members marked with [w] mean the variable can be written to. The user can set the value.
    + + [SEE_ALSO] + FMOD_SPEAKER + ] + */ + [StructLayout(LayoutKind.Sequential)] + public class DSP_METERING_INFO + { + public int numsamples; /* [r] The number of samples considered for this metering info. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] + public float[] peaklevel; /* [r] The peak level per channel. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] + public float[] rmslevel; /* [r] The rms level per channel. */ + public short numchannels; /* [r] Number of channels. */ + } + + + + /* + ============================================================================================================== + + FMOD built in effect parameters. + Use DSP::setParameter with these enums for the 'index' parameter. + + ============================================================================================================== + */ + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_OSCILLATOR filter. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameter + DSP::getParameter + FMOD_DSP_TYPE + ] + */ + public enum DSP_OSCILLATOR + { + TYPE, /* Waveform type. 0 = sine. 1 = square. 2 = sawup. 3 = sawdown. 4 = triangle. 5 = noise. */ + RATE /* Frequency of the sinewave in hz. 1.0 to 22000.0. Default = 220.0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_LOWPASS filter. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameter + DSP::getParameter + FMOD_DSP_TYPE + ] + */ + public enum DSP_LOWPASS + { + CUTOFF, /* Lowpass cutoff frequency in hz. 1.0 to 22000.0. Default = 5000.0. */ + RESONANCE /* Lowpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_ITLOWPASS filter. + This is different to the default FMOD_DSP_TYPE_ITLOWPASS filter in that it uses a different quality algorithm and is + the filter used to produce the correct sounding playback in .IT files.
    + FMOD Ex's .IT playback uses this filter.
    + + [REMARKS] + Note! This filter actually has a limited cutoff frequency below the specified maximum, due to its limited design, + so for a more open range filter use FMOD_DSP_LOWPASS or if you don't mind not having resonance, + FMOD_DSP_LOWPASS_SIMPLE.
    + The effective maximum cutoff is about 8060hz. + + [SEE_ALSO] + DSP::setParameter + DSP::getParameter + FMOD_DSP_TYPE + ] + */ + public enum DSP_ITLOWPASS + { + CUTOFF, /* Lowpass cutoff frequency in hz. 1.0 to 22000.0. Default = 5000.0/ */ + RESONANCE /* Lowpass resonance Q value. 0.0 to 127.0. Default = 1.0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_HIGHPASS filter. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameter + DSP::getParameter + FMOD_DSP_TYPE + ] + */ + public enum DSP_HIGHPASS + { + CUTOFF, /* (Type:float) - Highpass cutoff frequency in hz. 1.0 to output 22000.0. Default = 5000.0. */ + RESONANCE /* (Type:float) - Highpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_ECHO filter. + + [REMARKS] + Note. Every time the delay is changed, the plugin re-allocates the echo buffer. This means the echo will dissapear at that time while it refills its new buffer.
    + Larger echo delays result in larger amounts of memory allocated.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_ECHO + { + DELAY, /* (Type:float) - Echo delay in ms. 10 to 5000. Default = 500. */ + FEEDBACK, /* (Type:float) - Echo decay per delay. 0 to 100. 100.0 = No decay, 0.0 = total decay (ie simple 1 line delay). Default = 50.0. */ + DRYLEVEL, /* (Type:float) - Original sound volume in dB. -80.0 to 10.0. Default = 0. */ + WETLEVEL /* (Type:float) - Volume of echo signal to pass to output in dB. -80.0 to 10.0. Default = 0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_DELAY filter. + + [REMARKS] + Note. Every time MaxDelay is changed, the plugin re-allocates the delay buffer. This means the delay will dissapear at that time while it refills its new buffer.
    + A larger MaxDelay results in larger amounts of memory allocated.
    + Channel delays above MaxDelay will be clipped to MaxDelay and the delay buffer will not be resized.
    +
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_DELAY + { + CH0, /* Channel #0 Delay in ms. 0 to 10000. Default = 0. */ + CH1, /* Channel #1 Delay in ms. 0 to 10000. Default = 0. */ + CH2, /* Channel #2 Delay in ms. 0 to 10000. Default = 0. */ + CH3, /* Channel #3 Delay in ms. 0 to 10000. Default = 0. */ + CH4, /* Channel #4 Delay in ms. 0 to 10000. Default = 0. */ + CH5, /* Channel #5 Delay in ms. 0 to 10000. Default = 0. */ + CH6, /* Channel #6 Delay in ms. 0 to 10000. Default = 0. */ + CH7, /* Channel #7 Delay in ms. 0 to 10000. Default = 0. */ + CH8, /* Channel #8 Delay in ms. 0 to 10000. Default = 0. */ + CH9, /* Channel #9 Delay in ms. 0 to 10000. Default = 0. */ + CH10, /* Channel #10 Delay in ms. 0 to 10000. Default = 0. */ + CH11, /* Channel #11 Delay in ms. 0 to 10000. Default = 0. */ + CH12, /* Channel #12 Delay in ms. 0 to 10000. Default = 0. */ + CH13, /* Channel #13 Delay in ms. 0 to 10000. Default = 0. */ + CH14, /* Channel #14 Delay in ms. 0 to 10000. Default = 0. */ + CH15, /* Channel #15 Delay in ms. 0 to 10000. Default = 0. */ + MAXDELAY, /* Maximum delay in ms. 0 to 1000. Default = 10. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_FLANGE filter. + + [REMARKS] + Flange is an effect where the signal is played twice at the same time, and one copy slides back and forth creating a whooshing or flanging effect.
    + As there are 2 copies of the same signal, by default each signal is given 50% mix, so that the total is not louder than the original unaffected signal.
    +
    + Flange depth is a percentage of a 10ms shift from the original signal. Anything above 10ms is not considered flange because to the ear it begins to 'echo' so 10ms is the highest value possible.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_FLANGE + { + MIX, /* (Type:float) - Percentage of wet signal in mix. 0 to 100. Default = 50. */ + DEPTH, /* (Type:float) - Flange depth (percentage of 40ms delay). 0.01 to 1.0. Default = 1.0. */ + RATE /* (Type:float) - Flange speed in hz. 0.0 to 20.0. Default = 0.1. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_TREMOLO filter. + + [REMARKS] + The tremolo effect varies the amplitude of a sound. Depending on the settings, this unit can produce a tremolo, chopper or auto-pan effect.
    +
    + The shape of the LFO (low freq. oscillator) can morphed between sine, triangle and sawtooth waves using the FMOD_DSP_TREMOLO_SHAPE and FMOD_DSP_TREMOLO_SKEW parameters.
    + FMOD_DSP_TREMOLO_DUTY and FMOD_DSP_TREMOLO_SQUARE are useful for a chopper-type effect where the first controls the on-time duration and second controls the flatness of the envelope.
    + FMOD_DSP_TREMOLO_SPREAD varies the LFO phase between channels to get an auto-pan effect. This works best with a sine shape LFO.
    + The LFO can be synchronized using the FMOD_DSP_TREMOLO_PHASE parameter which sets its instantaneous phase.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameter + FMOD_DSP_TYPE + ] + */ + public enum DSP_TREMOLO + { + FREQUENCY, /* LFO frequency in Hz. 0.1 to 20. Default = 4. */ + DEPTH, /* Tremolo depth. 0 to 1. Default = 0. */ + SHAPE, /* LFO shape morph between triangle and sine. 0 to 1. Default = 0. */ + SKEW, /* Time-skewing of LFO cycle. -1 to 1. Default = 0. */ + DUTY, /* LFO on-time. 0 to 1. Default = 0.5. */ + SQUARE, /* Flatness of the LFO shape. 0 to 1. Default = 0. */ + PHASE, /* Instantaneous LFO phase. 0 to 1. Default = 0. */ + SPREAD /* Rotation / auto-pan effect. -1 to 1. Default = 0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_DISTORTION filter. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_DISTORTION + { + LEVEL /* Distortion value. 0.0 to 1.0. Default = 0.5. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_NORMALIZE filter. + + [REMARKS] + Normalize amplifies the sound based on the maximum peaks within the signal.
    + For example if the maximum peaks in the signal were 50% of the bandwidth, it would scale the whole sound by 2.
    + The lower threshold value makes the normalizer ignores peaks below a certain point, to avoid over-amplification if a loud signal suddenly came in, and also to avoid amplifying to maximum things like background hiss.
    +
    + Because FMOD is a realtime audio processor, it doesn't have the luxury of knowing the peak for the whole sound (ie it can't see into the future), so it has to process data as it comes in.
    + To avoid very sudden changes in volume level based on small samples of new data, fmod fades towards the desired amplification which makes for smooth gain control. The fadetime parameter can control this.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameter + FMOD_DSP_TYPE + ] + */ + public enum DSP_NORMALIZE + { + FADETIME, /* Time to ramp the silence to full in ms. 0.0 to 20000.0. Default = 5000.0. */ + THRESHHOLD, /* Lower volume range threshold to ignore. 0.0 to 1.0. Default = 0.1. Raise higher to stop amplification of very quiet signals. */ + MAXAMP /* Maximum amplification allowed. 1.0 to 100000.0. Default = 20.0. 1.0 = no amplifaction, higher values allow more boost. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_LIMITER filter. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_LIMITER + { + RELEASETIME, /* (Type:float) - Time to ramp the silence to full in ms. 1.0 to 1000.0. Default = 10.0. */ + CEILING, /* (Type:float) - Maximum level of the output signal in dB. -12.0 to 0.0. Default = 0.0. */ + MAXIMIZERGAIN, /* (Type:float) - Maximum amplification allowed in dB. 0.0 to 12.0. Default = 0.0. 0.0 = no amplifaction, higher values allow more boost. */ + MODE, /* (Type:float) - Channel processing mode. 0 or 1. Default = 0. 0 = Independent (limiter per channel), 1 = Linked*/ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_PARAMEQ filter. + + [REMARKS] + Parametric EQ is a bandpass filter that attenuates or amplifies a selected frequency and its neighbouring frequencies.
    +
    + To create a multi-band EQ create multiple FMOD_DSP_TYPE_PARAMEQ units and set each unit to different frequencies, for example 1000hz, 2000hz, 4000hz, 8000hz, 16000hz with a range of 1 octave each.
    +
    + When a frequency has its gain set to 1.0, the sound will be unaffected and represents the original signal exactly.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_PARAMEQ + { + CENTER, /* Frequency center. 20.0 to 22000.0. Default = 8000.0. */ + BANDWIDTH, /* Octave range around the center frequency to filter. 0.2 to 5.0. Default = 1.0. */ + GAIN /* Frequency Gain. 0.05 to 3.0. Default = 1.0. */ + } + + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_PITCHSHIFT filter. + + [REMARKS] + This pitch shifting unit can be used to change the pitch of a sound without speeding it up or slowing it down.
    + It can also be used for time stretching or scaling, for example if the pitch was doubled, and the frequency of the sound was halved, the pitch of the sound would sound correct but it would be twice as slow.
    +
    + Warning! This filter is very computationally expensive! Similar to a vocoder, it requires several overlapping FFT and IFFT's to produce smooth output, and can require around 440mhz for 1 stereo 48khz signal using the default settings.
    + Reducing the signal to mono will half the cpu usage, as will the overlap count.
    + Reducing this will lower audio quality, but what settings to use are largely dependant on the sound being played. A noisy polyphonic signal will need higher overlap and fft size compared to a speaking voice for example.
    +
    + This pitch shifter is based on the pitch shifter code at http://www.dspdimension.com, written by Stephan M. Bernsee.
    + The original code is COPYRIGHT 1999-2003 Stephan M. Bernsee .
    +
    + 'maxchannels' dictates the amount of memory allocated. By default, the maxchannels value is 0. If FMOD is set to stereo, the pitch shift unit will allocate enough memory for 2 channels. If it is 5.1, it will allocate enough memory for a 6 channel pitch shift, etc.
    + If the pitch shift effect is only ever applied to the global mix (ie it was added with System::addDSP), then 0 is the value to set as it will be enough to handle all speaker modes.
    + When the pitch shift is added to a channel (ie Channel::addDSP) then the channel count that comes in could be anything from 1 to 8 possibly. It is only in this case where you might want to increase the channel count above the output's channel count.
    + If a channel pitch shift is set to a lower number than the sound's channel count that is coming in, it will not pitch shift the sound.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_PITCHSHIFT + { + PITCH, /* Pitch value. 0.5 to 2.0. Default = 1.0. 0.5 = one octave down, 2.0 = one octave up. 1.0 does not change the pitch. */ + FFTSIZE, /* FFT window size. 256, 512, 1024, 2048, 4096. Default = 1024. Increase this to reduce 'smearing'. This effect is a warbling sound similar to when an mp3 is encoded at very low bitrates. */ + OVERLAP, /* Window overlap. 1 to 32. Default = 4. Increase this to reduce 'tremolo' effect. Increasing it by a factor of 2 doubles the CPU usage. */ + MAXCHANNELS /* Maximum channels supported. 0 to 16. 0 = same as fmod's default output polyphony, 1 = mono, 2 = stereo etc. See remarks for more. Default = 0. It is suggested to leave at 0! */ + } + + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_CHORUS filter. + + [REMARKS] + Chorous is an effect where the sound is more 'spacious' due to 1 to 3 versions of the sound being played along side the original signal but with the pitch of each copy modulating on a sine wave.
    + This is a highly configurable chorus unit. It supports 3 taps, small and large delay times and also feedback.
    + This unit also could be used to do a simple echo, or a flange effect. + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_CHORUS + { + MIX, /* (Type:float) - Volume of original signal to pass to output. 0.0 to 100.0. Default = 50.0. */ + RATE, /* (Type:float) - Chorus modulation rate in Hz. 0.0 to 20.0. Default = 0.8 Hz. */ + DEPTH, /* (Type:float) - Chorus modulation depth. 0.0 to 100.0. Default = 3.0. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_ITECHO filter.
    + This is effectively a software based echo filter that emulates the DirectX DMO echo effect. Impulse tracker files can support this, and FMOD will produce the effect on ANY platform, not just those that support DirectX effects!
    + + [REMARKS] + Note. Every time the delay is changed, the plugin re-allocates the echo buffer. This means the echo will dissapear at that time while it refills its new buffer.
    + Larger echo delays result in larger amounts of memory allocated.
    +
    + For stereo signals only! This will not work on mono or multichannel signals. This is fine for .IT format purposes, and also if you use System::addDSP with a standard stereo output.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + System::addDSP + ] + */ + public enum DSP_ITECHO + { + WETDRYMIX, /* Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0.0 through 100.0 (all wet). The default value is 50. */ + FEEDBACK, /* Percentage of output fed back into input, in the range from 0.0 through 100.0. The default value is 50. */ + LEFTDELAY, /* Delay for left channel, in milliseconds, in the range from 1.0 through 2000.0. The default value is 500 ms. */ + RIGHTDELAY, /* Delay for right channel, in milliseconds, in the range from 1.0 through 2000.0. The default value is 500 ms. */ + PANDELAY /* Value that specifies whether to swap left and right delays with each successive echo. The default value is zero, meaning no swap. Possible values are defined as 0.0 (equivalent to FALSE) and 1.0 (equivalent to TRUE). */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_COMPRESSOR unit. + This is a multichannel software limiter that is uniform across the whole spectrum. + + [REMARKS] + The limiter is not guaranteed to catch every peak above the threshold level, + because it cannot apply gain reduction instantaneously - the time delay is + determined by the attack time. However setting the attack time too short will + distort the sound, so it is a compromise. High level peaks can be avoided by + using a short attack time - but not too short, and setting the threshold a few + decibels below the critical level. +
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + DSP::setParameterBool + DSP::getParameterBool + FMOD_DSP_TYPE + ] + */ + public enum DSP_COMPRESSOR + { + THRESHOLD, /* (Type:float) - Threshold level (dB) in the range from -80 through 0. The default value is 0. */ + RATIO, /* (Type:float) - Compression Ratio (dB/dB) in the range from 1 to 50. The default value is 2.5. */ + ATTACK, /* (Type:float) - Attack time (milliseconds), in the range from 0.1 through 1000. The default value is 20. */ + RELEASE, /* (Type:float) - Release time (milliseconds), in the range from 10 through 5000. The default value is 100 */ + GAINMAKEUP, /* (Type:float) - Make-up gain (dB) applied after limiting, in the range from 0 through 30. The default value is 0. */ + USESIDECHAIN,/* (Type:bool) - Whether to analyse the sidechain signal instead of the input signal. The default value is false */ + LINKED /* (Type:bool) - FALSE = Independent (compressor per channel), TRUE = Linked. The default value is TRUE. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_SFXREVERB unit.
    + + [REMARKS] + This is a high quality I3DL2 based reverb.
    + On top of the I3DL2 property set, "Dry Level" is also included to allow the dry mix to be changed.
    +
    + These properties can be set with presets in FMOD_REVERB_PRESETS. + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + FMOD_REVERB_PRESETS + ] + */ + public enum DSP_SFXREVERB + { + DECAYTIME, /* (Type:float) - Decay Time : Reverberation decay time at low-frequencies in milliseconds. Ranges from 100.0 to 20000.0. Default is 1500. */ + EARLYDELAY, /* (Type:float) - Early Delay : Delay time of first reflection in milliseconds. Ranges from 0.0 to 300.0. Default is 20. */ + LATEDELAY, /* (Type:float) - Reverb Delay : Late reverberation delay time relative to first reflection in milliseconds. Ranges from 0.0 to 100.0. Default is 40. */ + HFREFERENCE, /* (Type:float) - HF Reference : Reference frequency for high-frequency decay in Hz. Ranges from 20.0 to 20000.0. Default is 5000. */ + HFDECAYRATIO, /* (Type:float) - Decay HF Ratio : High-frequency decay time relative to decay time in percent. Ranges from 10.0 to 100.0. Default is 50. */ + DIFFUSION, /* (Type:float) - Diffusion : Reverberation diffusion (echo density) in percent. Ranges from 0.0 to 100.0. Default is 100. */ + DENSITY, /* (Type:float) - Density : Reverberation density (modal density) in percent. Ranges from 0.0 to 100.0. Default is 100. */ + LOWSHELFFREQUENCY, /* (Type:float) - Low Shelf Frequency : Transition frequency of low-shelf filter in Hz. Ranges from 20.0 to 1000.0. Default is 250. */ + LOWSHELFGAIN, /* (Type:float) - Low Shelf Gain : Gain of low-shelf filter in dB. Ranges from -36.0 to 12.0. Default is 0. */ + HIGHCUT, /* (Type:float) - High Cut : Cutoff frequency of low-pass filter in Hz. Ranges from 20.0 to 20000.0. Default is 20000. */ + EARLYLATEMIX, /* (Type:float) - Early/Late Mix : Blend ratio of late reverb to early reflections in percent. Ranges from 0.0 to 100.0. Default is 50. */ + WETLEVEL, /* (Type:float) - Wet Level : Reverb signal level in dB. Ranges from -80.0 to 20.0. Default is -6. */ + DRYLEVEL /* (Type:float) - Dry Level : Dry signal level in dB. Ranges from -80.0 to 20.0. Default is 0. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_LOWPASS_SIMPLE filter.
    + This is a very simple low pass filter, based on two single-pole RC time-constant modules. + The emphasis is on speed rather than accuracy, so this should not be used for task requiring critical filtering.
    + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_LOWPASS_SIMPLE + { + CUTOFF /* Lowpass cutoff frequency in hz. 10.0 to 22000.0. Default = 5000.0 */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_SEND DSP. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterInt + DSP::getParameterInt + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_SEND + { + RETURNID, /* (Type:int) - ID of the Return DSP this send is connected to (integer values only). -1 indicates no connected Return DSP. Default = -1. */ + LEVEL, /* (Type:float) - Send level. 0.0 to 1.0. Default = 1.0 */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_RETURN DSP. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterInt + DSP::getParameterInt + FMOD_DSP_TYPE + ] + */ + public enum DSP_RETURN + { + ID, /* (Type:int) - ID of this Return DSP. Read-only. Default = -1*/ + INPUT_SPEAKER_MODE /* (Type:int) - Input speaker mode of this return. Default = FMOD_SPEAKERMODE_DEFAULT.*/ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_HIGHPASS_SIMPLE filter.
    + This is a very simple single-order high pass filter. + The emphasis is on speed rather than accuracy, so this should not be used for task requiring critical filtering.
    + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_HIGHPASS_SIMPLE + { + CUTOFF /* (Type:float) - Highpass cutoff frequency in hz. 10.0 to 22000.0. Default = 1000.0 */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter values for the FMOD_DSP_PAN_SURROUND_FROM_STEREO_MODE parameter of the FMOD_DSP_TYPE_PAN DSP. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_PAN + ] + */ + public enum DSP_PAN_SURROUND_FROM_STEREO_MODE_TYPE + { + DISTRIBUTED, + DISCRETE + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter values for the FMOD_DSP_PAN_MODE parameter of the FMOD_DSP_TYPE_PAN DSP. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_PAN + ] + */ + public enum DSP_PAN_MODE_TYPE + { + MONO, + STEREO, + SURROUND + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter values for the FMOD_DSP_PAN_3D_ROLLOFF parameter of the FMOD_DSP_TYPE_PAN DSP. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_PAN + ] + */ + public enum DSP_PAN_3D_ROLLOFF_TYPE + { + LINEARSQUARED, + LINEAR, + INVERSE, + INVERSETAPERED, + CUSTOM + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter values for the FMOD_DSP_PAN_3D_EXTENT_MODE parameter of the FMOD_DSP_TYPE_PAN DSP. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_PAN + ] + */ + public enum DSP_PAN_3D_EXTENT_MODE_TYPE + { + AUTO, + USER, + OFF + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_PAN DSP. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + DSP::setParameterInt + DSP::getParameterInt + DSP::setParameterData + DSP::getParameterData + FMOD_DSP_TYPE + ] + */ + public enum DSP_PAN + { + MODE, /* (Type:int) - Panner mode. FMOD_DSP_PAN_MODE_MONO for mono down-mix, FMOD_DSP_PAN_MODE_STEREO for stereo panning or FMOD_DSP_PAN_MODE_SURROUND for surround panning. Default = FMOD_DSP_PAN_MODE_SURROUND */ + STEREO_POSITION, /* (Type:float) - Stereo pan position STEREO_POSITION_MIN to STEREO_POSITION_MAX. Default = 0.0. */ + SURROUND_DIRECTION, /* (Type:float) - Surround pan direction ROTATION_MIN to ROTATION_MAX. Default = 0.0. */ + SURROUND_EXTENT, /* (Type:float) - Surround pan extent EXTENT_MIN to EXTENT_MAX. Default = 360.0. */ + SURROUND_ROTATION, /* (Type:float) - Surround pan rotation ROTATION_MIN to ROTATION_MAX. Default = 0.0. */ + SURROUND_LFE_LEVEL, /* (Type:float) - Surround pan LFE level SURROUND_LFE_LEVEL_MIN to SURROUND_LFE_LEVEL_MAX. Default = 0.0. */ + SURROUND_FROM_STEREO_MODE, /* (Type:int) - Stereo-To-Surround Mode FMOD_DSP_PAN_SURROUND_FROM_STEREO_MODE_DISTRIBUTED to FMOD_DSP_PAN_SURROUND_FROM_STEREO_MODE_DISCRETE. Default = FMOD_DSP_PAN_SURROUND_FROM_STEREO_MODE_DISCRETE. */ + SURROUND_STEREO_SEPARATION, /* (Type:float) - Stereo-To-Surround Stereo Separation. ROTATION_MIN to ROTATION_MAX. Default = 60.0. */ + SURROUND_STEREO_AXIS, /* (Type:float) - Stereo-To-Surround Stereo Axis. ROTATION_MIN to ROTATION_MAX. Default = 0.0. */ + ENABLED_SURROUND_SPEAKERS, /* (Type:int) - Surround Speakers Enabled. 0 to 0xFFF. Default = 0xFFF. */ + _3D_POSITION, /* (Type:data) - 3D Position data of type FMOD_DSP_PARAMETER_DATA_TYPE_3DPOS */ + _3D_ROLLOFF, /* (Type:int) - 3D Rolloff FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED to FMOD_DSP_PAN_3D_ROLLOFF_CUSTOM. Default = FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED. */ + _3D_MIN_DISTANCE, /* (Type:float) - 3D Min Distance 0.0 to GAME_UNITS_MAX. Default = 1.0. */ + _3D_MAX_DISTANCE, /* (Type:float) - 3D Max Distance 0.0 to GAME_UNITS_MAX. Default = 20.0. */ + _3D_EXTENT_MODE, /* (Type:int) - 3D Extent Mode FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO to FMOD_DSP_PAN_3D_EXTENT_MODE_OFF. Default = FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO. */ + _3D_SOUND_SIZE, /* (Type:float) - 3D Sound Size 0.0 to GAME_UNITS_MAX. Default = 0.0. */ + _3D_MIN_EXTENT, /* (Type:float) - 3D Min Extent EXTENT_MIN to EXTENT_MAX. Default = 0.0. */ + _3D_PAN_BLEND, /* (Type:float) - 3D Pan Blend PAN_BLEND_MIN to PAN_BLEND_MAX. Default = 0.0. */ + LFE_UPMIX_ENABLED, /* (Type:int) - LFE Upmix Enabled 0 to 1. Default = 0. */ + OVERALL_GAIN, /* (Type:data) - Overall Gain data of type FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN */ + SURROUND_SPEAKER_MODE /* (Type:int) - Surround speaker mode. Target speaker mode for surround panning. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter values for the FMOD_DSP_THREE_EQ_CROSSOVERSLOPE parameter of the FMOD_DSP_TYPE_THREE_EQ DSP. + + [REMARKS] + + [SEE_ALSO] + FMOD_DSP_THREE_EQ + ] + */ + public enum DSP_THREE_EQ_CROSSOVERSLOPE_TYPE + { + _12DB, + _24DB, + _48DB + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_THREE_EQ filter. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + DSP::setParameterInt + DSP::getParameterInt + FMOD_DSP_TYPE + FMOD_DSP_THREE_EQ_CROSSOVERSLOPE_TYPE + ] + */ + public enum DSP_THREE_EQ + { + LOWGAIN, /* (Type:float) - Low frequency gain in dB. -80.0 to 10.0. Default = 0. */ + MIDGAIN, /* (Type:float) - Mid frequency gain in dB. -80.0 to 10.0. Default = 0. */ + HIGHGAIN, /* (Type:float) - High frequency gain in dB. -80.0 to 10.0. Default = 0. */ + LOWCROSSOVER, /* (Type:float) - Low-to-mid crossover frequency in Hz. 10.0 to 22000.0. Default = 400.0. */ + HIGHCROSSOVER, /* (Type:float) - Mid-to-high crossover frequency in Hz. 10.0 to 22000.0. Default = 4000.0. */ + CROSSOVERSLOPE /* (Type:int) - Crossover Slope. 0 = 12dB/Octave, 1 = 24dB/Octave, 2 = 48dB/Octave. Default = 1 (24dB/Octave). */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + List of windowing methods for the FMOD_DSP_TYPE_FFT unit. Used in spectrum analysis to reduce leakage / transient signals intefering with the analysis.
    + This is a problem with analysis of continuous signals that only have a small portion of the signal sample (the fft window size).
    + Windowing the signal with a curve or triangle tapers the sides of the fft window to help alleviate this problem. + + [REMARKS] + Cyclic signals such as a sine wave that repeat their cycle in a multiple of the window size do not need windowing.
    + I.e. If the sine wave repeats every 1024, 512, 256 etc samples and the FMOD fft window is 1024, then the signal would not need windowing.
    + Not windowing is the same as FMOD_DSP_FFT_WINDOW_RECT, which is the default.
    + If the cycle of the signal (ie the sine wave) is not a multiple of the window size, it will cause frequency abnormalities, so a different windowing method is needed.
    + +
    + FMOD_DSP_FFT_WINDOW_RECT.
    +
    +
    + FMOD_DSP_FFT_WINDOW_TRIANGLE.
    +
    +
    + FMOD_DSP_FFT_WINDOW_HAMMING.
    +
    +
    + FMOD_DSP_FFT_WINDOW_HANNING.
    +
    +
    + FMOD_DSP_FFT_WINDOW_BLACKMAN.
    +
    +
    + FMOD_DSP_FFT_WINDOW_BLACKMANHARRIS.
    + +
    + + [SEE_ALSO] + FMOD_DSP_FFT + ] + */ + public enum DSP_FFT_WINDOW + { + RECT, /* w[n] = 1.0 */ + TRIANGLE, /* w[n] = TRI(2n/N) */ + HAMMING, /* w[n] = 0.54 - (0.46 * COS(n/N) ) */ + HANNING, /* w[n] = 0.5 * (1.0 - COS(n/N) ) */ + BLACKMAN, /* w[n] = 0.42 - (0.5 * COS(n/N) ) + (0.08 * COS(2.0 * n/N) ) */ + BLACKMANHARRIS /* w[n] = 0.35875 - (0.48829 * COS(1.0 * n/N)) + (0.14128 * COS(2.0 * n/N)) - (0.01168 * COS(3.0 * n/N)) */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_FFT dsp effect. + + [REMARKS] + Set the attributes for the spectrum analysis with FMOD_DSP_FFT_WINDOWSIZE and FMOD_DSP_FFT_WINDOWTYPE, and retrieve the results with FMOD_DSP_FFT_SPECTRUM and FMOD_DSP_FFT_DOMINANT_FREQ. + FMOD_DSP_FFT_SPECTRUM stores its data in the FMOD_DSP_PARAMETER_DATA_TYPE_FFT. You will need to cast to this structure to get the right data. + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + DSP::setParameterInt + DSP::getParameterInt + DSP::setParameterData + DSP::getParameterData + FMOD_DSP_TYPE + FMOD_DSP_FFT_WINDOW + ] + */ + public enum DSP_FFT + { + WINDOWSIZE, /* (Type:int) - [r/w] Must be a power of 2 between 128 and 16384. 128, 256, 512, 1024, 2048, 4096, 8192, 16384 are accepted. Default = 2048. */ + WINDOWTYPE, /* (Type:int) - [r/w] Refer to FMOD_DSP_FFT_WINDOW enumeration. Default = FMOD_DSP_FFT_WINDOW_HAMMING. */ + SPECTRUMDATA, /* (Type:data) - [r] Returns the current spectrum values between 0 and 1 for each 'fft bin'. Cast data to FMOD_DSP_PARAMETER_DATA_TYPE_FFT. Divide the niquist rate by the window size to get the hz value per entry. */ + DOMINANT_FREQ /* (Type:float) - [r] Returns the dominant frequencies for each channel. */ + } + + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_ENVELOPEFOLLOWER unit. + This is a simple envelope follower for tracking the signal level.
    + + [REMARKS] + This unit does not affect the incoming signal +
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + DSP::setParameterBool + DSP::getParameterBool + FMOD_DSP_TYPE + ] + */ + public enum DSP_ENVELOPEFOLLOWER + { + ATTACK, /* (Type:float) - Attack time (milliseconds), in the range from 0.1 through 1000. The default value is 20. */ + RELEASE, /* (Type:float) - Release time (milliseconds), in the range from 10 through 5000. The default value is 100 */ + ENVELOPE, /* (Type:float) - Current value of the envelope, in the range 0 to 1. Read-only. */ + USESIDECHAIN /* (Type:bool) - Whether to analyse the sidechain signal instead of the input signal. The default value is false */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_CHORUS filter. + + [REMARKS] + Convolution Reverb reverb IR.
    + + [SEE_ALSO] + DSP::setParameterFloat + DSP::getParameterFloat + DSP::setParameterData + DSP::getParameterData + FMOD_DSP_TYPE + ] + */ + public enum DSP_CONVOLUTION_REVERB + { + IR, /* (Type:data) - [w] 16-bit reverb IR (short*) with an extra sample prepended to the start which specifies the number of channels. */ + WET, /* (Type:float) - [r/w] Volume of echo signal to pass to output in dB. -80.0 to 10.0. Default = 0. */ + DRY /* (Type:float) - [r/w] Original sound volume in dB. -80.0 to 10.0. Default = 0. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_CHANNELGAIN parameter for FMOD_DSP_TYPE_CHANNELMIX effect. + + [REMARKS] + + [SEE_ALSO] + DSP::setParameterInt + DSP::getParameterInt + FMOD_DSP_TYPE + ] + */ + public enum DSP_CHANNELMIX_OUTPUT + { + DEFAULT, /* Output channel count = input channel count. Mapping: See FMOD_SPEAKER enumeration. */ + ALLMONO, /* Output channel count = 1. Mapping: Mono, Mono, Mono, Mono, Mono, Mono, ... (each channel all the way up to FMOD_MAX_CHANNEL_WIDTH channels are treated as if they were mono) */ + ALLSTEREO, /* Output channel count = 2. Mapping: Left, Right, Left, Right, Left, Right, ... (each pair of channels is treated as stereo all the way up to FMOD_MAX_CHANNEL_WIDTH channels) */ + ALLQUAD, /* Output channel count = 4. Mapping: Repeating pattern of Front Left, Front Right, Surround Left, Surround Right. */ + ALL5POINT1, /* Output channel count = 6. Mapping: Repeating pattern of Front Left, Front Right, Center, LFE, Surround Left, Surround Right. */ + ALL7POINT1, /* Output channel count = 8. Mapping: Repeating pattern of Front Left, Front Right, Center, LFE, Surround Left, Surround Right, Back Left, Back Right. */ + ALLLFE /* Output channel count = 6. Mapping: Repeating pattern of LFE in a 5.1 output signal. */ + } + + /* + [ENUM] + [ + [DESCRIPTION] + Parameter types for the FMOD_DSP_TYPE_CHANNELMIX filter. + + [REMARKS] + For FMOD_DSP_CHANNELMIX_OUTPUTGROUPING, this value will set the output speaker format for the DSP, and also map the incoming channels to the + outgoing channels in a round-robin fashion. Use this for example play a 32 channel input signal as if it were a repeating group of output signals. + Ie. + FMOD_DSP_CHANNELGAIN_OUTPUT_ALLMONO = all incoming channels are mixed to a mono output. + FMOD_DSP_CHANNELGAIN_OUTPUT_ALLSTEREO = all incoming channels are mixed to a stereo output, ie even incoming channels 0,2,4,6,etc are mixed to left, and odd incoming channels 1,3,5,7,etc are mixed to right. + FMOD_DSP_CHANNELGAIN_OUTPUT_ALL5POINT1 = all incoming channels are mixed to a 5.1 output. If there are less than 6 coming in, it will just fill the first n channels in the 6 output channels. + If there are more, then it will repeat the input pattern to the output like it did with the stereo case, ie 12 incoming channels are mapped as 0-5 mixed to the + 5.1 output and 6 to 11 mapped to the 5.1 output. + FMOD_DSP_CHANNELGAIN_OUTPUT_ALLLFE = all incoming channels are mixed to a 5.1 output but via the LFE channel only. + + + [SEE_ALSO] + DSP::setParameterInt + DSP::getParameterInt + DSP::setParameterFloat + DSP::getParameterFloat + FMOD_DSP_TYPE + ] + */ + public enum DSP_CHANNELMIX + { + OUTPUTGROUPING, /* (Type:int) - Refer to FMOD_DSP_CHANNELMIX_OUTPUT enumeration. Default = FMOD_DSP_CHANNELGAIN_OUTPUT_DEFAULT. See remarks. */ + GAIN_CH0, /* (Type:float) - Channel #0 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH1, /* (Type:float) - Channel #1 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH2, /* (Type:float) - Channel #2 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH3, /* (Type:float) - Channel #3 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH4, /* (Type:float) - Channel #4 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH5, /* (Type:float) - Channel #5 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH6, /* (Type:float) - Channel #6 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH7, /* (Type:float) - Channel #7 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH8, /* (Type:float) - Channel #8 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH9, /* (Type:float) - Channel #9 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH10, /* (Type:float) - Channel #10 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH11, /* (Type:float) - Channel #11 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH12, /* (Type:float) - Channel #12 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH13, /* (Type:float) - Channel #13 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH14, /* (Type:float) - Channel #14 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH15, /* (Type:float) - Channel #15 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH16, /* (Type:float) - Channel #16 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH17, /* (Type:float) - Channel #17 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH18, /* (Type:float) - Channel #18 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH19, /* (Type:float) - Channel #19 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH20, /* (Type:float) - Channel #20 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH21, /* (Type:float) - Channel #21 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH22, /* (Type:float) - Channel #22 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH23, /* (Type:float) - Channel #23 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH24, /* (Type:float) - Channel #24 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH25, /* (Type:float) - Channel #25 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH26, /* (Type:float) - Channel #26 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH27, /* (Type:float) - Channel #27 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH28, /* (Type:float) - Channel #28 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH29, /* (Type:float) - Channel #29 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH30, /* (Type:float) - Channel #30 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH31 /* (Type:float) - Channel #31 gain in dB. -80.0 to 10.0. Default = 0. */ + } + + +/*$ preserve start $*/ +} +/*$ preserve end $*/ diff --git a/Unity Studio/FMOD Studio API/fmod_errors.cs b/Unity Studio/FMOD Studio API/fmod_errors.cs new file mode 100644 index 0000000..a0562e2 --- /dev/null +++ b/Unity Studio/FMOD Studio API/fmod_errors.cs @@ -0,0 +1,103 @@ +/* =================================================================================================== */ +/* FMOD Studio - Error string header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2015. */ +/* */ +/* Use this header if you want to store or display a string version / english explanation of */ +/* the FMOD error codes. */ +/* */ +/* =================================================================================================== */ + +namespace FMOD +{ + public class Error + { + public static string String(FMOD.RESULT errcode) + { + switch (errcode) + { + case FMOD.RESULT.OK: return "No errors."; + case FMOD.RESULT.ERR_BADCOMMAND: return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound)."; + case FMOD.RESULT.ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel."; + case FMOD.RESULT.ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound."; + case FMOD.RESULT.ERR_DMA: return "DMA Failure. See debug output for more information."; + case FMOD.RESULT.ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts."; + case FMOD.RESULT.ERR_DSP_DONTPROCESS: return "DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph."; + case FMOD.RESULT.ERR_DSP_FORMAT: return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map."; + case FMOD.RESULT.ERR_DSP_INUSE: return "DSP is already in the mixer's DSP network. It must be removed before being reinserted or released."; + case FMOD.RESULT.ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified."; + case FMOD.RESULT.ERR_DSP_RESERVED: return "DSP operation error. Cannot perform operation on this DSP as it is reserved by the system."; + case FMOD.RESULT.ERR_DSP_SILENCE: return "DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph."; + case FMOD.RESULT.ERR_DSP_TYPE: return "DSP operation cannot be performed on a DSP of this type."; + case FMOD.RESULT.ERR_FILE_BAD: return "Error loading file."; + case FMOD.RESULT.ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format."; + case FMOD.RESULT.ERR_FILE_DISKEJECTED: return "Media was ejected while reading."; + case FMOD.RESULT.ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated?)."; + case FMOD.RESULT.ERR_FILE_ENDOFDATA: return "End of current chunk reached while trying to read data."; + case FMOD.RESULT.ERR_FILE_NOTFOUND: return "File not found."; + case FMOD.RESULT.ERR_FORMAT: return "Unsupported file or audio format."; + case FMOD.RESULT.ERR_HEADER_MISMATCH: return "There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library."; + case FMOD.RESULT.ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere."; + case FMOD.RESULT.ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden."; + case FMOD.RESULT.ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource."; + case FMOD.RESULT.ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred."; + case FMOD.RESULT.ERR_HTTP_TIMEOUT: return "The HTTP request timed out."; + case FMOD.RESULT.ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function."; + case FMOD.RESULT.ERR_INITIALIZED: return "Cannot call this command after System::init."; + case FMOD.RESULT.ERR_INTERNAL: return "An error occurred that wasn't supposed to. Contact support."; + case FMOD.RESULT.ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float."; + case FMOD.RESULT.ERR_INVALID_HANDLE: return "An invalid object handle was used."; + case FMOD.RESULT.ERR_INVALID_PARAM: return "An invalid parameter was passed to this function."; + case FMOD.RESULT.ERR_INVALID_POSITION: return "An invalid seek position was passed to this function."; + case FMOD.RESULT.ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode."; + case FMOD.RESULT.ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle."; + case FMOD.RESULT.ERR_INVALID_THREAD: return "Tried to call a function on a thread that is not supported."; + case FMOD.RESULT.ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular."; + case FMOD.RESULT.ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup."; + case FMOD.RESULT.ERR_MEMORY: return "Not enough memory or resources."; + case FMOD.RESULT.ERR_MEMORY_CANTPOINT: return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used."; + case FMOD.RESULT.ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound."; + case FMOD.RESULT.ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support."; + case FMOD.RESULT.ERR_NET_CONNECT: return "Couldn't connect to the specified host."; + case FMOD.RESULT.ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere."; + case FMOD.RESULT.ERR_NET_URL: return "The specified URL couldn't be resolved."; + case FMOD.RESULT.ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately."; + case FMOD.RESULT.ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready."; + case FMOD.RESULT.ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused."; + case FMOD.RESULT.ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer."; + case FMOD.RESULT.ERR_OUTPUT_DRIVERCALL: return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted."; + case FMOD.RESULT.ERR_OUTPUT_FORMAT: return "Soundcard does not support the specified format."; + case FMOD.RESULT.ERR_OUTPUT_INIT: return "Error initializing output device."; + case FMOD.RESULT.ERR_OUTPUT_NODRIVERS: return "The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails."; + case FMOD.RESULT.ERR_PLUGIN: return "An unspecified error has been returned from a plugin."; + case FMOD.RESULT.ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available."; + case FMOD.RESULT.ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback)"; + case FMOD.RESULT.ERR_PLUGIN_VERSION: return "A plugin was built with an unsupported SDK version."; + case FMOD.RESULT.ERR_RECORD: return "An error occurred trying to initialize the recording device."; + case FMOD.RESULT.ERR_REVERB_CHANNELGROUP: return "Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection."; + case FMOD.RESULT.ERR_REVERB_INSTANCE: return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist."; + case FMOD.RESULT.ERR_SUBSOUNDS: return "The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound."; + case FMOD.RESULT.ERR_SUBSOUND_ALLOCATED: return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first."; + case FMOD.RESULT.ERR_SUBSOUND_CANTMOVE: return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file."; + case FMOD.RESULT.ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags."; + case FMOD.RESULT.ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat."; + case FMOD.RESULT.ERR_TRUNCATED: return "The retrieved string is too long to fit in the supplied buffer and has been truncated."; + case FMOD.RESULT.ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be! contact support!"; + case FMOD.RESULT.ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called."; + case FMOD.RESULT.ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified."; + case FMOD.RESULT.ERR_VERSION: return "The version number of this file format is not supported."; + case FMOD.RESULT.ERR_EVENT_ALREADY_LOADED: return "The specified bank has already been loaded."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_BUSY: return "The live update connection failed due to the game already being connected."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_MISMATCH: return "The live update connection failed due to the game data being out of sync with the tool."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_TIMEOUT: return "The live update connection timed out."; + case FMOD.RESULT.ERR_EVENT_NOTFOUND: return "The requested event, bus or vca could not be found."; + case FMOD.RESULT.ERR_STUDIO_UNINITIALIZED: return "The Studio::System object is not yet initialized."; + case FMOD.RESULT.ERR_STUDIO_NOT_LOADED: return "The specified resource is not loaded, so it can't be unloaded."; + case FMOD.RESULT.ERR_INVALID_STRING: return "An invalid string was passed to this function."; + case FMOD.RESULT.ERR_ALREADY_LOCKED: return "The specified resource is already locked."; + case FMOD.RESULT.ERR_NOT_LOCKED: return "The specified resource is not locked, so it can't be unlocked."; + case FMOD.RESULT.ERR_RECORD_DISCONNECTED: return "The specified recording driver has been disconnected."; + case FMOD.RESULT.ERR_TOOMANYSAMPLES: return "The length provided exceed the allowable limit."; + default: return "Unknown error."; + } + } + } +} diff --git a/Unity Studio/Unity Studio.csproj b/Unity Studio/Unity Studio.csproj index a250a5d..028e0f0 100644 --- a/Unity Studio/Unity Studio.csproj +++ b/Unity Studio/Unity Studio.csproj @@ -139,6 +139,9 @@ FBXExport.cs + + + Component @@ -146,10 +149,6 @@ - - - - @@ -160,15 +159,15 @@ + + + Form UnityStudioForm.cs - - - AboutBox.cs Designer @@ -176,10 +175,6 @@ FBXExport.cs - - UnityStudioForm.cs - Designer - ResXFileCodeGenerator Resources.Designer.cs @@ -190,6 +185,10 @@ Resources.resx True + + UnityStudioForm.cs + Designer + SettingsSingleFileGenerator @@ -222,6 +221,7 @@ +