Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Release
/stub/res/x86-win32/fmod*.dll
/stub/lib/ios/libfmod*.a
/stub/lib/js-web/libfmod*.a
/.editor_settings
4 changes: 2 additions & 2 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Alternatively, if you don't want to install Python on your system, you can run
it through Docker:

```
docker-compose -f bridge/docker-compose.generate_bindings.yml up
docker compose -f bridge/docker compose.generate_bindings.yml up
```

The bridge library comes with compilation scripts for each platform:
Expand Down Expand Up @@ -57,7 +57,7 @@ You can build all of these in one go with Docker:

```bash
cd bridge
docker-compose up
docker compose up
```

Or use the respective Makefiles to build manually. Make sure to match
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
![fmod](./docs/fmod_logo.png)

# Pending tasks:

- [ ] Add macro preprocessing to the bridge `gcc -E -std=c99` as pycparser uses c99
- [ ] Add android clang

# FMOD extension for Defold

> [FMOD] sound engine bindings for Defold
Expand Down
3 changes: 2 additions & 1 deletion bridge/Makefile.android
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ HEADERS = \
JAVA_FILES = \
src/me/petcu/fmodbridge/BridgeHelper.java

ANDROID_NDK ?= $(HOME)/Tools/android-ndk-r17c
# ANDROID_NDK ?= $(HOME)/Tools/android-ndk-r17c
ANDROID_NDK ?= /opt/android-ndk-r27c
HOST_TAG ?= `uname | tr A-Z a-z`-x86_64

CC_ARM := $(ANDROID_NDK)/toolchains/llvm/prebuilt/$(HOST_TAG)/bin/clang -target armv7a-linux-androideabi14 --sysroot=$(ANDROID_NDK)/sysroot -I$(ANDROID_NDK)/sysroot/usr/include/arm-linux-androideabi
Expand Down
2 changes: 1 addition & 1 deletion bridge/Makefile.emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ HEADERS = src/fmod_bridge.h
CC := emcc
AR := emar

CFLAGS := -O3 -fvisibility=hidden -I./include
CFLAGS := -O3 -fvisibility=hidden -I./include -s USE_PTHREADS=0 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_RUNTIME_METHODS='["ccall","cwrap","addFunction","removeFunction"]' -s EXPORTED_FUNCTIONS='["_main","_malloc","_free","_FMODBridge_unmuteAfterUserInteraction"]' -s INITIAL_MEMORY=16MB

all: $(LIBPATH)

Expand Down
2 changes: 1 addition & 1 deletion bridge/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ services:
build_android:
build: docker/build_android
volumes:
- "..:/repo"
- "..:/repo"
2 changes: 1 addition & 1 deletion bridge/docker/build_android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ RUN apt-get update && apt-get install make -y
VOLUME [ "/repo" ]
WORKDIR /repo/bridge

ENTRYPOINT [ "make", "-f", "Makefile.android" ]
ENTRYPOINT [ "make", "-f", "Makefile.android" ]
4 changes: 2 additions & 2 deletions bridge/docker/build_linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM debian:8
FROM debian:11

RUN apt-get update && apt-get install build-essential -y

VOLUME [ "/repo" ]
WORKDIR /repo/bridge

ENTRYPOINT [ "make", "-f", "Makefile.linux" ]
ENTRYPOINT [ "make", "-f", "Makefile.linux" ]
4 changes: 2 additions & 2 deletions bridge/docker/build_web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM emscripten/emsdk:1.39.17-upstream
FROM emscripten/emsdk:3.1.67-upstream

VOLUME [ "/repo" ]
WORKDIR /repo/bridge

ENTRYPOINT [ "make", "-f", "Makefile.emscripten" ]
ENTRYPOINT [ "make", "-f", "Makefile.emscripten" ]
8 changes: 5 additions & 3 deletions bridge/include/fmod.h
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* ======================================================================================== */
/* FMOD Core API - C header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2021. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2025. */
/* */
/* Use this header in conjunction with fmod_common.h (which contains all the constants / */
/* callbacks) to develop using the C interface */
/* */
/* For more detail visit: */
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */
/* https://fmod.com/docs/2.03/api/core-api.html */
/* ======================================================================================== */

#ifndef _FMOD_H
Expand Down Expand Up @@ -98,7 +98,7 @@ FMOD_RESULT F_API FMOD_System_GetDefaultMixMatrix (FMOD_SYSTEM *system, FM
FMOD_RESULT F_API FMOD_System_GetSpeakerModeChannels (FMOD_SYSTEM *system, FMOD_SPEAKERMODE mode, int *channels);

/* System information functions. */
FMOD_RESULT F_API FMOD_System_GetVersion (FMOD_SYSTEM *system, unsigned int *version);
FMOD_RESULT F_API FMOD_System_GetVersion (FMOD_SYSTEM *system, unsigned int *version, unsigned int *buildnumber);
FMOD_RESULT F_API FMOD_System_GetOutputHandle (FMOD_SYSTEM *system, void **handle);
FMOD_RESULT F_API FMOD_System_GetChannelsPlaying (FMOD_SYSTEM *system, int *channels, int *realchannels);
FMOD_RESULT F_API FMOD_System_GetCPUUsage (FMOD_SYSTEM *system, FMOD_CPU_USAGE *usage);
Expand All @@ -109,6 +109,7 @@ FMOD_RESULT F_API FMOD_System_CreateSound (FMOD_SYSTEM *system, co
FMOD_RESULT F_API FMOD_System_CreateStream (FMOD_SYSTEM *system, const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, FMOD_SOUND **sound);
FMOD_RESULT F_API FMOD_System_CreateDSP (FMOD_SYSTEM *system, const FMOD_DSP_DESCRIPTION *description, FMOD_DSP **dsp);
FMOD_RESULT F_API FMOD_System_CreateDSPByType (FMOD_SYSTEM *system, FMOD_DSP_TYPE type, FMOD_DSP **dsp);
FMOD_RESULT F_API FMOD_System_CreateDSPConnection (FMOD_SYSTEM *system, FMOD_DSPCONNECTION_TYPE type, FMOD_DSPCONNECTION **connection);
FMOD_RESULT F_API FMOD_System_CreateChannelGroup (FMOD_SYSTEM *system, const char *name, FMOD_CHANNELGROUP **channelgroup);
FMOD_RESULT F_API FMOD_System_CreateSoundGroup (FMOD_SYSTEM *system, const char *name, FMOD_SOUNDGROUP **soundgroup);
FMOD_RESULT F_API FMOD_System_CreateReverb3D (FMOD_SYSTEM *system, FMOD_REVERB3D **reverb);
Expand Down Expand Up @@ -535,6 +536,7 @@ FMOD_RESULT F_API FMOD_DSP_SetChannelFormat (FMOD_DSP *dsp, FMOD_CHA
FMOD_RESULT F_API FMOD_DSP_GetChannelFormat (FMOD_DSP *dsp, FMOD_CHANNELMASK *channelmask, int *numchannels, FMOD_SPEAKERMODE *source_speakermode);
FMOD_RESULT F_API FMOD_DSP_GetOutputChannelFormat (FMOD_DSP *dsp, FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE inspeakermode, FMOD_CHANNELMASK *outmask, int *outchannels, FMOD_SPEAKERMODE *outspeakermode);
FMOD_RESULT F_API FMOD_DSP_Reset (FMOD_DSP *dsp);
FMOD_RESULT F_API FMOD_DSP_SetCallback (FMOD_DSP *dsp, FMOD_DSP_CALLBACK callback);

/*
DSP parameter control.
Expand Down
8 changes: 5 additions & 3 deletions bridge/include/fmod.hpp
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* ======================================================================================== */
/* FMOD Core API - C++ header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2021. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2025. */
/* */
/* Use this header in conjunction with fmod_common.h (which contains all the constants / */
/* callbacks) to develop using the C++ language. */
/* */
/* For more detail visit: */
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */
/* https://fmod.com/docs/2.03/api/core-api.html */
/* ======================================================================================== */
#ifndef _FMOD_HPP
#define _FMOD_HPP
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace FMOD
FMOD_RESULT F_API getSpeakerModeChannels (FMOD_SPEAKERMODE mode, int *channels);

// System information functions.
FMOD_RESULT F_API getVersion (unsigned int *version);
FMOD_RESULT F_API getVersion (unsigned int *version, unsigned int *buildnumber = 0);
FMOD_RESULT F_API getOutputHandle (void **handle);
FMOD_RESULT F_API getChannelsPlaying (int *channels, int *realchannels = 0);
FMOD_RESULT F_API getCPUUsage (FMOD_CPU_USAGE *usage);
Expand All @@ -131,6 +131,7 @@ namespace FMOD
FMOD_RESULT F_API createStream (const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, Sound **sound);
FMOD_RESULT F_API createDSP (const FMOD_DSP_DESCRIPTION *description, DSP **dsp);
FMOD_RESULT F_API createDSPByType (FMOD_DSP_TYPE type, DSP **dsp);
FMOD_RESULT F_API createDSPConnection (FMOD_DSPCONNECTION_TYPE type, DSPConnection **connection);
FMOD_RESULT F_API createChannelGroup (const char *name, ChannelGroup **channelgroup);
FMOD_RESULT F_API createSoundGroup (const char *name, SoundGroup **soundgroup);
FMOD_RESULT F_API createReverb3D (Reverb3D **reverb);
Expand Down Expand Up @@ -473,6 +474,7 @@ namespace FMOD
FMOD_RESULT F_API getChannelFormat (FMOD_CHANNELMASK *channelmask, int *numchannels, FMOD_SPEAKERMODE *source_speakermode);
FMOD_RESULT F_API getOutputChannelFormat (FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE inspeakermode, FMOD_CHANNELMASK *outmask, int *outchannels, FMOD_SPEAKERMODE *outspeakermode);
FMOD_RESULT F_API reset ();
FMOD_RESULT F_API setCallback (FMOD_DSP_CALLBACK callback);

// DSP parameter control.
FMOD_RESULT F_API setParameterFloat (int index, float value);
Expand Down
40 changes: 20 additions & 20 deletions bridge/include/fmod_codec.h
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* ======================================================================================== */
/* FMOD Core API - Codec development header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2021. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2025. */
/* */
/* 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 */
/* can register and use. See the documentation and examples on how to make a working */
/* plugin. */
/* */
/* For more detail visit: */
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */
/* https://fmod.com/docs/2.03/api/core-api.html */
/* ======================================================================================== */
#ifndef _FMOD_CODEC_H
#define _FMOD_CODEC_H
Expand All @@ -32,27 +32,27 @@ typedef int FMOD_CODEC_SEEK_METHOD;
/*
Codec callbacks
*/
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_OPEN_CALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_MODE usermode, FMOD_CREATESOUNDEXINFO *userexinfo);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_CLOSE_CALLBACK) (FMOD_CODEC_STATE *codec_state);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_READ_CALLBACK) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int samples_in, unsigned int *samples_out);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETLENGTH_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *length, FMOD_TIMEUNIT lengthtype);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, unsigned int position, FMOD_TIMEUNIT postype);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *position, FMOD_TIMEUNIT postype);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SOUNDCREATE_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, FMOD_SOUND *sound);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETWAVEFORMAT_CALLBACK)(FMOD_CODEC_STATE *codec_state, int index, FMOD_CODEC_WAVEFORMAT *waveformat);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_OPEN_CALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_MODE usermode, FMOD_CREATESOUNDEXINFO *userexinfo);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_CLOSE_CALLBACK) (FMOD_CODEC_STATE *codec_state);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_READ_CALLBACK) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int samples_in, unsigned int *samples_out);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_GETLENGTH_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *length, FMOD_TIMEUNIT lengthtype);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_SETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, unsigned int position, FMOD_TIMEUNIT postype);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_GETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *position, FMOD_TIMEUNIT postype);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_SOUNDCREATE_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, FMOD_SOUND *sound);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_GETWAVEFORMAT_CALLBACK)(FMOD_CODEC_STATE *codec_state, int index, FMOD_CODEC_WAVEFORMAT *waveformat);

/*
Codec functions
*/
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_METADATA_FUNC) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique);
typedef void * (F_CALLBACK *FMOD_CODEC_ALLOC_FUNC) (unsigned int size, unsigned int align, const char *file, int line);
typedef void (F_CALLBACK *FMOD_CODEC_FREE_FUNC) (void *ptr, const char *file, int line);
typedef void (F_CALLBACK *FMOD_CODEC_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string, ...);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_METADATA_FUNC) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique);
typedef void * (F_CALL *FMOD_CODEC_ALLOC_FUNC) (unsigned int size, unsigned int align, const char *file, int line);
typedef void (F_CALL *FMOD_CODEC_FREE_FUNC) (void *ptr, const char *file, int line);
typedef void (F_CALL *FMOD_CODEC_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string, ...);

typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_READ_FUNC) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int sizebytes, unsigned int *bytesread);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_SEEK_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int pos, FMOD_CODEC_SEEK_METHOD method);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_TELL_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *pos);
typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_SIZE_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *size);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_FILE_READ_FUNC) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int sizebytes, unsigned int *bytesread);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_FILE_SEEK_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int pos, FMOD_CODEC_SEEK_METHOD method);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_FILE_TELL_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *pos);
typedef FMOD_RESULT (F_CALL *FMOD_CODEC_FILE_SIZE_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *size);

/*
Codec structures
Expand Down Expand Up @@ -115,13 +115,13 @@ struct FMOD_CODEC_STATE
Codec macros
*/
#define FMOD_CODEC_METADATA(_state, _tagtype, _name, _data, _datalen, _datatype, _unique) \
(_state)->functions->metadata(_size, _tagtype, _name, _data, _datalen, _datatype, _unique)
(_state)->functions->metadata(_state, _tagtype, _name, _data, _datalen, _datatype, _unique)
#define FMOD_CODEC_ALLOC(_state, _size, _align) \
(_state)->functions->alloc(_size, _align, __FILE__, __LINE__)
#define FMOD_CODEC_FREE(_state, _ptr) \
(_state)->functions->free(_ptr, __FILE__, __LINE__)
#define FMOD_CODEC_LOG(_state, _level, _location, _format, ...) \
(_state)->functions->log(_level, __FILE__, __LINE__, _location, _format, __VA_ARGS__)
(_state)->functions->log(_level, __FILE__, __LINE__, _location, _format, ##__VA_ARGS__)
#define FMOD_CODEC_FILE_READ(_state, _buffer, _sizebytes, _bytesread) \
(_state)->functions->read(_state, _buffer, _sizebytes, _bytesread)
#define FMOD_CODEC_FILE_SEEK(_state, _pos, _method) \
Expand Down
Loading