-
Notifications
You must be signed in to change notification settings - Fork 4
Guide: Routing sound through buses & applying filters
BNA supports routing sound through audio buses, routing audio buses through each other, and attaching up to 8 filters to each bus. By default all sound plays through a single default Master bus, but you can create new buses at will:
using BNA.Audio;
// ...
let musicBus = new AudioBus(Audio);
let soundBus = new AudioBus(Audio);
let uiBus = new AudioBus(Audio, soundBus);
let voBus = new AudioBus(Audio, soundBus);
let sfxBus = new AudioBus(Audio, soundBus);
To attach filters to buses, just construct a filter and then call AttachFilter, passing the slot to attach to (valid values are 0 .. 7)
using BNA.Audio.Filters;
// ...
let reverbFilter = new ReverbFilter();
sfxBus.AttachFilter( reverbFilter, 0 );
Note that a filter can only be attached to one bus at a time. You can call DetachFilter to remove a filter from a bus:
sfxBus.DetachFilter( 0 );
To play sounds through buses, just pass the bus to the Audio.Play methods:
let sfxInstance = Audio.Play( mySoundEffect, sfxBus );
Getting Started
Drawing Sprites
Loading & Applying Effects
Loading Textures
Creating vertex & index buffers and drawing geometry
Using render buffers
Playing sound effects & music
Routing sound through buses & applying filters
Game
GameWindow
GraphicsDevice
SpriteBatch
Audio
Keyboard
Mouse
GamepadDevice