From 3556da0d022dca2a65ed7d1fe736855fac728c95 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 25 Apr 2016 18:56:59 -0700 Subject: Start AL_SOFT_buffer_samples2 as a replacement for AL_SOFT_buffer_samples --- Alc/ALc.c | 30 ++++++++++++++----- OpenAL32/Include/alBuffer.h | 22 +++++++------- OpenAL32/Include/alMain.h | 73 +++++++++++++++++++++++++++++++++++++++++++++ OpenAL32/alBuffer.c | 15 ++++++---- 4 files changed, 115 insertions(+), 25 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index d9cf4e69..ae678b19 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -288,6 +288,10 @@ static const ALCfunction alcFunctions[] = { DECL(alGetSource3i64SOFT), DECL(alGetSourcei64vSOFT), + DECL(alBufferSamplesSOFT), + DECL(alGetBufferSamplesSOFT), + DECL(alIsBufferFormatSupportedSOFT), + { NULL, NULL } }; #undef DECL @@ -452,6 +456,15 @@ static const ALCenums enumeration[] = { DECL(AL_FORMAT_MONO_ALAW_EXT), DECL(AL_FORMAT_STEREO_ALAW_EXT), + DECL(AL_FORMAT_BFORMAT2D_8), + DECL(AL_FORMAT_BFORMAT2D_16), + DECL(AL_FORMAT_BFORMAT2D_FLOAT32), + DECL(AL_FORMAT_BFORMAT2D_MULAW), + DECL(AL_FORMAT_BFORMAT3D_8), + DECL(AL_FORMAT_BFORMAT3D_16), + DECL(AL_FORMAT_BFORMAT3D_FLOAT32), + DECL(AL_FORMAT_BFORMAT3D_MULAW), + DECL(AL_MONO8_SOFT), DECL(AL_MONO16_SOFT), DECL(AL_MONO32F_SOFT), @@ -473,14 +486,12 @@ static const ALCenums enumeration[] = { DECL(AL_7POINT1_8_SOFT), DECL(AL_7POINT1_16_SOFT), DECL(AL_7POINT1_32F_SOFT), - DECL(AL_FORMAT_BFORMAT2D_8), - DECL(AL_FORMAT_BFORMAT2D_16), - DECL(AL_FORMAT_BFORMAT2D_FLOAT32), - DECL(AL_FORMAT_BFORMAT2D_MULAW), - DECL(AL_FORMAT_BFORMAT3D_8), - DECL(AL_FORMAT_BFORMAT3D_16), - DECL(AL_FORMAT_BFORMAT3D_FLOAT32), - DECL(AL_FORMAT_BFORMAT3D_MULAW), + DECL(AL_BFORMAT2D_8_SOFT), + DECL(AL_BFORMAT2D_16_SOFT), + DECL(AL_BFORMAT2D_32F_SOFT), + DECL(AL_BFORMAT3D_8_SOFT), + DECL(AL_BFORMAT3D_16_SOFT), + DECL(AL_BFORMAT3D_32F_SOFT), DECL(AL_MONO_SOFT), DECL(AL_STEREO_SOFT), @@ -489,6 +500,8 @@ static const ALCenums enumeration[] = { DECL(AL_5POINT1_SOFT), DECL(AL_6POINT1_SOFT), DECL(AL_7POINT1_SOFT), + DECL(AL_BFORMAT2D_SOFT), + DECL(AL_BFORMAT3D_SOFT), DECL(AL_BYTE_SOFT), DECL(AL_UNSIGNED_BYTE_SOFT), @@ -500,6 +513,7 @@ static const ALCenums enumeration[] = { DECL(AL_DOUBLE_SOFT), DECL(AL_BYTE3_SOFT), DECL(AL_UNSIGNED_BYTE3_SOFT), + DECL(AL_MULAW_SOFT), DECL(AL_FREQUENCY), DECL(AL_BITS), diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index dd046da8..71fe7e30 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -19,21 +19,21 @@ enum UserFmtType { UserFmtDouble = AL_DOUBLE_SOFT, UserFmtByte3 = AL_BYTE3_SOFT, UserFmtUByte3 = AL_UNSIGNED_BYTE3_SOFT, - UserFmtMulaw, - UserFmtAlaw, + UserFmtMulaw = AL_MULAW_SOFT, + UserFmtAlaw = 0x10000000, UserFmtIMA4, UserFmtMSADPCM, }; enum UserFmtChannels { - UserFmtMono = AL_MONO_SOFT, - UserFmtStereo = AL_STEREO_SOFT, - UserFmtRear = AL_REAR_SOFT, - UserFmtQuad = AL_QUAD_SOFT, - UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */ - UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */ - UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */ - UserFmtBFormat2D = 0x10000000, /* WXY */ - UserFmtBFormat3D, /* WXYZ */ + UserFmtMono = AL_MONO_SOFT, + UserFmtStereo = AL_STEREO_SOFT, + UserFmtRear = AL_REAR_SOFT, + UserFmtQuad = AL_QUAD_SOFT, + UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */ + UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */ + UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */ + UserFmtBFormat2D = AL_BFORMAT2D_SOFT, /* WXY */ + UserFmtBFormat3D = AL_BFORMAT3D_SOFT, /* WXYZ */ }; ALuint BytesFromUserFmt(enum UserFmtType type) DECL_CONST; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index fba9c012..e3f272df 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -51,6 +51,79 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, #endif #endif +#ifndef AL_SOFT_buffer_samples2 +#define AL_SOFT_buffer_samples2 1 +/* Channel configurations */ +#define AL_MONO_SOFT 0x1500 +#define AL_STEREO_SOFT 0x1501 +#define AL_REAR_SOFT 0x1502 +#define AL_QUAD_SOFT 0x1503 +#define AL_5POINT1_SOFT 0x1504 +#define AL_6POINT1_SOFT 0x1505 +#define AL_7POINT1_SOFT 0x1506 +#define AL_BFORMAT2D_SOFT 0x1507 +#define AL_BFORMAT3D_SOFT 0x1508 + +/* Sample types */ +#define AL_BYTE_SOFT 0x1400 +#define AL_UNSIGNED_BYTE_SOFT 0x1401 +#define AL_SHORT_SOFT 0x1402 +#define AL_UNSIGNED_SHORT_SOFT 0x1403 +#define AL_INT_SOFT 0x1404 +#define AL_UNSIGNED_INT_SOFT 0x1405 +#define AL_FLOAT_SOFT 0x1406 +#define AL_DOUBLE_SOFT 0x1407 +#define AL_BYTE3_SOFT 0x1408 +#define AL_UNSIGNED_BYTE3_SOFT 0x1409 +#define AL_MULAW_SOFT 0x140A + +/* Storage formats */ +#define AL_MONO8_SOFT 0x1100 +#define AL_MONO16_SOFT 0x1101 +#define AL_MONO32F_SOFT 0x10010 +#define AL_STEREO8_SOFT 0x1102 +#define AL_STEREO16_SOFT 0x1103 +#define AL_STEREO32F_SOFT 0x10011 +#define AL_QUAD8_SOFT 0x1204 +#define AL_QUAD16_SOFT 0x1205 +#define AL_QUAD32F_SOFT 0x1206 +#define AL_REAR8_SOFT 0x1207 +#define AL_REAR16_SOFT 0x1208 +#define AL_REAR32F_SOFT 0x1209 +#define AL_5POINT1_8_SOFT 0x120A +#define AL_5POINT1_16_SOFT 0x120B +#define AL_5POINT1_32F_SOFT 0x120C +#define AL_6POINT1_8_SOFT 0x120D +#define AL_6POINT1_16_SOFT 0x120E +#define AL_6POINT1_32F_SOFT 0x120F +#define AL_7POINT1_8_SOFT 0x1210 +#define AL_7POINT1_16_SOFT 0x1211 +#define AL_7POINT1_32F_SOFT 0x1212 +#define AL_BFORMAT2D_8_SOFT 0x20021 +#define AL_BFORMAT2D_16_SOFT 0x20022 +#define AL_BFORMAT2D_32F_SOFT 0x20023 +#define AL_BFORMAT3D_8_SOFT 0x20031 +#define AL_BFORMAT3D_16_SOFT 0x20032 +#define AL_BFORMAT3D_32F_SOFT 0x20033 + +/* Buffer attributes */ +#define AL_INTERNAL_FORMAT_SOFT 0x2008 +#define AL_BYTE_LENGTH_SOFT 0x2009 +#define AL_SAMPLE_LENGTH_SOFT 0x200A +#define AL_SEC_LENGTH_SOFT 0x200B + +#if 0 +typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*); +typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*); +typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum); +#ifdef AL_ALEXT_PROTOTYPES +AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data); +AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data); +AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format); +#endif +#endif +#endif + typedef ALint64SOFT ALint64; typedef ALuint64SOFT ALuint64; diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 904fd61d..c5c9ea21 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1201,13 +1201,13 @@ static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum Fm { AL_7POINT1_16_SOFT, FmtX71, FmtShort }, { AL_7POINT1_32F_SOFT, FmtX71, FmtFloat }, - { AL_FORMAT_BFORMAT2D_8, FmtBFormat2D, FmtByte }, - { AL_FORMAT_BFORMAT2D_16, FmtBFormat2D, FmtShort }, - { AL_FORMAT_BFORMAT2D_FLOAT32, FmtBFormat2D, FmtFloat }, + { AL_BFORMAT2D_8_SOFT, FmtBFormat2D, FmtByte }, + { AL_BFORMAT2D_16_SOFT, FmtBFormat2D, FmtShort }, + { AL_BFORMAT2D_32F_SOFT, FmtBFormat2D, FmtFloat }, - { AL_FORMAT_BFORMAT3D_8, FmtBFormat3D, FmtByte }, - { AL_FORMAT_BFORMAT3D_16, FmtBFormat3D, FmtShort }, - { AL_FORMAT_BFORMAT3D_FLOAT32, FmtBFormat3D, FmtFloat }, + { AL_BFORMAT3D_8_SOFT, FmtBFormat3D, FmtByte }, + { AL_BFORMAT3D_16_SOFT, FmtBFormat3D, FmtShort }, + { AL_BFORMAT3D_32F_SOFT, FmtBFormat3D, FmtFloat }, }; ALuint i; @@ -1277,6 +1277,7 @@ static ALboolean IsValidType(ALenum type) case AL_DOUBLE_SOFT: case AL_BYTE3_SOFT: case AL_UNSIGNED_BYTE3_SOFT: + case AL_MULAW_SOFT: return AL_TRUE; } return AL_FALSE; @@ -1293,6 +1294,8 @@ static ALboolean IsValidChannels(ALenum channels) case AL_5POINT1_SOFT: case AL_6POINT1_SOFT: case AL_7POINT1_SOFT: + case AL_BFORMAT2D_SOFT: + case AL_BFORMAT3D_SOFT: return AL_TRUE; } return AL_FALSE; -- cgit v1.2.3