FIFE forums

FIFE Development => Framework development => Topic started by: anxs on October 19, 2007, 11:10:13 am

Title: Audio module redesign
Post by: anxs on October 19, 2007, 11:10:13 am
This thread is to provide a general overview about the development of the new audio module

Already done:

TODO:

Known Issues:

Update:
1 November 2007 - The Playback of non-streaming files is supported, now working on the streaming-support.
11 November 2007 - Streaming works, got to go on with the soundemitter-functions
25 November 2007 - Basic emitter-handling works, all emitter-functions available, module is ready for testing...
Title: Re: Audio module redesign
Post by: anxs on November 26, 2007, 11:49:47 am
Hurray!   ;D
The audio branch is working at last and now ready for testing. If everything works fine (and for me it does) we can merge the branch with trunk very soon and keep on working on the "specials" as the basic functionality is now given.

During the coding-progress I got away from the original design document in some parts of the code, because some ideas simply didn't work. ;-) I'll try to update the design documents soon.

At last I have a new idea for the audio module. We first planned to implement one volume function for static emitters, one for dynamic ones and one master volume. Up to now there's only a master-volume function, because I want to implement a class to group several soundemitters together. All soundemitters, which are attached to a specific soundgroup inherit the volume-setting of this group. (but each soundemitter still has it's own gain setting, which is merged with the group-volume)
By attaching soundgroups to each other it will be possible to create chains of volume settings. The gain value of the corresponding the openAL-source of an attached soundemitter will be calculated and applied automatically.
In addition soundgroups make it possible to start/stop/pause the playback of a bunch of soundemitters at the same time.

Any comments and/or questions?



Title: Re: Audio module redesign
Post by: chewie on November 26, 2007, 12:01:39 pm
The audio branch is working at last and now ready for testing. If everything works fine (and for me it does)

[..]

All soundemitters, which are attached to a specific soundgroup inherit the volume-setting of this group. (but each soundemitter still has it's own gain setting, which is merged with the group-volume)


Nice one :)

Sounds like the hardware mixer for my turntables  ;D
Title: Re: Audio module redesign
Post by: anxs on November 26, 2007, 12:17:37 pm
 ;D yeah, when it's finished we create a FIFE Jukebox with integrated mixing-feature ^^
Title: Re: Audio module redesign
Post by: mvBarracuda on November 28, 2007, 02:48:24 pm
Reply from the OpenAL channel concerning the win32 warning:
Quote
<KittyCat> barraAway, you can't call alBufferData on a buffer that's attached to a source (either by alSourcei(source, AL_BUFFER, ...) or alSourceQueueBuffers)
<KittyCat> the SI erroniously allows it, but you're not supposed to be able to
Title: Re: Audio module redesign
Post by: anxs on December 22, 2007, 11:04:29 am
Well I want to start a discussion if it's really necessary to integrate wav-support to FIFE.
In my mind it would be a better solution to support FLAC instead of the wav format. Flac-files are often smaller than wavs and it's a free audio codec. This would also solve the problem with hundreds of different wav-formats. (-> more (http://mirror1.cvsdude.com/trac/fife/engine/ticket/174))
Furthermore it doesn't seem to be very easy to find a working high quality wav decoder. (Even the decoder from the Allacrost project does not work quite well)

What do you think?
Title: Re: Audio module redesign
Post by: chewie on December 22, 2007, 11:34:12 am
We at Zero-Projekt won´t use *.wav - we convert all our sounds to ogg.

Personally, I´d say flac would be nice - and are there really still people who need wav these days? ^^
Title: Re: Audio module redesign
Post by: AKIRA_SAN on December 22, 2007, 12:33:23 pm
since its easy to convert .wav and etc to .ogg i guess there is no need to support everything :)
Title: Re: Audio module redesign
Post by: jasoka on January 12, 2008, 09:35:36 am
Good work anxs with the audio module, I'm also pleased to see the progress in that area :)

About audio format support:
I'm fine of not implementing any other format than ogg for fife at this given moment. Even ACM could be done a bit later, in case we decide to focus on island techdemo for now. Instead of additional formats, would you like to take a task of integrating sounds as part of actions, so that e.g. gunshots sounds can be synchronized with animations in engine side?
Title: Re: Audio module redesign
Post by: anxs on January 12, 2008, 01:03:23 pm
Thanks jasoka :)

The integration of sounds as part of actions is already on my todo-list and I'll try to finish the task before 2008.0 gets shipped. Unfortunately I'm currently very busy with my skilled work, so not much time for FIFE  :( , but this will be hopefully finished until 25 january.
Title: Re: Audio module redesign
Post by: jasoka on January 17, 2008, 04:29:12 pm
There's some adjustments to be made in the automatic testing suite; currently when tests are run in sequence, audio tests fail. I added my speculation here: https://mirror1.cvsdude.com/trac/fife/engine/ticket/149

Hopefully you can check it out at some point, anxs
Title: Re: Audio module redesign
Post by: mvBarracuda on February 02, 2008, 04:16:09 am
vja, a new interested developer did send in a patch for the sound effects ticket listed here:
http://mirror1.cvsdude.com/trac/fife/engine/ticket/192

The patch itself seems to be a full patch containing the modified files instead of a DIFF but it shouldn't be too hard to apply it. Could anyone check the patch file and apply it to the SVN trunk in case it looks like a good solution for this ticket? In case you got some time on your hand anxs, it would be great if you could look into it as you're the person on the development team who's most familiar with our audio code.
Title: Re: Audio module redesign
Post by: vja on February 13, 2008, 05:06:45 am
I propose to determine all effects, that we shall adding to FIFE, because of that depend implementation way.
Any ideas will be appreciate.

Title: Re: Audio module redesign
Post by: sja on February 13, 2008, 09:42:36 am
i think, what necessary minimize users operation with add/remove/control/configure sound effects, i. e. all sound effects found in soundemmiter and user dont create effects.
Title: Re: Audio module redesign
Post by: sja on February 15, 2008, 09:50:42 am
stereo in linux.

im guess the best way - use openal-soft. (http://kcat.strangesoft.net/openal.html)

it easy integrated to fife-project:
before first linux build checking installing this library (/usr/local/lib/libopenal.so), if dont exist - user goto trunk/ext/openal-soft/ and installed this (how minizip).
after install original library dont remove - other applications use original openal library.

next: fife_openal.h
Code: [Select]
// Platform specific includes
// Linux
#if defined( __unix__ )
#include <AL/al.h>
#include <AL/alc.h>
#endif

change to
Code: [Select]
// Platform specific includes
// Linux
#if defined( __unix__ )
#include "/usr/local/include/AL/al.h"
#include "/usr/local/include/AL/alc.h"
#endif
and link new library.

for easy install - may be create install_openal-soft.sh executable script (as root, may in this scipt added installation for minizip, may be with install missing packets (for make, scons, cmake and other ??)

and linux users enjoy stereo music in fife!  :)

single trouble: if create this, linux users have trouble with compilation after svn update - library dont exist.
but this is single time. run install_openal-soft.sh. (for example, minizip necessary for installation).

second way: if library dont installed - link to project original library, and include original headers (in automatic - checking and switching link libraries and headers).
Title: Re: Audio module redesign
Post by: sja on February 18, 2008, 03:18:18 am
specify to previoгs post:

create directory "trunk/ext/openal-soft/" and copy openal-soft sources and create install script for easy install this library.
weight of sources - 492kb, or 65,6 in tar.bz2
periodically update this library in our svn.
Title: Re: Audio module redesign
Post by: mvBarracuda on February 18, 2008, 03:29:41 am
Sounds like a good solution to me sja :-)

While OpenAL-soft seems to resolve a couple of problems for the Linux users it hasn't been added to any important package repositories. So I would support this proposal, putting OpenAL-soft into ext. Any volunteers to test this and make the neccessary changes to SVN after that?
Title: Re: Audio module redesign
Post by: sja on March 11, 2008, 09:25:08 am
I'm currently trying to get stereo support for FIFE under Linux. To do so I'm trying to add openal-soft (http://kcat.strangesoft.net/openal.html) to the ext directory in our SVN repository.

Openal-soft uses cmake as build system. We would need to port parts of the cmake script to scons if we want to offer support for building it from our SVN without forcing the user to install cmake. I'm currently trying to create a configure.sh script that checks the host system for a number of different libraries (e.g. OSS, ALSA) and creates a correct config.h that is used by openal-soft after that.

I'm having some problems with this however:
1. I've found no option to check if INT64 is defined on the system via configure.in (I'm using autoconf)
2. Checking if two different funtions exist in one library does not work correctly yet.

Could anyone help me out with this?

EDIT mvbarracuda: clarification.
Title: Re: Audio module redesign
Post by: Joshdan on March 11, 2008, 11:07:21 pm
regarding point #1, I believe the only supported compiler that does not include these definitions is MSVC, so you could just check for that.  This method is used in our header files, so if the assumption proves false, more than OpenAL-Soft would fail anyway.
Title: Re: Audio module redesign
Post by: mvBarracuda on March 12, 2008, 03:12:13 pm
Hmm I guess we won't need to worry about MSVC support anyway as openal-soft is just planned as alternative for NIX systems. OpenAL works quite fine on win32 so there is no need to switch to openal-soft on this platform.
Title: Re: Audio module redesign
Post by: mvBarracuda on March 19, 2008, 07:56:58 am
Copy & paste:
The initial idea was to add OpenAL-soft to our ext directory in SVN so linux users could build it via scons ext=1. However openal-soft seems to rely on a file called config.h that gets generated by cmake (the native build system that openal-soft uses). We would need to port parts of the cmake script to scons in case we would like to implement the ext directory solution.

Another alternative would be to simply add a note to the wiki that openal-soft could / should be used instead of the normal openal package. In this case we would leave the library decision to the user.

Both approaches offer advantages and disadvantages:
- The ext approach would make it easy for users to install openal-soft and they won't need cmake for this purpose. The main disadvantage is that we would need to update our scons script in case we would like to add newer openal-soft releases later that come with a modified cmake script.
- The approach to leave the decision to the user offers the advantage that we wouldn't need to take care of openal-soft integration. The main disadvantage is that users are forced to install cmake if they would like to use openal-soft.

What do you think about these two approaches? Do you have any preference? Would be good to have some feedback by our Linux-based developers. Win32 users would stick to the normal OpenAL sample implementation that comes with the win32 compile SDK as OpenAL support by Creative seems to be better on this platform.
Title: Re: Audio module redesign
Post by: sja on March 20, 2008, 03:01:11 am
i am creating configure file special for getting info about user system and correct compile openal-soft.
if some libs or dev packets dont installed - user needed in manual installing this packets (it is inevitable, e.g. installing sdl and others library).
Now we nedded in testing...
Good luck!
Title: Re: Audio module redesign
Post by: sja on March 21, 2008, 04:15:04 am
Mini HOW TO for testing openal-soft in FIFE

1. Download from FIFE ftp, dirctory sja file openalsoft.tar.bz2 and unpack;
2. Copy subdir openal-soft to trunk/ext/;
3. Replace trunk/ext/Sconscript to SConscript (from tar.bz2);
4. Replace trunk/SConstruct to SConstruct;
5. Replace trunk/build/linux2-config-dist.py to linux2-config-dist.py;
6. Replace in trunk/engine/core/audio/fifeopnal.h:
Code: [Select]
#if defined( __unix__ )
#include <AL/al.h>
#include <AL/alc.h>
#endif
to
Code: [Select]
#if defined( __unix__ )
#include "AL/al.h"
#include "AL/alc.h"
#endif
7. Use standart
Code: [Select]
scons -c
scons ext=1 (see for no errors)
scons

good luck!
Title: Re: Audio module redesign
Post by: mvBarracuda on April 11, 2008, 02:39:02 am
Did any linux-based developer try this yet? If so: how did it work out? It would be great if we could add openal-soft to trunk and the datasets branch soon.
Title: Re: Audio module redesign
Post by: sja on April 15, 2008, 03:51:41 am
hey all! please test it!
checkout from https://svn1.cvsdude.com/fife/engine/branches/active/openal-soft

one trouble: - library openal_soft dont finded CheckSimplyLib (in SConstruct), for test im forced ret=1 for finded and link this lib :)
and scons ext=1 && scons.

testing, and who possible - corrected this search of lib, please.

stereo rulez :-D
Title: Re: Audio module redesign
Post by: ashen on April 20, 2008, 03:49:23 am
Works here
I don't even have problem with CheckSimplyLib

hey all! please test it!
checkout from https://svn1.cvsdude.com/fife/engine/branches/active/openal-soft

one trouble: - library openal_soft dont finded CheckSimplyLib (in SConstruct), for test im forced ret=1 for finded and link this lib :)
and scons ext=1 && scons.

testing, and who possible - corrected this search of lib, please.

stereo rulez :-D
Title: Re: Audio module redesign
Post by: sja on April 20, 2008, 06:22:26 am
please, checkout from https://svn1.cvsdude.com/fife/engine/branches/active/openal-soft
and run: scons ext=1 && scons
and : cd clients/island_demo
python run_demo.py

all works. i'm excluding support oss from library openal-soft.
i'm changing music in island_demo to ZXSpectrum music (Andy Fer) for really testing stereo effect.