Audio is back in

SIEGE has been without audio for quite some time, pending correction of a couple of bugs – this took quite a long while simply because I couldn’t get the bugs fixed earlier. I’ve corrected the breaking bug now, however and even some other bugs in audio, so it now works!

You can check it out in the “audio” example, but make sure you have FLAC and Vorbis libraries installed or else you will get silence since it won’t know how to load the audio files.

Streaming is not yet supported – the audio has to be preloaded as a whole – but it is planned.

There is one more feature, however, which is designed to ease the creation of “fire and forget” sound effects – sgAudioSourceDestroyLazy. You can find an example of use in the aforementioned “audio” example, but here it is for those who don’t want to bother checking:

void createExplosion(SGAudioBuffer* buffer)
{
    /*
     * Explosions are:
     * - high-priority sounds (10.0 priority)
     * - loud (1.0 volume)
     * - "powerful" (pitch reduced to 0.5 to make it sound "deeper")
     * - non-looping (looping set to SG_FALSE)
     */
    SGAudioSource* source = sgAudioSourceCreate(10.0, 1.0, 0.5, SG_FALSE);
    sgAudioSourceQueueBuffer(source, buffer);
    sgAudioSourcePlay(source);

    /*
     * Newest addition - this will wait until the source
     * stops playing (looping is automatically set to SG_FALSE)
     * and then destroy the source.
     */
    sgAudioSourceDestroyLazy(source);
}
Posted in SIEGE.