Welcome! Log In Create A New Profile


The decoder situation

Posted by henke37 
The decoder situation
February 01, 2009 11:10AM
I might as well write it once instead of repeating it on IRC.
I do not like the current situation for audio file playback.
No, I do not dislike the ASND library, in fact, I like that people actually takes advantage of the available resources. The problem here is something else, things that the mixing library does not do. Yes, ASND is a mixing and output library.
The problem is not with the ASND library itself, but with the decoders using it. With decoders, I am referring to things like mp3play and modplay from libogc. The problem is simple in its nature, but let me explain the facts that cause it.

Each mixing channel can only play one sound at a time, this is very normal for a mixer, one channel per sound, nothing strange here. The problem in the current design is the following; the decoders are all using the same hardcoded sound channel id, number zero.
Now, with the facts right next to each other, most people will make the connection, but I will state it anyway. With the current design, only one decoded sound can be played at the same time!
This proves to be a problem when you think about things more carefully. The current design assumes that you will never want to play more than one encoded sound, this is preposterous. There are plenty of situations when you would want to do that.

Here is a few examples:
*Saving size by having sound effects encoded
*Using crossfading of multiple music tracks to create a more immersive gameplay experience.

As you can see now, it’s insane to even think about locking audio decoders to specific channels, the current design needs to be fixed. What would the fix be? Well, the simplest solution is to allow you to choose a different channel for the decoder libraries.

Edited 1 time(s). Last edit at 02/03/2009 09:11AM by henke37.
Re: The decoder situation
February 01, 2009 11:17AM
Hermes' SNDLib lets you choose which channel to play each sound on =P

Edited 1 time(s). Last edit at 02/01/2009 11:31AM by SquidMan.
Re: The decoder situation
February 01, 2009 11:24AM
Yes it does, when you are the one actually interacting with it. When using one of the mentioned libraries, this is not the case.

Edited 1 time(s). Last edit at 02/01/2009 11:25AM by henke37.
Re: The decoder situation
February 01, 2009 11:31AM
Oh yes, you are correct, heh.
I guess they should get to work on that then. Integrating SNDLib and making the included libraries use it should be easy enough to do.
Re: The decoder situation
February 02, 2009 06:44PM
Wouldn't the easiest method be to always use ASND_GetFirstUnusedVoice() instead of a hardcoded channel? If the libraries and your own apps always used it, there would be no collisions/issues.
Re: The decoder situation
February 03, 2009 07:29AM
True, but how would you get the actual channel number? Surely you need it to do things like fading.
Re: The decoder situation
February 03, 2009 10:52AM
AFAIK ASND_GetFirstUnusedVoice() just returns the channel number or SND_INVALID if there is no channel available. So just store this number anywhere. Another possibility would be to make the decoders use a user specified channel which would be the cleanest way in my opinion.
Sorry, only registered users may post in this forum.

Click here to login