DevMaster.net Forums
[[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]]

Go Back   DevMaster.net Forums > Programming & Development > Sound and Music Programming
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-06-2004, 02:41 AM   #1
jur9103
New Member
 
Join Date: Oct 2004
Posts: 7
Default

hi.

in Open Al doc. is writen this:

The AL has three fundamental primitives or objects Buffers, Sources, and a single
Listener.
Each object can be changed independently, the setting of one object does not affect the setting of others. The application can also set modes that affect processing. Modes are set, objects specified, and other AL operations performed by sending commands in the form of function or procedure calls. Sources store locations, directions, and other attributes of an object in 3D space and have a buffer associated with them for playback. There are normally far more sources defined than buffers. When the program wants to play a sound, it controls execution through a source object. Sources are processed independently from each other.

well, i can have 32 sources max., but i have more than 100 sound sources in my level, but they are not played at once.

Question is: what is good way to manage sources ?

i want to create 100 sources and select 32 of them to play at once, but i dont know how to do it.
jur9103 is offline   Reply With Quote
Old 10-06-2004, 07:46 AM   #2
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default

How I normally manage this is as follows

I create all the sound buffers that i will be playing in the level/room whatever
I already have a list of sources (up to the max available)

I request a sound to be played from a given buffer

I look through the array of sources, checking their state as i go (playing, paused stopped etc.)

I find a source that is not playing, i play the requested sound on that source

And so on and so on.

If I have no sources availabe the sound doesnt get played (you could have a priority system running in that case, where certain sounds have a higher priority that others)

I then return the source that the sample has been played on to allow the system to control the source

100's of samples (buffers) is a lot. How many of these would you exxpect to be played at the same time? Repeating sounds can all be played from the same buffer, so dont load in mutiple instances of te same buffer (just in case you are)

Hope that helps a little
Spree
SpreeTree is offline   Reply With Quote
Old 10-06-2004, 07:51 AM   #3
JSoftware
Member
 
Join Date: Jun 2004
Location: Århus, Denmark
Posts: 73
Default

What i'm doing in my soundengine:

i have an array of all the sources each source containing info off it's id and position.
then i have an array of all currently playing sounds it's length is 32!
at last i have an integer variable which contains the number of playing sources.

(i'm trying to implement a function that sorts the sources by distance from listener but that'll come later..)

when i want to play a source i set playingarray[playingsources] = sources[the one i want to play];
and increment playingsources;
test to see if playingsources is higher than 32; if it is then set it to 1!

guess it can be made a little smarter but that works until now
___________________________________________
Peregrinus, expectavi pedos meos in cymbalis!
JSoftware is offline   Reply With Quote
Old 10-06-2004, 08:55 AM   #4
jur9103
New Member
 
Join Date: Oct 2004
Posts: 7
Default

I like idea to have priority on sounds. it looks promising. i have sounds from crowd (a lot of), sounds from players, music, ambient (wind ..)

sometimes there is more than 32 sounds at once.

priority on sounds can work good. only not important sounds are not played, there is a little problem with setting distancies on sounds, because it can be set wrong and not playing some sounds can sounds strange.

i'm going to implement this, and i will write here results.
jur9103 is offline   Reply With Quote
Old 10-06-2004, 11:07 AM   #5
NomadRock
Senior Member
 
NomadRock's Avatar
 
Join Date: Aug 2004
Location: USA
Posts: 829
Default

You could make it easy and make a min heap based on the priority and then also on the time it has been playing so that you tend to pick sounds that have at least had a chance to get heard rather than ones that only started a few milliseconds ago.
___________________________________________
Jesse Coyle
NomadRock is offline   Reply With Quote
Old 10-21-2004, 01:05 AM   #6
jur9103
New Member
 
Join Date: Oct 2004
Posts: 7
Default

coding done.
It is functional, but i think there is some place to improvements.
Who is interested to share knovledge to develop sound engine in 3d game, and is interested in source code let me know.
jur9103 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump


All times are GMT -7. The time now is 06:10 AM.


Powered by vBulletin
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.