brAudio is a lightweight audio library I wrote for my game engine (In progress). It is built on top of FMOD audio. This is my first time writting an audio engine, this is not a finished robust product.
- Sound loading and streaming
- Audio sources with media control
- 3D audio
- Audio groups
- Pitch and volume control
- Sound effects
- Reverb zones
- Premake support for project generation
- Multiple audio listener support
- Integrate with brMath
Load sounds
// Load sound as a stream
Sound streamedSound("res/sound/birds.mp3", true);
// Load sound
Sound loadedSound("res/sound/birds.mp3", false);
Creating an Audio Source
// Create audio source (sound, volume, pitch, looping)
AudioSource backgroundSource(&streamedSound, 1.0f, 1.0f, true);
Manage an audio source
// Play audio source
backgroundSource.Play();
// Control audio source
backgroundSource.Pause();
backgroundSource.Mute(true);
backgroundSource.Resume();
// Set audio source parameters
backgroundSource.Set3DPosition({ 1.0, 0.0, 1.0 });
backgroundSource.SetPitch(0.5f);
backgroundSource.SetVolume(0.5f);
// Change source's sound
backgroundSource.SetActiveSound(&loadedSound);
Create and assign an Audio Group
AudioGroup masterGroup; // Master group
AudioGroup sfxGroup(masterGroup); // Audio group child of master group
backgroundSource.SetAudioGroup(sfxGroup);
Manage an audio group
sfxGroup->SetVolume(0.5f);
sfxGroup->SetPitch(0.5f);
sfxGroup->Mute(true);
Update audio listener every frame, and cleanup afterwards
while(true)
{
float elapsed = 0;
AudioListener::GetInstance()->Update(elapsed);
}
// Clean-up
AudioListener::GetInstance()->ReleaseSystem();