Support 64-bit double buffers directly
This commit is contained in:
parent
4689ffb72d
commit
2a123a4760
42
Alc/mixer.c
42
Alc/mixer.c
@ -37,6 +37,14 @@
|
||||
#include "bs2b.h"
|
||||
|
||||
|
||||
static __inline ALdouble point64(const ALdouble *vals, ALint step, ALint frac)
|
||||
{ return vals[0]; (void)step; (void)frac; }
|
||||
static __inline ALdouble lerp64(const ALdouble *vals, ALint step, ALint frac)
|
||||
{ return lerp(vals[0], vals[step], frac * (1.0/FRACTIONONE)); }
|
||||
static __inline ALdouble cubic64(const ALdouble *vals, ALint step, ALint frac)
|
||||
{ return cubic(vals[-step], vals[0], vals[step], vals[step+step],
|
||||
frac * (1.0/FRACTIONONE)); }
|
||||
|
||||
static __inline ALdouble point32(const ALfloat *vals, ALint step, ALint frac)
|
||||
{ return vals[0]; (void)step; (void)frac; }
|
||||
static __inline ALdouble lerp32(const ALfloat *vals, ALint step, ALint frac)
|
||||
@ -195,6 +203,10 @@ static void Mix_##T##_Mono_##sampler(ALsource *Source, ALCdevice *Device, \
|
||||
*DataPosFrac = frac; \
|
||||
}
|
||||
|
||||
DECL_TEMPLATE(ALdouble, point64)
|
||||
DECL_TEMPLATE(ALdouble, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, point32)
|
||||
DECL_TEMPLATE(ALfloat, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, cubic32)
|
||||
@ -348,6 +360,10 @@ static void Mix_##T##_Stereo_##sampler(ALsource *Source, ALCdevice *Device, \
|
||||
*DataPosFrac = frac; \
|
||||
}
|
||||
|
||||
DECL_TEMPLATE(ALdouble, point64)
|
||||
DECL_TEMPLATE(ALdouble, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, point32)
|
||||
DECL_TEMPLATE(ALfloat, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, cubic32)
|
||||
@ -492,6 +508,10 @@ static void Mix_##T##_##chans##_##sampler(ALsource *Source, ALCdevice *Device,\
|
||||
|
||||
static const Channel QuadChans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
BACK_LEFT, BACK_RIGHT };
|
||||
DECL_TEMPLATE(ALdouble, QuadChans, point64)
|
||||
DECL_TEMPLATE(ALdouble, QuadChans, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, QuadChans, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, QuadChans, point32)
|
||||
DECL_TEMPLATE(ALfloat, QuadChans, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, QuadChans, cubic32)
|
||||
@ -508,6 +528,10 @@ DECL_TEMPLATE(ALubyte, QuadChans, cubic8)
|
||||
static const Channel X51Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
FRONT_CENTER, LFE,
|
||||
BACK_LEFT, BACK_RIGHT };
|
||||
DECL_TEMPLATE(ALdouble, X51Chans, point64)
|
||||
DECL_TEMPLATE(ALdouble, X51Chans, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, X51Chans, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, X51Chans, point32)
|
||||
DECL_TEMPLATE(ALfloat, X51Chans, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, X51Chans, cubic32)
|
||||
@ -525,6 +549,10 @@ static const Channel X61Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
FRONT_CENTER, LFE,
|
||||
BACK_CENTER,
|
||||
SIDE_LEFT, SIDE_RIGHT };
|
||||
DECL_TEMPLATE(ALdouble, X61Chans, point64)
|
||||
DECL_TEMPLATE(ALdouble, X61Chans, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, X61Chans, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, X61Chans, point32)
|
||||
DECL_TEMPLATE(ALfloat, X61Chans, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, X61Chans, cubic32)
|
||||
@ -542,6 +570,10 @@ static const Channel X71Chans[] = { FRONT_LEFT, FRONT_RIGHT,
|
||||
FRONT_CENTER, LFE,
|
||||
BACK_LEFT, BACK_RIGHT,
|
||||
SIDE_LEFT, SIDE_RIGHT };
|
||||
DECL_TEMPLATE(ALdouble, X71Chans, point64)
|
||||
DECL_TEMPLATE(ALdouble, X71Chans, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, X71Chans, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, X71Chans, point32)
|
||||
DECL_TEMPLATE(ALfloat, X71Chans, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, X71Chans, cubic32)
|
||||
@ -598,6 +630,10 @@ static void Mix_##T##_##sampler(ALsource *Source, ALCdevice *Device, \
|
||||
} \
|
||||
}
|
||||
|
||||
DECL_TEMPLATE(ALdouble, point64)
|
||||
DECL_TEMPLATE(ALdouble, lerp64)
|
||||
DECL_TEMPLATE(ALdouble, cubic64)
|
||||
|
||||
DECL_TEMPLATE(ALfloat, point32)
|
||||
DECL_TEMPLATE(ALfloat, lerp32)
|
||||
DECL_TEMPLATE(ALfloat, cubic32)
|
||||
@ -637,6 +673,12 @@ static void Mix_##sampler(ALsource *Source, ALCdevice *Device, \
|
||||
Mix_ALfloat_##sampler##32(Source, Device, FmtChannels, \
|
||||
Data, DataPosInt, DataPosFrac, \
|
||||
OutPos, SamplesToDo, BufferSize); \
|
||||
break; \
|
||||
\
|
||||
case FmtDouble: \
|
||||
Mix_ALdouble_##sampler##64(Source, Device, FmtChannels, \
|
||||
Data, DataPosInt, DataPosFrac, \
|
||||
OutPos, SamplesToDo, BufferSize); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ enum FmtType {
|
||||
FmtUByte,
|
||||
FmtShort,
|
||||
FmtFloat,
|
||||
FmtDouble,
|
||||
};
|
||||
|
||||
enum FmtChannels {
|
||||
|
@ -287,9 +287,11 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
|
||||
case AL_FORMAT_MONO8:
|
||||
case AL_FORMAT_MONO16:
|
||||
case AL_FORMAT_MONO_FLOAT32:
|
||||
case AL_FORMAT_MONO_DOUBLE_EXT:
|
||||
case AL_FORMAT_STEREO8:
|
||||
case AL_FORMAT_STEREO16:
|
||||
case AL_FORMAT_STEREO_FLOAT32:
|
||||
case AL_FORMAT_STEREO_DOUBLE_EXT:
|
||||
case AL_FORMAT_QUAD8_LOKI:
|
||||
case AL_FORMAT_QUAD16_LOKI:
|
||||
case AL_FORMAT_QUAD8:
|
||||
@ -309,17 +311,6 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
|
||||
alSetError(Context, err);
|
||||
break;
|
||||
|
||||
case AL_FORMAT_MONO_DOUBLE_EXT:
|
||||
err = LoadData(ALBuf, data, size, freq, format, AL_FORMAT_MONO_FLOAT32);
|
||||
if(err != AL_NO_ERROR)
|
||||
alSetError(Context, err);
|
||||
break;
|
||||
case AL_FORMAT_STEREO_DOUBLE_EXT:
|
||||
err = LoadData(ALBuf, data, size, freq, format, AL_FORMAT_STEREO_FLOAT32);
|
||||
if(err != AL_NO_ERROR)
|
||||
alSetError(Context, err);
|
||||
break;
|
||||
|
||||
case AL_FORMAT_REAR8:
|
||||
case AL_FORMAT_REAR16:
|
||||
case AL_FORMAT_REAR32: {
|
||||
@ -1064,11 +1055,7 @@ static ALenum LoadData(ALbuffer *ALBuf, const ALvoid *data, ALsizei size, ALuint
|
||||
ALvoid *temp;
|
||||
|
||||
assert(NewChannels == OrigChannels);
|
||||
assert(NewBytes == 4 || NewBytes == 2 || NewBytes == 1);
|
||||
if(OrigBytes == 8)
|
||||
assert(NewBytes == 4);
|
||||
else
|
||||
assert(NewBytes == OrigBytes);
|
||||
assert(NewBytes == OrigBytes);
|
||||
|
||||
if((size%(OrigBytes*OrigChannels)) != 0)
|
||||
return AL_INVALID_VALUE;
|
||||
@ -1125,7 +1112,7 @@ static void ConvertData(ALvoid *dst, const ALvoid *src, ALint origBytes, ALsizei
|
||||
|
||||
case 8:
|
||||
for(i = 0;i < len;i++)
|
||||
((ALfloat*)dst)[i] = ((ALdouble*)src)[i];
|
||||
((ALdouble*)dst)[i] = ((ALdouble*)src)[i];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user