aboutsummaryrefslogtreecommitdiffstats
path: root/examples/alhrtf.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-09-22 11:36:43 -0700
committerChris Robinson <[email protected]>2020-09-22 11:36:43 -0700
commit04fd50bcdf322e23c8e402e1fe74a5e2436f4388 (patch)
treedc9b513b491b0dd6b4de6634191b8c9da7417e24 /examples/alhrtf.c
parentd2970443dde92a85237574abaa7e318785d2db97 (diff)
Support B-Format sounds in the examples
Diffstat (limited to 'examples/alhrtf.c')
-rw-r--r--examples/alhrtf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/alhrtf.c b/examples/alhrtf.c
index bea87f56..b8fc287f 100644
--- a/examples/alhrtf.c
+++ b/examples/alhrtf.c
@@ -76,11 +76,22 @@ static ALuint LoadSound(const char *filename)
}
/* Get the sound format, and figure out the OpenAL format */
+ format = AL_NONE;
if(sfinfo.channels == 1)
format = AL_FORMAT_MONO16;
else if(sfinfo.channels == 2)
format = AL_FORMAT_STEREO16;
- else
+ else if(sfinfo.channels == 3)
+ {
+ if(sf_command(sndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT)
+ format = AL_FORMAT_BFORMAT2D_16;
+ }
+ else if(sfinfo.channels == 4)
+ {
+ if(sf_command(sndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT)
+ format = AL_FORMAT_BFORMAT3D_16;
+ }
+ if(!format)
{
fprintf(stderr, "Unsupported channel count: %d\n", sfinfo.channels);
sf_close(sndfile);