Skip to content

Commit

Permalink
Merge pull request #22 from alexfonseka/master
Browse files Browse the repository at this point in the history
Update README and docs
  • Loading branch information
heraldofgargos committed Jun 27, 2019
2 parents 8aef537 + 834bb45 commit a19d613
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 61 deletions.
71 changes: 10 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# FMOD Studio integration for Godot [![Build Status](https://travis-ci.com/alexfonseka/godot-fmod-integration.svg?branch=master)](https://travis-ci.com/alexfonseka/godot-fmod-integration)
# FMOD Studio integration for Godot

A Godot C++ module that provides an integration and GDScript bindings for the FMOD Studio API.

FMOD is an audio engine and middleware solution for interactive audio in games. It has been the audio engine behind many titles such as Transistor, Into the Breach and Celeste. [More on FMOD's website](https://www.fmod.com/).

This module exposes most of the Studio API functions to Godot's GDScript and also provides helpers for performing common functions like attaching Studio events to Godot nodes and playing 3D/positional audio. _It is still very much a work in progress and some API functions are not yet exposed._ Feel free to tweak/extend it based on your project's needs.

**Note:** FMOD also provides a C# wrapper for their API which is used in the Unity integration and it is possible to use the same wrapper to build an integration for Godot in C#. However do note that this would only work on a Mono build of Godot and performance might not be on the same level as a Native/C++ integration.
### Latest release

## Installing the module
Precompiled engine binaries for Windows, macOS and Linux with FMOD Studio already integrated, is available for downloading in the [Releases](https://github.com/alexfonseka/godot-fmod-integration/releases) tab.

1. [Download the FMOD Studio API](https://www.fmod.com/download) (You need to create an account) and install it on your system. This integration currently uses the 2.00.02 Early Access release.
2. Clone the latest version of Godot from the [master branch](https://github.com/godotengine/godot). At the time of writing this is Godot 3.1 beta.
3. `cd` into the source directory and add the FMOD integration as a submodule into the `modules` directory `git submodule add https://github.com/alexfonseka/godot-fmod-integration modules/fmod`.
4. Copy the contents of the `api` directory of the FMOD API into the module's `api` directory `modules/fmod/api`. On Windows this is (usually) found at `C:/Program Files (x86)/FMOD SoundSystem/FMOD Studio API Windows/api`.
5. Recompile the engine. For more information on compiling the engine, refer to the [Godot documentation](https://docs.godotengine.org/en/latest/development/compiling/index.html).
6. Place the FMOD library files within the `bin` directory for Godot to start. Eg. on Windows these would be `fmod.dll` and `fmodstudio.dll`. When shipping, these files have to be included with the release.
| Current build status | [![Build Status](https://travis-ci.com/alexfonseka/godot-fmod-integration.svg?branch=master)](https://travis-ci.com/alexfonseka/godot-fmod-integration) |
| -------------------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------: |


### Building

If you wish to compile the module yourself, build instructions are available [here](https://github.com/alexfonseka/godot-fmod-integration/blob/master/docs/building.md).

## Using the module

Expand Down Expand Up @@ -203,58 +204,6 @@ print(perf_data.memory)
print(perf_data.file)
```

## For Android build targets

Before building the engine, you should first create the environment variable to get the NDK path.

`export ANDROID_NDK_ROOT=pathToYourNDK`

In order to get FMOD working on Android, you need to make Fmod java static initialization in Godot's Android export
template. To do so, follow the next steps.

- Add fmod.jar as dependency in your project.
In order to add FMOD to Gradle you should have dependencies looking like this :

```
dependencies {
implementation "com.android.support:support-core-utils:28.0.0"
compile files("libs/fmod.jar")
}
```

- Modify `onCreate` and `onDestroy` methods in `Godot` Java class

For `onCreate` you should initialize Java part of FMOD.

```java
@Override
protected void onCreate(Bundle icicle) {

super.onCreate(icicle);
FMOD.init(this);
Window window = getWindow();
...
}
```

For `onDestroy` method, you should close Java part of FMOD.

```java
@Override
protected void onDestroy() {

if (mPaymentsManager != null) mPaymentsManager.destroy();
for (int i = 0; i < singleton_count; i++) {
singletons[i].onMainDestroy();
}
FMOD.close();
super.onDestroy();
}
```

- Then run `./gradlew build` to generate an apk export template. You can then use it in your project to get FMOD working
on Android.

## Contributing

This project is still a work in progress and is probably not yet ready for use in full-blown production. If you run into issues (crashes, memory leaks, broken 3D sound etc.) let us know through the [issue tracker](https://github.com/alexfonseka/godot-fmod-integration/issues). If you are a programmer, sound designer or a composer and wish to contribute, the contribution guidelines are available [here](https://github.com/alexfonseka/godot-fmod-integration/blob/master/.github/contributing.md). Thank you for being interested in this project! ✌
66 changes: 66 additions & 0 deletions docs/building.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## Building the module

To compile the module for a different version of Godot, follow these instructions. Precompiled engine binaries are available in the Releases tab but it is recommended to perform a recompilation of the engine with the version of Godot that is currently being used in your project.

1. [Download the FMOD Studio API](https://www.fmod.com/download) (You need to create an account) and extract it somewhere on your system. This integration currently uses the 2.00.02 Early Access release.
2. Clone the version of Godot currently being used in your project or simply clone the latest version from the [master branch](https://github.com/godotengine/godot).
3. `cd` into the source directory and add the FMOD integration as a submodule into the `modules` directory `git submodule add https://github.com/alexfonseka/godot-fmod-integration modules/fmod`.
4. Copy the contents of the `api` directory of the FMOD API into the module's `api` directory `modules/fmod/api`. On Windows this is (usually) found at `C:/Program Files (x86)/FMOD SoundSystem/FMOD Studio API Windows/api`.
5. Recompile the engine. For more information on compiling the engine, refer to the [Godot documentation](https://docs.godotengine.org/en/latest/development/compiling/index.html).
6. Place the FMOD dynamically linking library files within the `bin` directory for Godot to start. Eg. on Windows these would be `fmod.dll` and `fmodstudio.dll`. When shipping, these files have to be included with the release.

### Godot FMOD GDNative

Alternatively, the GDNative version of the integration is being developed [here](https://github.com/utopia-rise/fmod-gdnative). This allows the use of FMOD Studio without an engine recompilation 👍.

### For Android build targets

Before building the engine, you should first create the environment variable to get the NDK path.

`export ANDROID_NDK_ROOT=pathToYourNDK`

In order to get FMOD working on Android, you need to make Fmod java static initialization in Godot's Android export
template. To do so, follow the next steps.

- Add fmod.jar as dependency in your project.
In order to add FMOD to Gradle you should have dependencies looking like this :

```
dependencies {
implementation "com.android.support:support-core-utils:28.0.0"
compile files("libs/fmod.jar")
}
```

- Modify `onCreate` and `onDestroy` methods in `Godot` Java class

For `onCreate` you should initialize Java part of FMOD.

```java
@Override
protected void onCreate(Bundle icicle) {

super.onCreate(icicle);
FMOD.init(this);
Window window = getWindow();
...
}
```

For `onDestroy` method, you should close Java part of FMOD.

```java
@Override
protected void onDestroy() {

if (mPaymentsManager != null) mPaymentsManager.destroy();
for (int i = 0; i < singleton_count; i++) {
singletons[i].onMainDestroy();
}
FMOD.close();
super.onDestroy();
}
```

- Then run `./gradlew build` to generate an apk export template. You can then use it in your project to get FMOD working
on Android.

0 comments on commit a19d613

Please sign in to comment.