I believe the function 'alIsBuffer' and 'alIsSource' would be better alternatives to your method. They actually test wether the buffer/source id is valid and in use by OpenAL.
[EDIT]
Shouldn't the source deletion be within a different if block? Unless you are absolutely sure that there is a valid source at the same indes of every valid buffer, this seems a little error prone
//assuming
ALuint buffer[64];
ALuint source[64];
//....
for(int index = 0; index < 64; index++)
{
if(alIsBuffer(buffer[index])
alDeleteBuffer(1, &buffer[index]);
if(alIsSource(source[index])
alDeleteSource(1, &source[index]);
}
But then again I don't see why you can't just do this...
alDeleteBuffers(64, buffers);
alDeleteSources(64, sources);
If the id's happen to be invalid they will raise an error, but it should just ignore the faulty id and go on delete the rest. The worst that will happen is that an error will be raised, but if your exiting the program anyway that shouldn't be a problem.
ps. I wouldn't count on having 64 buffers/sources all the time. A lot of machines are limited to anywhere from 20-30
FRAG THE PLANET
Ed Helms: Alcohol causes problems and guns solve problems. I don't see why you can't have guns in bars.
Other guy: That's a stupid idea.
Ed Helms: Yeah, if your a pussy.