Kromster80/kam_remake

Add support for ogg audio format in missions/scripts.

reyandme opened this issue · 5 comments

Out scripts can play wav sound now, but wav sound is uncompressed, so even short sounds are about 100-200Kb, which is not good in terms of map size to download.

Currently we have 2 libs for sounds - Bass and Libzplay. Libzplay can play different formats:

Here is libzplay info page.

Mp3 and AAC format need licence, but other format could be added. FLAC and AC3 is not so good for our tasks, but OGG is fine. It can compress as good as Mp3 and its easy too convert sounds into it.

I've just checked - libzplay can easily play ogg files.

So we could add support for ogg files for maps/campaigns and switch to libzplay lib finally (get rid of Bass).

I agree we should have support for a compressed audio format in scripted mission sounds. OGG is a good format because it's widely supported and free from license restrictions.

But please note this distinction: Bass and Libzplay are our music libraries. OpenAL is our sound effects library.

There are big differences between them. OpenAL allows sounds to occur in specific positions on the map and takes care of mixing as you move the camera. It allows many sounds to be played at once. It also needs to play sounds immediately when you ask it to (for button click sound without a delay). Because of these low level requirements it works with raw audio samples not compressed formats like OGG. IIRC Bass/Libzplay only support a single track playing at once so are really only suitable for music.

Scripted sounds all go through OpenAL so they can positioned on the map and layer multiple sounds at once. We can't use our music libraries since they can't play multiple sounds at once. So in order to implement this we probably need to support OGG sounds in OpenAL. This should be possible, not sure what's involved (it might mean integrating an OGG decoder library that gives raw audio samples to OpenAL).

@lewinjh Thanks for your comment. Yes I missed that we are using both OpenAL and libzplay for different purposes.

IIRC Bass/Libzplay only support a single track playing at once so are really only suitable for music

I checked libzplay - its possible to play only one track at one time indeed.

Well anyway its possible to add OGG support for OpenAL, as you said, but I need to do further discovering and implementation.

Implemented in #335

I wanted to ask about OGG license stuff. Do we need to do anything special about it? (mention in readme, add disclaimers, etc.)

Here is faq faq about ogg licences from vorbis official website.

quote from faq:

There are no licensing fees for ANY use of the Ogg Vorbis specification. As a commercial developer, you are free to create and sell (or give away) open or closed source implementations of Vorbis encoders, decoders, or other tools. However, if you use our software rather than writing an independent implementation, you must respect the terms of the license. Our libraries are available under our BSD-like license and can be used whole or in part by closed source applications.

Here is the example of BSD-like license

Does that mean we need to add some .licence text file with similar content?