4 releases (2 breaking)

new 0.3.0 May 12, 2024
0.2.0 May 4, 2024
0.1.1 Dec 13, 2023
0.1.0 Dec 12, 2023

#235 in Audio

Download history 6/week @ 2024-02-18 12/week @ 2024-02-25 26/week @ 2024-03-31 151/week @ 2024-04-28 32/week @ 2024-05-05

183 downloads per month

MIT license

13KB
200 lines

A simple audio library

This library makes it easy to play .wav sounds.

// Initializing ez_al
let al = EzAl::new().expect("Failed to open current device or create OpenAL context!");

// Creating an asset
let asset = WavAsset::from_wav(&al, "sound.wav")
  .expect("failed to load a wav file");
    
// Creating sources
let mut pos_source = SoundSource::new(&al, &asset, SoundSourceType::Positional)
  .expect("Failed to create a positional sound source");
    
let mut simple_source = SoundSource::new(&al, &asset, SoundSourceType::Simple)
  .expect("Failed to create a simple sound source");

// Setting listener position and orientation
ez_al::set_listener_transform(&al, cam_pos, cam_at, cam_up);

// Playing sounds
pos_source.play_sound();
simple_source.play_sound();

Prerequirements

Installed cmake and clang

Installation example(Arch Linux): sudo pacman -S clang cmake

Dependencies

~3–5.5MB
~123K SLoC