Support B-Format amb file IRs in alconvolve
Be aware this requires proper header data (a WAVE_FORMAT_EXTENSIBLE format with the proper integer or float B-Format sub-format GUID). A normal 4-channel wave file will not be recognized, since it's indistinguishable from quadrophonic.
This commit is contained in:
+12
-1
@@ -325,11 +325,22 @@ static ALuint LoadSound(const char *filename)
|
||||
/* Get the sound format, and figure out the OpenAL format. Use floats since
|
||||
* impulse responses will usually have more than 16-bit precision.
|
||||
*/
|
||||
format = AL_NONE;
|
||||
if(sfinfo.channels == 1)
|
||||
format = AL_FORMAT_MONO_FLOAT32;
|
||||
else if(sfinfo.channels == 2)
|
||||
format = AL_FORMAT_STEREO_FLOAT32;
|
||||
else
|
||||
else if(sfinfo.channels == 3)
|
||||
{
|
||||
if(sf_command(sndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT)
|
||||
format = AL_FORMAT_BFORMAT2D_FLOAT32;
|
||||
}
|
||||
else if(sfinfo.channels == 4)
|
||||
{
|
||||
if(sf_command(sndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT)
|
||||
format = AL_FORMAT_BFORMAT3D_FLOAT32;
|
||||
}
|
||||
if(!format)
|
||||
{
|
||||
fprintf(stderr, "Unsupported channel count: %d\n", sfinfo.channels);
|
||||
sf_close(sndfile);
|
||||
|
||||
Reference in New Issue
Block a user