aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/mixer.c5
-rw-r--r--OpenAL32/Include/alBuffer.h11
-rw-r--r--OpenAL32/alBuffer.c26
3 files changed, 13 insertions, 29 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index fe4bcd78..b54e840e 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -202,6 +202,9 @@ static inline ALfloat Sample_ALshort(ALshort val)
static inline ALfloat Sample_ALfloat(ALfloat val)
{ return val; }
+static inline ALfloat Sample_ALdouble(ALdouble val)
+{ return (ALfloat)val; }
+
typedef ALubyte ALmulaw;
static inline ALfloat Sample_ALmulaw(ALmulaw val)
{ return muLawDecompressionTable[val] * (1.0f/32768.0f); }
@@ -222,6 +225,7 @@ static inline void Load_##T(ALfloat *restrict dst, const T *restrict src, \
DECL_TEMPLATE(ALubyte)
DECL_TEMPLATE(ALshort)
DECL_TEMPLATE(ALfloat)
+DECL_TEMPLATE(ALdouble)
DECL_TEMPLATE(ALmulaw)
DECL_TEMPLATE(ALalaw)
@@ -236,6 +240,7 @@ static void LoadSamples(ALfloat *restrict dst, const ALvoid *restrict src, ALint
HANDLE_FMT(FmtUByte, ALubyte);
HANDLE_FMT(FmtShort, ALshort);
HANDLE_FMT(FmtFloat, ALfloat);
+ HANDLE_FMT(FmtDouble, ALdouble);
HANDLE_FMT(FmtMulaw, ALmulaw);
HANDLE_FMT(FmtAlaw, ALalaw);
}
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h
index 35c880c9..5f1e6826 100644
--- a/OpenAL32/Include/alBuffer.h
+++ b/OpenAL32/Include/alBuffer.h
@@ -40,11 +40,12 @@ inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType
/* Storable formats */
enum FmtType {
- FmtUByte = UserFmtUByte,
- FmtShort = UserFmtShort,
- FmtFloat = UserFmtFloat,
- FmtMulaw = UserFmtMulaw,
- FmtAlaw = UserFmtAlaw,
+ FmtUByte = UserFmtUByte,
+ FmtShort = UserFmtShort,
+ FmtFloat = UserFmtFloat,
+ FmtDouble = UserFmtDouble,
+ FmtMulaw = UserFmtMulaw,
+ FmtAlaw = UserFmtAlaw,
};
enum FmtChannels {
FmtMono = UserFmtMono,
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index e0f2160d..e9efd2c8 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -173,6 +173,7 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
case UserFmtUByte:
case UserFmtShort:
case UserFmtFloat:
+ case UserFmtDouble:
case UserFmtMulaw:
case UserFmtAlaw:
framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align;
@@ -186,30 +187,6 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
SET_ERROR_AND_GOTO(context, err, done);
break;
- case UserFmtDouble:
- framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align;
- if((size%framesize) != 0)
- SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
-
- switch(srcchannels)
- {
- case UserFmtMono: newformat = AL_FORMAT_MONO_FLOAT32; break;
- case UserFmtStereo: newformat = AL_FORMAT_STEREO_FLOAT32; break;
- case UserFmtRear: newformat = AL_FORMAT_REAR32; break;
- case UserFmtQuad: newformat = AL_FORMAT_QUAD32; break;
- case UserFmtX51: newformat = AL_FORMAT_51CHN32; break;
- case UserFmtX61: newformat = AL_FORMAT_61CHN32; break;
- case UserFmtX71: newformat = AL_FORMAT_71CHN32; break;
- case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_FLOAT32; break;
- case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_FLOAT32; break;
- }
- err = LoadData(albuf, freq, newformat, size/framesize*align,
- srcchannels, srctype, data, align, format&ACCESS_FLAGS,
- AL_TRUE);
- if(err != AL_NO_ERROR)
- SET_ERROR_AND_GOTO(context, err, done);
- break;
-
case UserFmtIMA4:
framesize = (align-1)/2 + 4;
framesize *= ChannelsFromUserFmt(srcchannels);
@@ -1141,6 +1118,7 @@ ALsizei BytesFromFmt(enum FmtType type)
case FmtUByte: return sizeof(ALubyte);
case FmtShort: return sizeof(ALshort);
case FmtFloat: return sizeof(ALfloat);
+ case FmtDouble: return sizeof(ALdouble);
case FmtMulaw: return sizeof(ALubyte);
case FmtAlaw: return sizeof(ALubyte);
}