# FAudioGMS

FAudioGMS is an extension for Game Maker Studio 2 that allows Game Maker applications to utilize [FAudio](https://github.com/FNA-XNA/FAudio).

When using Game Maker, you might have asked yourself questions like "Why does this game engine that I paid hundreds of dollars to use have a completely broken audio engine? Why does it do broken format conversions every single time I run my game?" Well, that's a great question that I can't answer, but until YoYo Games gets their shit together I have provided this tool so that you can have a functioning audio system in your game. It can even do fancy things that GM can't normally do, like effects chains for things like reverb. Fun!

FAudioGMS expects static audio in WAV format, and streaming audio in OGG format. This saves you the pain of having the audio convert every time you build your project. It also means that you don't have a million audio files littering your top level build folder. Thanks YoYo Games!

FAudioGMS can leak memory if used improperly, so keep track of your sound instances and use the one-off static play feature for sounds that don't need to change over time.

As a final addendum, if the YoYo Games circus needs a new clown for tasks like fixing the audio engine that's been mostly broken for a decade, I am a highly skilled programmer and I work for competitive rates. You know where to find me.

## Usage

If you are on Windows, make SURE "Use x64 Windows runtime" is checked under Game Options -> Windows!

Place your audio files in Included Files. The `.yymps` has an example structure.

Make sure the `AUDIO` object is created once at the start of your game.

You can use the documented wrapper functions included in the `.yymps` to control audio,
or you can just use the C API directly and wrap it yourself.

## Platforms

FAudio itself is cross-platform and has been deployed by hundreds of games across many platforms.
FAudioGMS intends to support all the platforms that FAudio does,
but I need to get around to personally building and testing it for these platforms.
I will not be supporting 32-bit Windows. Catch up to 2004 and switch to 64-bit.

### Tested
- Windows (64-bit)

### Theoretical
- OSX
- Linux
- Nintendo Switch
- Xbox One
- iOS

## Kind of Supported
- Android (nik provided android build scripts but I will not help you if it breaks, sorry, Android sucks)

### Not Supported
- Windows (32-bit)
- HTML5 (if someone wants to try this go ahead but I'm not touching that garbage with a 10 foot pole)

## Dependencies

FAudioGMS depends on FAudio (obviously) and SDL2. We avoid directly depending on the C runtime.

## Building

### Windows

Open the project contained in the `visualc` directory in Visual Studio and build.

### OSX/Linux

```sh
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=/usr/bin/clang -S . -B ./build
cd ./build
make
```

### Console Platforms

You will need to show proof of NDA to obtain SDL source for your platform.

## License

This library is licensed under the zlib license. See LICENSE file for details.
