aboutsummaryrefslogtreecommitdiffstats
path: root/examples/alconvolve.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/alconvolve.c
parentd2970443dde92a85237574abaa7e318785d2db97 (diff)
Support B-Format sounds in the examples
Diffstat (limited to 'examples/alconvolve.c')
-rw-r--r--examples/alconvolve.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/alconvolve.c b/examples/alconvolve.c
index b3d6c4dd..d719abdb 100644
--- a/examples/alconvolve.c
+++ b/examples/alconvolve.c
@@ -159,13 +159,24 @@ static int OpenPlayerFile(StreamPlayer *player, const char *filename)
return 0;
}
+ player->format = AL_NONE;
if(player->sfinfo.channels == 1)
player->format = AL_FORMAT_MONO_FLOAT32;
else if(player->sfinfo.channels == 2)
player->format = AL_FORMAT_STEREO_FLOAT32;
else if(player->sfinfo.channels == 6)
player->format = AL_FORMAT_51CHN32;
- else
+ else if(player->sfinfo.channels == 3)
+ {
+ if(sf_command(player->sndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT)
+ player->format = AL_FORMAT_BFORMAT2D_FLOAT32;
+ }
+ else if(player->sfinfo.channels == 4)
+ {
+ if(sf_command(player->sndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT)
+ player->format = AL_FORMAT_BFORMAT3D_FLOAT32;
+ }
+ if(!player->format)
{
fprintf(stderr, "Unsupported channel count: %d\n", player->sfinfo.channels);
sf_close(player->sndfile);