Skip to content

Commit

Permalink
Update to FMOD 2.01
Browse files Browse the repository at this point in the history
  • Loading branch information
dapetcu21 committed Apr 23, 2020
1 parent 1d3789a commit 7205b00
Show file tree
Hide file tree
Showing 41 changed files with 420 additions and 61 deletions.
9 changes: 7 additions & 2 deletions bridge/fmod_generated_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,13 @@ static int _FMODBridge_func_FMOD_Studio_System_SetListenerAttributes(lua_State *
FMOD_STUDIO_SYSTEM* system = FMODBridge_check_ptr_FMOD_STUDIO_SYSTEM(L, 1);
int index = FMODBridge_check_int(L, 2);
FMOD_3D_ATTRIBUTES* attributes = FMODBridge_check_ptr_FMOD_3D_ATTRIBUTES(L, 3);
ensure(ST, FMOD_Studio_System_SetListenerAttributes, FMOD_RESULT, FMOD_STUDIO_SYSTEM*, int, FMOD_3D_ATTRIBUTES*);
errCheck(FMOD_Studio_System_SetListenerAttributes(system, index, attributes));
FMOD_VECTOR attenuationposition;
int hasAttenuationPosition = !lua_isnoneornil(L, 4);
if (hasAttenuationPosition) {
attenuationposition = FMODBridge_check_FMOD_VECTOR(L, 4);
}
ensure(ST, FMOD_Studio_System_SetListenerAttributes, FMOD_RESULT, FMOD_STUDIO_SYSTEM*, int, const FMOD_3D_ATTRIBUTES*, const FMOD_VECTOR*);
errCheck(FMOD_Studio_System_SetListenerAttributes(system, index, attributes, hasAttenuationPosition ? &attenuationposition : NULL));
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion bridge/include/fmod.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ======================================================================================== */
/* FMOD Core API - C header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header in conjunction with fmod_common.h (which contains all the constants / */
/* callbacks) to develop using the C interface */
Expand All @@ -27,6 +27,7 @@ FMOD_RESULT F_API FMOD_Memory_GetStats (int *currentalloced, int *ma
FMOD_RESULT F_API FMOD_Debug_Initialize (FMOD_DEBUG_FLAGS flags, FMOD_DEBUG_MODE mode, FMOD_DEBUG_CALLBACK callback, const char *filename);
FMOD_RESULT F_API FMOD_File_SetDiskBusy (int busy);
FMOD_RESULT F_API FMOD_File_GetDiskBusy (int *busy);
FMOD_RESULT F_API FMOD_Thread_SetAttributes (FMOD_THREAD_TYPE type, FMOD_THREAD_AFFINITY affinity, FMOD_THREAD_PRIORITY priority, FMOD_THREAD_STACK_SIZE stacksize);

/*
FMOD System factory functions. Use this to create an FMOD System Instance. below you will see FMOD_System_Init/Close to get started.
Expand Down
3 changes: 2 additions & 1 deletion bridge/include/fmod.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ======================================================================================== */
/* FMOD Core API - C++ header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header in conjunction with fmod_common.h (which contains all the constants / */
/* callbacks) to develop using the C++ language. */
Expand Down Expand Up @@ -38,6 +38,7 @@ namespace FMOD
inline FMOD_RESULT Debug_Initialize (FMOD_DEBUG_FLAGS flags, FMOD_DEBUG_MODE mode = FMOD_DEBUG_MODE_TTY, FMOD_DEBUG_CALLBACK callback = 0, const char *filename = 0) { return FMOD_Debug_Initialize(flags, mode, callback, filename); }
inline FMOD_RESULT File_SetDiskBusy (int busy) { return FMOD_File_SetDiskBusy(busy); }
inline FMOD_RESULT File_GetDiskBusy (int *busy) { return FMOD_File_GetDiskBusy(busy); }
inline FMOD_RESULT Thread_SetAttributes (FMOD_THREAD_TYPE type, FMOD_THREAD_AFFINITY affinity = FMOD_THREAD_AFFINITY_GROUP_DEFAULT, FMOD_THREAD_PRIORITY priority = FMOD_THREAD_PRIORITY_DEFAULT, FMOD_THREAD_STACK_SIZE stacksize = FMOD_THREAD_STACK_SIZE_DEFAULT) { return FMOD_Thread_SetAttributes(type, affinity, priority, stacksize); }

/*
FMOD System factory functions.
Expand Down
2 changes: 1 addition & 1 deletion bridge/include/fmod_codec.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ======================================================================================== */
/* FMOD Core API - Codec development header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header if you are wanting to develop your own file format plugin to use with */
/* FMOD's codec system. With this header you can make your own fileformat plugin that FMOD */
Expand Down
115 changes: 103 additions & 12 deletions bridge/include/fmod_common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ======================================================================================== */
/* FMOD Core API - Common C/C++ header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* This header is included by fmod.hpp (C++ interface) and fmod.h (C interface) */
/* */
Expand All @@ -15,15 +15,13 @@
*/
#if defined(_WIN32) || defined(__CYGWIN__)
#define F_CALL __stdcall
#elif defined(__ANDROID__) && defined(__arm__) && !defined(__LP64__) && !defined(__clang__)
#define F_CALL __attribute__((pcs("aapcs")))
#else
#define F_CALL
#endif

#if defined(_WIN32) || defined(__CYGWIN__) || defined(__ORBIS__)
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__ORBIS__) || defined(F_USE_DECLSPEC)
#define F_EXPORT __declspec(dllexport)
#elif defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__)
#elif defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__) || defined(F_USE_ATTRIBUTE)
#define F_EXPORT __attribute__((visibility("default")))
#else
#define F_EXPORT
Expand Down Expand Up @@ -60,7 +58,7 @@ typedef unsigned long long FMOD_PORT_INDEX;
/*
FMOD constants
*/
#define FMOD_VERSION 0x00020001 /* 0xaaaabbcc -> aaaa = product version, bb = major version, cc = minor version.*/
#define FMOD_VERSION 0x00020100 /* 0xaaaabbcc -> aaaa = product version, bb = major version, cc = minor version.*/

typedef unsigned int FMOD_DEBUG_FLAGS;
#define FMOD_DEBUG_LEVEL_NONE 0x00000000
Expand Down Expand Up @@ -98,6 +96,7 @@ typedef unsigned int FMOD_INITFLAGS;
#define FMOD_INIT_PREFER_DOLBY_DOWNMIX 0x00080000
#define FMOD_INIT_THREAD_UNSAFE 0x00100000
#define FMOD_INIT_PROFILE_METER_ALL 0x00200000
#define FMOD_INIT_MEMORY_TRACKING 0x00400000

typedef unsigned int FMOD_DRIVER_STATE;
#define FMOD_DRIVER_STATE_CONNECTED 0x00000001
Expand Down Expand Up @@ -170,7 +169,6 @@ typedef unsigned int FMOD_CHANNELMASK;
#define FMOD_CHANNELMASK_BACK_LEFT 0x00000040
#define FMOD_CHANNELMASK_BACK_RIGHT 0x00000080
#define FMOD_CHANNELMASK_BACK_CENTER 0x00000100

#define FMOD_CHANNELMASK_MONO (FMOD_CHANNELMASK_FRONT_LEFT)
#define FMOD_CHANNELMASK_STEREO (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT)
#define FMOD_CHANNELMASK_LRC (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER)
Expand All @@ -181,6 +179,82 @@ typedef unsigned int FMOD_CHANNELMASK;
#define FMOD_CHANNELMASK_7POINT0 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT)
#define FMOD_CHANNELMASK_7POINT1 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_LOW_FREQUENCY | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT)

typedef int FMOD_THREAD_PRIORITY;
/* Platform specific priority range */
#define FMOD_THREAD_PRIORITY_PLATFORM_MIN (-32 * 1024)
#define FMOD_THREAD_PRIORITY_PLATFORM_MAX ( 32 * 1024)
/* Platform agnostic priorities, maps internally to platform specific value */
#define FMOD_THREAD_PRIORITY_DEFAULT (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 1)
#define FMOD_THREAD_PRIORITY_LOW (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 2)
#define FMOD_THREAD_PRIORITY_MEDIUM (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 3)
#define FMOD_THREAD_PRIORITY_HIGH (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 4)
#define FMOD_THREAD_PRIORITY_VERY_HIGH (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 5)
#define FMOD_THREAD_PRIORITY_EXTREME (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 6)
#define FMOD_THREAD_PRIORITY_CRITICAL (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 7)
/* Thread defaults */
#define FMOD_THREAD_PRIORITY_MIXER FMOD_THREAD_PRIORITY_EXTREME
#define FMOD_THREAD_PRIORITY_FEEDER FMOD_THREAD_PRIORITY_CRITICAL
#define FMOD_THREAD_PRIORITY_STREAM FMOD_THREAD_PRIORITY_VERY_HIGH
#define FMOD_THREAD_PRIORITY_FILE FMOD_THREAD_PRIORITY_HIGH
#define FMOD_THREAD_PRIORITY_NONBLOCKING FMOD_THREAD_PRIORITY_HIGH
#define FMOD_THREAD_PRIORITY_RECORD FMOD_THREAD_PRIORITY_HIGH
#define FMOD_THREAD_PRIORITY_GEOMETRY FMOD_THREAD_PRIORITY_LOW
#define FMOD_THREAD_PRIORITY_PROFILER FMOD_THREAD_PRIORITY_MEDIUM
#define FMOD_THREAD_PRIORITY_STUDIO_UPDATE FMOD_THREAD_PRIORITY_MEDIUM
#define FMOD_THREAD_PRIORITY_STUDIO_LOAD_BANK FMOD_THREAD_PRIORITY_MEDIUM
#define FMOD_THREAD_PRIORITY_STUDIO_LOAD_SAMPLE FMOD_THREAD_PRIORITY_MEDIUM

typedef unsigned int FMOD_THREAD_STACK_SIZE;
#define FMOD_THREAD_STACK_SIZE_DEFAULT 0
#define FMOD_THREAD_STACK_SIZE_MIXER (80 * 1024)
#define FMOD_THREAD_STACK_SIZE_FEEDER (16 * 1024)
#define FMOD_THREAD_STACK_SIZE_STREAM (96 * 1024)
#define FMOD_THREAD_STACK_SIZE_FILE (48 * 1024)
#define FMOD_THREAD_STACK_SIZE_NONBLOCKING (112 * 1024)
#define FMOD_THREAD_STACK_SIZE_RECORD (16 * 1024)
#define FMOD_THREAD_STACK_SIZE_GEOMETRY (48 * 1024)
#define FMOD_THREAD_STACK_SIZE_PROFILER (128 * 1024)
#define FMOD_THREAD_STACK_SIZE_STUDIO_UPDATE (96 * 1024)
#define FMOD_THREAD_STACK_SIZE_STUDIO_LOAD_BANK (96 * 1024)
#define FMOD_THREAD_STACK_SIZE_STUDIO_LOAD_SAMPLE (96 * 1024)

typedef unsigned long long FMOD_THREAD_AFFINITY;
/* Platform agnostic thread groupings */
#define FMOD_THREAD_AFFINITY_GROUP_DEFAULT 0x8000000000000000
#define FMOD_THREAD_AFFINITY_GROUP_A 0x8000000000000001
#define FMOD_THREAD_AFFINITY_GROUP_B 0x8000000000000002
#define FMOD_THREAD_AFFINITY_GROUP_C 0x8000000000000003
/* Thread defaults */
#define FMOD_THREAD_AFFINITY_MIXER FMOD_THREAD_AFFINITY_GROUP_A
#define FMOD_THREAD_AFFINITY_FEEDER FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_STREAM FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_FILE FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_NONBLOCKING FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_RECORD FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_GEOMETRY FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_PROFILER FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_STUDIO_UPDATE FMOD_THREAD_AFFINITY_GROUP_B
#define FMOD_THREAD_AFFINITY_STUDIO_LOAD_BANK FMOD_THREAD_AFFINITY_GROUP_C
#define FMOD_THREAD_AFFINITY_STUDIO_LOAD_SAMPLE FMOD_THREAD_AFFINITY_GROUP_C
/* Core mask, valid up to 1 << 62 */
#define FMOD_THREAD_AFFINITY_CORE_ALL 0
#define FMOD_THREAD_AFFINITY_CORE_0 (1 << 0)
#define FMOD_THREAD_AFFINITY_CORE_1 (1 << 1)
#define FMOD_THREAD_AFFINITY_CORE_2 (1 << 2)
#define FMOD_THREAD_AFFINITY_CORE_3 (1 << 3)
#define FMOD_THREAD_AFFINITY_CORE_4 (1 << 4)
#define FMOD_THREAD_AFFINITY_CORE_5 (1 << 5)
#define FMOD_THREAD_AFFINITY_CORE_6 (1 << 6)
#define FMOD_THREAD_AFFINITY_CORE_7 (1 << 7)
#define FMOD_THREAD_AFFINITY_CORE_8 (1 << 8)
#define FMOD_THREAD_AFFINITY_CORE_9 (1 << 9)
#define FMOD_THREAD_AFFINITY_CORE_10 (1 << 10)
#define FMOD_THREAD_AFFINITY_CORE_11 (1 << 11)
#define FMOD_THREAD_AFFINITY_CORE_12 (1 << 12)
#define FMOD_THREAD_AFFINITY_CORE_13 (1 << 13)
#define FMOD_THREAD_AFFINITY_CORE_14 (1 << 14)
#define FMOD_THREAD_AFFINITY_CORE_15 (1 << 15)

/* Preset for FMOD_REVERB_PROPERTIES */
#define FMOD_PRESET_OFF { 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f }
#define FMOD_PRESET_GENERIC { 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f }
Expand Down Expand Up @@ -213,6 +287,24 @@ typedef unsigned int FMOD_CHANNELMASK;
#define FMOD_REVERB_MAXINSTANCES 4
#define FMOD_PORT_INDEX_NONE 0xFFFFFFFFFFFFFFFF

typedef enum FMOD_THREAD_TYPE
{
FMOD_THREAD_TYPE_MIXER,
FMOD_THREAD_TYPE_FEEDER,
FMOD_THREAD_TYPE_STREAM,
FMOD_THREAD_TYPE_FILE,
FMOD_THREAD_TYPE_NONBLOCKING,
FMOD_THREAD_TYPE_RECORD,
FMOD_THREAD_TYPE_GEOMETRY,
FMOD_THREAD_TYPE_PROFILER,
FMOD_THREAD_TYPE_STUDIO_UPDATE,
FMOD_THREAD_TYPE_STUDIO_LOAD_BANK,
FMOD_THREAD_TYPE_STUDIO_LOAD_SAMPLE,

FMOD_THREAD_TYPE_MAX,
FMOD_THREAD_TYPE_FORCEINT = 65536
} FMOD_THREAD_TYPE;

typedef enum FMOD_RESULT
{
FMOD_OK,
Expand Down Expand Up @@ -330,6 +422,7 @@ typedef enum FMOD_OUTPUTTYPE
FMOD_OUTPUTTYPE_WEBAUDIO,
FMOD_OUTPUTTYPE_NNAUDIO,
FMOD_OUTPUTTYPE_WINSONIC,
FMOD_OUTPUTTYPE_AAUDIO,

FMOD_OUTPUTTYPE_MAX,
FMOD_OUTPUTTYPE_FORCEINT = 65536
Expand Down Expand Up @@ -362,7 +455,8 @@ typedef enum FMOD_SPEAKERMODE

typedef enum FMOD_SPEAKER
{
FMOD_SPEAKER_FRONT_LEFT,
FMOD_SPEAKER_NONE = -1,
FMOD_SPEAKER_FRONT_LEFT = 0,
FMOD_SPEAKER_FRONT_RIGHT,
FMOD_SPEAKER_FRONT_CENTER,
FMOD_SPEAKER_LOW_FREQUENCY,
Expand Down Expand Up @@ -428,6 +522,7 @@ typedef enum FMOD_SOUND_TYPE
FMOD_SOUND_TYPE_MEDIA_FOUNDATION,
FMOD_SOUND_TYPE_MEDIACODEC,
FMOD_SOUND_TYPE_FADPCM,
FMOD_SOUND_TYPE_OPUS,

FMOD_SOUND_TYPE_MAX,
FMOD_SOUND_TYPE_FORCEINT = 65536
Expand Down Expand Up @@ -657,11 +752,7 @@ typedef struct FMOD_ADVANCEDSETTINGS
float distanceFilterCenterFreq;
int reverb3Dinstance;
int DSPBufferPoolSize;
unsigned int stackSizeStream;
unsigned int stackSizeNonBlocking;
unsigned int stackSizeMixer;
FMOD_DSP_RESAMPLER resamplerMethod;
unsigned int commandQueueSize;
unsigned int randomSeed;
} FMOD_ADVANCEDSETTINGS;

Expand Down
10 changes: 5 additions & 5 deletions bridge/include/fmod_dsp.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ======================================================================================== */
/* FMOD Core API - DSP header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */
/* dsp system. With this header you can make your own DSP plugin that FMOD can */
Expand Down Expand Up @@ -115,20 +115,20 @@ typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC) (FMOD_
/*
DSP Structures
*/
typedef struct FMOD_DSP_BUFFER_ARRAY
struct FMOD_DSP_BUFFER_ARRAY
{
int numbuffers;
int *buffernumchannels;
FMOD_CHANNELMASK *bufferchannelmask;
float **buffers;
FMOD_SPEAKERMODE speakermode;
} FMOD_DSP_BUFFER_ARRAY;
};

typedef struct FMOD_COMPLEX
struct FMOD_COMPLEX
{
float real;
float imag;
} FMOD_COMPLEX;
};

typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR
{
Expand Down
2 changes: 1 addition & 1 deletion bridge/include/fmod_dsp_effects.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ============================================================================================================= */
/* FMOD Core API - Built-in effects header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* In this header you can find parameter structures for FMOD system registered DSP effects */
/* and generators. */
Expand Down
2 changes: 1 addition & 1 deletion bridge/include/fmod_errors.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ============================================================================================== */
/* FMOD Core / Studio API - Error string header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header if you want to store or display a string version / english explanation */
/* of the FMOD error codes. */
Expand Down
9 changes: 7 additions & 2 deletions bridge/include/fmod_output.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ======================================================================================== */
/* FMOD Core API - output development header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header if you are wanting to develop your own output plugin to use with */
/* FMOD's output system. With this header you can make your own output plugin that FMOD */
Expand All @@ -21,6 +21,11 @@ typedef struct FMOD_OUTPUT_OBJECT3DINFO FMOD_OUTPUT_OBJECT3DINFO;
*/
#define FMOD_OUTPUT_PLUGIN_VERSION 4

typedef unsigned int FMOD_OUTPUT_METHOD;
#define FMOD_OUTPUT_METHOD_MIX_DIRECT 0
#define FMOD_OUTPUT_METHOD_POLLING 1
#define FMOD_OUTPUT_METHOD_MIX_BUFFERED 2

/*
Output callbacks
*/
Expand Down Expand Up @@ -62,7 +67,7 @@ typedef struct FMOD_OUTPUT_DESCRIPTION
unsigned int apiversion;
const char *name;
unsigned int version;
int polling;
FMOD_OUTPUT_METHOD method;
FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK getnumdrivers;
FMOD_OUTPUT_GETDRIVERINFO_CALLBACK getdriverinfo;
FMOD_OUTPUT_INIT_CALLBACK init;
Expand Down
Loading

0 comments on commit 7205b00

Please sign in to comment.