a couple audio questions

I’m doing some stuff with openal and I seem to have run into a couple problems. First of all, my programs that use OpenAL don’t work on laptops (and probably other computers that don’t have decent soundcards), Is there another dll or something that I need to package with my game in order for OpenAL to work in software?
The other problem I’m having is with AL_EXT_vorbis, I have an Audigy2 and the creative labs website tells me that my drivers are up to date yet I can’t get it to work. I read somewhere that you need libvorbis.dll in order for it to work, but I can’t seem to find this anywhere… Could I have some more information about what this file is, where I can get it, and whether it is ok for me to package it with my game or not.

I’m also wondering whether I’m going about this OpenAL programming correctly since I can’t seem to find any example code that does something similar. In order to find out how many sources the user’s hardware supports, I have a loop that will run 128 times (maybe it should be 64) or until OpenAL gives me an error and creates one source during each iteration, this piece I got from one of the lwjgl demos. It seems like there would be some way to just ask OpenAL how many are supported…
While I’m figuring that out, I store all the sources that are created and create no more from that point on. What I do instead is have a class that manages those sources and before I play a sound, my SoundClip class (which has an x,y position, pitch, buffer, etc.) asks this other class for a source and attaches a buffer to it and sets the other required attributes. Is some part of this going to be slow? Attaching the buffer and setting the other attributes for the source before I play it each time I mean. Btw, I’m doing this because I don’t want the sound to restart if clip.play() is called again while the sound is still playing.
My class that stores all the sources (clips request a source from this class before playing it) sorts all of the sources by their distance from the listener, then by their ‘priority’, and finally by whether they are actually playing or not. After they are sorted, the first source in the array is returned if its priority is <= to the priority of the SoundClip that is requesting a source, otherwise -1 is returned. One of the problems with this is that I don’t know how to actually check if a given source is actually playing or not… is there a way to do this? I’d be interested in hearing any other comments on my process (particularly about whether I’m doing everything completely wrong or not :stuck_out_tongue: ).

There is no way to query how many sources that are available. Creating one and one and checking for error is the only way. It is common to create all the sources needed at startup and mange those during the game.

Don’t think setting buffer and other attributes are slow. It is not like you are doing that as much as binding textures :wink:

You can query the state of a source:

AL10.alGetSourcei(sourceLine, AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING

You can get the OpenAL documentation at www.openal.org

ah thanks for that. I actually did know about the documentation and I’ve read a fair amount of it, but its a large document when you looking for something specific and I couldn’t seem to find anything on querying source states.

p.s. Thanks for writing OggInputStream :smiley: I was really hoping I could find something to use like ov_read from the devmaster OpenAL ogg streaming tutorial (http://www.devmaster.net/articles/openal-tutorials/lesson8.php).

hmm, anyone know about libvorbis.dll or running OpenAL in software? cough Matzon cough ;D

the vorbis extension for openal is flaky at best at the moment. Your best option is to use jorbis - either manually or using the OggInputStream (probably the easiest).

As for running OpenAL in software - I am not sure about what you mean? - OpenAL (if you use the one we use) will use the DirectSound3D backend which is typically hardware accellerated.

I’m using OggInputStream for streaming large audio files and I have another method for decoding an entire ogg, but I only use that if AL_EXT_vorbis is not available because it could be potentially faster at some point (decoding done in hardware?).However, I can’t seem to get AL_EXT_vorbis working on my computer and I have a fairly new card :frowning: I tried looking for information on google and read something about needing libvorbis.dll, but couldn’t find any more information on it. I did find the libvorbis.dll source, but I’ve never written c/c++ and have no idea how to compile etc.

Ok, I can give up on AL_EXT_vorbis, but I need audio to work on most every computer and I havn’t been able to get openal working on a single laptop and some desktop computers. I assume this is because they have crap soundcards, but I thought there was a ‘software’ implementation of OpenAL that should work everywhere… I would like to be able to use this if the hardware support isn’t available. I’ll have to double check, but I’m fairly certain puppygame’s games work on some of the laptops where my openal code failed… so I feel like I’m missing something.