2022-04-20 21:12:09 +00:00
|
|
|
This is FineAudio, a replacement for FNA's Audio subsystem.
|
|
|
|
|
|
|
|
About FineAudio
|
|
|
|
----------------
|
|
|
|
FineAudio is basically MoonWorks Audio with an FNA dependency.
|
|
|
|
It intends to deal with some of the missing pieces of XNA audio and make it easier to use.
|
2022-04-20 21:34:01 +00:00
|
|
|
Supported formats are WAV for static audio and OGG for streaming audio.
|
|
|
|
You can also add your own streaming format support by inheriting the `StreamingSound` class and implementing the `AddBuffer` method.
|
2022-04-20 21:12:09 +00:00
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
Create the AudioDevice:
|
|
|
|
|
|
|
|
```cs
|
|
|
|
AudioDevice = new FineAudio.AudioDevice();
|
|
|
|
```
|
|
|
|
|
|
|
|
Load your sound effects and music:
|
|
|
|
```cs
|
2022-04-20 21:37:59 +00:00
|
|
|
StaticSound.Load(AudioDevice, "sword.wav");
|
|
|
|
StreamingSoundOgg.Load(AudioDevice, "my_song.ogg");
|
2022-04-20 21:12:09 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Sound playback is controlled via sound instances.
|
|
|
|
Streaming sounds are already instances, but static sounds need to have instances created from them.
|
|
|
|
|
|
|
|
```cs
|
2022-04-20 21:37:59 +00:00
|
|
|
var swordSound = StaticSound.LoadWav(AudioDevice, "sword.wav");
|
2022-04-20 21:12:09 +00:00
|
|
|
var swordSoundInstance = swordSound.GetInstance();
|
|
|
|
swordSoundInstance.Play();
|
|
|
|
|
2022-04-20 21:37:59 +00:00
|
|
|
MySong = StreamingSoundOgg.Load(AudioDevice, "my_song.ogg");
|
2022-04-20 21:32:29 +00:00
|
|
|
MySong.Seek(6f); // seek to 6 seconds
|
2022-04-20 21:12:09 +00:00
|
|
|
MySong.Play();
|
|
|
|
```
|
|
|
|
|
|
|
|
You are responsible for managing these instances!
|
|
|
|
If you lose track of sound instances, unpredictable things will happen,
|
|
|
|
like sudden interruption of playback or memory leaks.
|
|
|
|
|
|
|
|
License
|
|
|
|
-------
|
|
|
|
FineAudio is licensed under the zlib license. See LICENSE for details.
|