From 04fd50bcdf322e23c8e402e1fe74a5e2436f4388 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 22 Sep 2020 11:36:43 -0700 Subject: Support B-Format sounds in the examples --- examples/alstreamcb.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'examples/alstreamcb.cpp') diff --git a/examples/alstreamcb.cpp b/examples/alstreamcb.cpp index 8fb1f102..814e2214 100644 --- a/examples/alstreamcb.cpp +++ b/examples/alstreamcb.cpp @@ -40,6 +40,7 @@ #include "AL/al.h" #include "AL/alc.h" +#include "AL/alext.h" #include "common/alhelpers.h" @@ -132,7 +133,17 @@ struct StreamPlayer { mFormat = AL_FORMAT_MONO16; else if(mSfInfo.channels == 2) mFormat = AL_FORMAT_STEREO16; - else + else if(mSfInfo.channels == 3) + { + if(sf_command(mSndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT) + mFormat = AL_FORMAT_BFORMAT2D_16; + } + else if(mSfInfo.channels == 4) + { + if(sf_command(mSndfile, SFC_WAVEX_GET_AMBISONIC, NULL, 0) == SF_AMBISONIC_B_FORMAT) + mFormat = AL_FORMAT_BFORMAT3D_16; + } + if(!mFormat) { fprintf(stderr, "Unsupported channel count: %d\n", mSfInfo.channels); sf_close(mSndfile); -- cgit v1.2.3