Skip to main content

Crate chaos_rpg_audio

Crate chaos_rpg_audio 

Source
Expand description

Sound for CHAOS RPG: every sound effect and music loop is synthesized at runtime by chaos_rpg_core::audio_synth and played through rodio. There are no audio files.

If there is no audio device, AudioSystem::try_new returns None and the game runs silently.

use chaos_rpg_audio::AudioSystem;
use chaos_rpg_core::audio_events::AudioEvent;

if let Some(audio) = AudioSystem::try_new() {
    audio.emit(AudioEvent::PlayerAttack); // queued; never blocks
}

To get the sounds without playing them, build a SoundBank: every field is a ready-to-save WAV file (see the export_sounds example).

Structsยง

AudioSystem
The main audio system. Create once at startup, then call emit() from the game loop.
MusicSystem
SoundBank
Every sound effect, synthesized once, as in-memory WAV files.