No Sound with more than 16 Buffers!

Hello everyone!
This is my first projekt with openAl ever so I just orientated on the tutorials postet on https://joal-demos.dev.java.net/. I wrote a SoundEngine wich uses a PropertyFile to read Path-Information to fill the buffers in a for-loop. This method looks similar to the one from lesson1 in the tutorial. To play the Sounds, I have two methods, one which just plays the Sound (Lesson1), and one which uses this “Sources Sharing Buffers” (Lesson5)… this all works, but: If I have more than 16Files to load, the programm starts with no exceptions and other abnormaltiys, but in most cases I hear no Sound! It happens that its playing 16 Sounds each sized 10MB but refuses playing 17 Sounds sized 1MB.
Does anyone know how to avoid this problem or what I am doing wrong? Is there maybe a way to create just 16 Buffers an switch the sounds in case of use? This leads to my next question: How much Data can JOAL handle… at this time at starttime I have to load 80MB of Wave-Data… Is it neccessary to have a strategy like this and does anyone know some examples?

I am happy for every attemp of helping!
Rin Schwinder

OpenAL will use the hardware to play more than one sound at the same time. How many you can play depends on the sound card. I think the minimum is 16 and is common on cheap, buildt in cards.

You can bind any buffer to a source. So if you don’t have to play more than 16 at the same time, then you can write some code that manages the sources. Playing sounds on sources that is not in use.

Don’t know how much data OpenAL can handle. But if your using alot, and it seems you do, you might consider streaming ogg files instead.

Managing more Sources works quite well, the problem is, that I can just have 16 BUFFERS filled with Wave-Data at the same time. I can bind more Sources depending on these buffers, but in this case I just can use 16 Sounds in this game but need a bit more…
Does anyone know how to fix it? Maybe exchange the wave-Data in the buffers dynamicly???

There is virtually no limit to the number of buffers you can use. Try again with smaller sounds to see if that help. If that works and the large sounds don’t, then you might be seeing some limitation of amount of data OpenAL can handle.

Thank You for the quick replies!!
I tried it using different Wave-Data… Even if I used 1MB-Waves or 10MB Waves… all time it was the magic number “16” which made the limit…

I’ll bet your generating a source for each of the buffers. Lesson 5 is kind of flawed. It creates a new source for each new sound. It is ok in the lesson because all the sounds are looped and they will all be played at the same time. It is NOT something you will want to use in the real world.

What you need to do is this:

  1. At startup sit in a while(true) loop creating as many sources as you can.
  2. Load your sounds into buffers
  3. In your game you will:
    a) Find a source that is not currently playing. If they are all playing you must decide if you want to replace any of the playing sounds with the new one
    b) Once you’ve got the source you can stop it if it is playing. Then bind the new buffer to the source and play it.

If you still can’t get it to work, post some code.

I´ll give it a try… I hope it will work better this way… I´ll soon report if I had success or otherwise post some code… :wink:

Seems that my Soundcard has caused the problems… I ported the code to another machnie and suddenly it worked… quite strange…