The number of sources available to you is hardware dependant. There is an OpenAL function to let you know how many sources are available… but I currently don’t have the OpenAL SDK and it’s docs installed : I’m guessing it’ll be one of the alGet() or alcGet() functions, when passed one of the constants, named something like NUM_SOURCES.
(will edit this post once I re-install SDK and find the appropriate functions/constants)
[EDIT]: Maybe I’m going crazy, but I can’t seem to find what needs to be done to get the number of sources. I’m sure you can keep calling alGenSources() until it starts returning errors, but that doesn’t seem like a nice solution.
[EDIT again]: This site (http://btanks.sourceforge.net/blog/2007/08/28/openal-programming-faq/) lists it as something like the following (my rough translation from the C/C++ code on the site):
// Get size/number of attributes
int[] attributesSize = new int[1];
alcGetIntegerv(device, ALC_ATTRIBUTES_SIZE, 1, attributesSize, 0);
int numAttributes = attributesSize[0];
// Get values of attributes
int[] attributes = new int[numAttributes];
alcGetIntegerv(device, ALC_ALL_ATTRIBUTES, numAttributes, attributes, 0);
The values in attributes[] will be ordered as follows:
ALCint attrs[] = {
ALC_STEREO_SOURCES, stereo_sources,
ALC_MONO_SOURCES, mono_sources,
ALC_INVALID, ALC_INVALID
};
So I guess the number of (mono) sources will be in attributes[3].