how to play big music files?

Hello!

i read the joal tutorials, and i have a problem.
The method alutLoadWAVFile load the whole wave file? What if i have 9 songs to play depending on players position, so i have to be able to change music fast.
should i load 360mbyte wave files to the memory?
Or loading in runtime, isn’t to expensive in performance (blocking, etc.)

Thanks.

I dont know the actual ins and outs of OpenAL yet, but i know you can stream data with it…You should try to stream your data, this way, you wont have the entire song wasting memory, and you wont have the huge long delay of sending the data to the memory by the bus in the first place…

stream data? I don’t think, i understand You. I should load the files into buffers?

Basically, streaming allows you send small amounts of data to OpenAL to load at a time…Its like streaming from the internet and playing it back while its downloading at the same time.

You send a small buffer filled with a small part of the music to OpenAL to play, once that has almost finished, you upload the next part…And if your clever enough, you can remove the data from the buffer that has already been played. But im not sure how performant that will be…

Thats the gist of it…I dont know much about how to do it, all I know is that it can be done.

Good idea, thanks.

Here is an example of how to stream ogg with LWJGL OpenAL:
http://home.halden.net/tombr/ogg/ogg.html

You’ll have to port it to JOAL and do some additional work on the player.

I’m having trouble getting OggPlayer to compile.

OggPlayer.stream() uses a method

AL.alBufferData(buffer, format, dataBuffer, bytesRead, oggInputStream.getRate());

However, AL10.alBufferData() does not accept anything resembling a bytesRead parameter. Did the API change since you wrote the OggPlayer? Do we need to do something else?

Thanks!

The API changed, as it does every 2 minutes :slight_smile: Set the limit() on the dataBuffer.