libFMOD Crates.io

A library wrapper for integrating FMOD Engine in Rust applications. FFI wrapped in Rust code to make them safe, more idiomatic and abstract away uncomfortable manual C interface using.

Installation

A crate uses FMOD development libraries version to simplify version match and avoid link-time errors because of incompatible FMOD API changes in patch versions.

Changes and bug fixes in library wrapper Rust code encoded using the concept of “pre-releases” with a dash in the version, such as 2.2.6-bindings.1 or 2.2.17-bindings.1.

For example for FMOD Engine 2.02.06 you should use:

toml [dependencies] libfmod = "2.2.6-bindings"

That means that if backwards compatible bug fix 2.2.6-bindings.2 is published, that will be chosen as the greatest release automatically for your project.

FMOD Development Libraries

FMOD development libraries can't be integrated and distributed as part of this crate. You should download and install it considering your current licensing option from: https://www.fmod.com/download

Windows

You should manually provide FMOD development libraries for MSVC linker. For the first time you can just put following files to .\target\debug\deps from default FMOD Engine installation folder C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\:

bash api\core\lib\x64\fmod.dll api\core\lib\x64\fmod_vc.lib api\studio\lib\x64\fmodstudio.dll api\studio\lib\x64\fmodstudio_vc.lib

And then rename fmod_vc.lib and fmodstudio_vc.lib to fmod.lib and fmodstudio.lib accordingly.

Getting Started

The simplest way to get started is to initialize the FMOD system, load a sound, and play it. Playing a sound does not block the application, all functions execute immediately, so we should poll for the sound to finish.

```rust use libfmod::{Error, System}; use libfmod::ffi::{FMODDEFAULT, FMODINIT_NORMAL};

fn testplayingsound() -> Result<(), Error> { let system = System::create()?; system.init(512, FMODINITNORMAL, None)?; let sound = system.createsound("./data/heartbeat.ogg", FMODDEFAULT, None)?; let channel = system.playsound(sound, None, false)?; while channel.isplaying()? { // do something else } system.release() } ```

See more examples in tests folder.

Contributing

This library is automatically generated by libfmod-gen and can't be changed manually. All issues and pull requests must be created in repository of generator.