#audio #gamedev #effect #bindings #version #buffer #don-t

synthizer

bindings to Synthizer, a library for 3D audio and effects

23 releases

0.5.6 Mar 4, 2023
0.5.4 Dec 17, 2022
0.5.3 Nov 12, 2022
0.5.1 May 28, 2022
0.2.0 Sep 21, 2020

#157 in Game dev

31 downloads per month
Used in bevy_synthizer

Unlicense

12MB
266K SLoC

C 161K SLoC // 0.1% comments C++ 101K SLoC // 0.1% comments Rust 4K SLoC // 0.0% comments Shell 2 SLoC

Synthizer

CI Status GitHub Sponsors

Current targeted Synthizer version: 0.10.0

Official, high-level bindings to Synthizer, a library for 3D audio and effects.

Synthizer itself has a language-agnostic/C manual which generally covers Synthizer conceptually. These bindings generally map one-for-one in fairly obvious ways. See Rustdoc (docs.rs build pending) or this repository for Rust-specific examples and instructions for use; we don't put a lot of examples in this readme inorder to benefit from doctests. But it's as easy as:

//! Play a file by loading it into a buffer.
use synthizer as syz;

fn main() -> syz::Result<()> {
    let args = std::env::args().collect::<Vec<_>>();
    if args.len() != 2 {
        panic!("Usage: example <file>");
    }

    let _init_guard = syz::initialize()?;
    let context = syz::Context::new()?;
    let src = syz::DirectSource::new(&context)?;
    let generator = syz::BufferGenerator::new(&context)?;
    let buffer = syz::Buffer::from_file(args[1].as_str())?;
    generator.set_buffer(&buffer)?;
    src.add_generator(&generator)?;

    println!("Press enter to exit");
    std::io::stdin().read_line(&mut String::new()).unwrap();
    Ok(())
}

With the additional complexity being justified by things such as multiple generators per source, being able to reuse buffers, etc.

Building

This should build out of the box on most platforms, but Windows may have difficulties. If you can't build on Windows, try building under an MSVC shell, and if that doesn't work open an issue.

Dependencies