aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/alconvolve.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/alconvolve.c b/examples/alconvolve.c
index bc6ac311..b3d6c4dd 100644
--- a/examples/alconvolve.c
+++ b/examples/alconvolve.c
@@ -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);