Skip to content
OpenAL + Ogg/Vorbis abstraction
C#
Branch: master
Clone or download
rdeioris
rdeioris Update README.md
Latest commit ac13bf6 Dec 17, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
aiv-vorbis-example update NVorbis and OpenTK versions, added support for embedded sounds Dec 17, 2016
aiv-vorbis update NVorbis and OpenTK versions, added support for embedded sounds Dec 17, 2016
.gitignore
Aiv.Vorbis.nuspec 0.3 Dec 17, 2016
LICENSE
README.md Update README.md Dec 17, 2016
aiv-vorbis.sln update NVorbis and OpenTK versions, added support for embedded sounds Dec 17, 2016
openal32.dll added openal32.dll Jan 6, 2016

README.md

aiv-vorbis

OpenAL + Ogg/Vorbis abstraction

Usage

To play a sound you need an AudioSource, every object in your game making noise should be mapped to a different AudioSource to have correct mixing.

AudioSource heroAudioSource = new AudioSource();

AudioSource zombieAudioSource = new AudioSource();

AudioSource backgroundMusic = new AudioSource();

You need sound files in the popular Ogg/Vorbis format. Tiny sounds (like effects, noises, ...) are mapped to AudioClip, while long sounds (like background music) have to be streamed constantly from the disk.

AudioClip jumpSound = new AudioClip("Assets/jump.ogg");

AudioClip attackSound = new AudioClip("Assets/shot.ogg");

To play clips just issue the Play() command:

heroAudioSource.Play(jumpSound);

while if you need to play longer sounds from disk (instead of folly loading them in the memory like with AudioClip):

backgroundMusic.Stream("Assets/long_music.ogg");
You can’t perform that action at this time.