aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/alconvolve.c13
-rw-r--r--examples/alhrtf.c13
-rw-r--r--examples/allatency.c13
-rw-r--r--examples/alplay.c14
-rw-r--r--examples/alreverb.c14
-rw-r--r--examples/alstream.c13
-rw-r--r--examples/alstreamcb.cpp13
7 files changed, 86 insertions, 7 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);
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);
diff --git a/examples/allatency.c b/examples/allatency.c
index 7ece01eb..5aa9e864 100644
--- a/examples/allatency.c
+++ b/examples/allatency.c
@@ -79,11 +79,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);
diff --git a/examples/alplay.c b/examples/alplay.c
index 70314d47..56d5434b 100644
--- a/examples/alplay.c
+++ b/examples/alplay.c
@@ -33,6 +33,7 @@
#include "sndfile.h"
#include "AL/al.h"
+#include "AL/alext.h"
#include "common/alhelpers.h"
@@ -65,11 +66,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);
diff --git a/examples/alreverb.c b/examples/alreverb.c
index 1f30a450..56acdd82 100644
--- a/examples/alreverb.c
+++ b/examples/alreverb.c
@@ -34,6 +34,7 @@
#include "AL/al.h"
#include "AL/alc.h"
+#include "AL/alext.h"
#include "AL/efx.h"
#include "AL/efx-presets.h"
@@ -173,11 +174,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);
diff --git a/examples/alstream.c b/examples/alstream.c
index 69be236a..2e427a32 100644
--- a/examples/alstream.c
+++ b/examples/alstream.c
@@ -33,6 +33,7 @@
#include "sndfile.h"
#include "AL/al.h"
+#include "AL/alext.h"
#include "common/alhelpers.h"
@@ -128,7 +129,17 @@ static int OpenPlayerFile(StreamPlayer *player, const char *filename)
player->format = AL_FORMAT_MONO16;
else if(player->sfinfo.channels == 2)
player->format = AL_FORMAT_STEREO16;
- 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_16;
+ }
+ 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_16;
+ }
+ if(!player->format)
{
fprintf(stderr, "Unsupported channel count: %d\n", player->sfinfo.channels);
sf_close(player->sndfile);
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);