summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-09-21 09:43:35 -0700
committerChris Robinson <[email protected]>2010-09-21 09:43:35 -0700
commit2d4453968d67af5cfee81c09adcc7b1ac6bd03f6 (patch)
tree1fb67bd30f2b630d10c397707e863c76f9292082
parenta2580a85a82bdfdd25f71e17fe233ec5beaac2e0 (diff)
Implement AL_SOFT_buffer_sub_data using the current AL_EXT_buffer_sub_data spec
This extension can be useful for some applications, but a full EXT version may not be ready for some time. Using the SOFT moniker will help differentiate it in case changes need to be done for the EXT version.
-rw-r--r--Alc/ALc.c4
-rw-r--r--OpenAL32/alBuffer.c9
-rw-r--r--OpenAL32/alExtension.c2
-rw-r--r--OpenAL32/alSource.c12
-rw-r--r--include/AL/alext.h10
5 files changed, 28 insertions, 9 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index d05bbebc..f8c13a8a 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -236,6 +236,8 @@ static const ALCfunction alcFunctions[] = {
{ "alBufferSubDataEXT", (ALCvoid *) alBufferSubDataEXT },
+ { "alBufferSubDataSOFT", (ALCvoid *) alBufferSubDataSOFT },
+
{ "alGenDatabuffersEXT", (ALCvoid *) alGenDatabuffersEXT },
{ "alDeleteDatabuffersEXT", (ALCvoid *) alDeleteDatabuffersEXT },
{ "alIsDatabufferEXT", (ALCvoid *) alIsDatabufferEXT },
@@ -360,7 +362,7 @@ static const ALchar alExtList[] =
"AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXTX_loop_points "
"AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET "
"AL_EXTX_sample_buffer_object AL_EXT_source_distance_model "
- "AL_LOKI_quadriphonic";
+ "AL_LOKI_quadriphonic AL_SOFT_buffer_sub_data";
// Mixing Priority Level
static ALint RTPrioLevel;
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 2ffa13e6..6ea11cdd 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -547,11 +547,11 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
}
/*
-* alBufferSubDataEXT(ALuint buffer,ALenum format,ALvoid *data,ALsizei offset,ALsizei length)
+* alBufferSubDataSOFT(ALuint buffer,ALenum format,ALvoid *data,ALsizei offset,ALsizei length)
*
* Fill buffer with audio data
*/
-AL_API ALvoid AL_APIENTRY alBufferSubDataEXT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length)
+AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length)
{
ALCcontext *Context;
ALCdevice *device;
@@ -675,6 +675,11 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataEXT(ALuint buffer,ALenum format,const A
ProcessContext(Context);
}
+AL_API ALvoid AL_APIENTRY alBufferSubDataEXT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length)
+{
+ alBufferSubDataSOFT(buffer, format, data, offset, length);
+}
+
AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum eParam, ALfloat flValue)
{
diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c
index 15b8c0e2..0febf225 100644
--- a/OpenAL32/alExtension.c
+++ b/OpenAL32/alExtension.c
@@ -68,7 +68,9 @@ static const ALenums enumeration[] = {
{ "AL_MAX_DISTANCE", AL_MAX_DISTANCE },
{ "AL_SEC_OFFSET", AL_SEC_OFFSET },
{ "AL_SAMPLE_OFFSET", AL_SAMPLE_OFFSET },
+ { "AL_SAMPLE_RW_OFFSETS_SOFT", AL_SAMPLE_RW_OFFSETS_SOFT },
{ "AL_BYTE_OFFSET", AL_BYTE_OFFSET },
+ { "AL_BYTE_RW_OFFSETS_SOFT", AL_BYTE_RW_OFFSETS_SOFT },
{ "AL_SOURCE_TYPE", AL_SOURCE_TYPE },
{ "AL_STATIC", AL_STATIC },
{ "AL_STREAMING", AL_STREAMING },
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 21a4a6eb..c9051793 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1012,8 +1012,8 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum eParam, ALfloat *p
alGetSource3f(source, eParam, pflValues+0, pflValues+1, pflValues+2);
break;
- case AL_SAMPLE_RW_OFFSETS_EXT:
- case AL_BYTE_RW_OFFSETS_EXT:
+ case AL_SAMPLE_RW_OFFSETS_SOFT:
+ case AL_BYTE_RW_OFFSETS_SOFT:
updateLen = (ALdouble)pContext->Device->UpdateSize /
pContext->Device->Frequency;
GetSourceOffset(Source, eParam, Offsets, updateLen);
@@ -1248,8 +1248,8 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum eParam, ALint* plVal
alGetSource3i(source, eParam, plValues+0, plValues+1, plValues+2);
break;
- case AL_SAMPLE_RW_OFFSETS_EXT:
- case AL_BYTE_RW_OFFSETS_EXT:
+ case AL_SAMPLE_RW_OFFSETS_SOFT:
+ case AL_BYTE_RW_OFFSETS_SOFT:
updateLen = (ALdouble)pContext->Device->UpdateSize /
pContext->Device->Frequency;
GetSourceOffset(Source, eParam, Offsets, updateLen);
@@ -1873,12 +1873,12 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A
offset[1] = (ALdouble)writePos / (Channels * Bytes * BufferFreq);
break;
case AL_SAMPLE_OFFSET:
- case AL_SAMPLE_RW_OFFSETS_EXT:
+ case AL_SAMPLE_RW_OFFSETS_SOFT:
offset[0] = (ALdouble)(readPos / (Channels * Bytes));
offset[1] = (ALdouble)(writePos / (Channels * Bytes));
break;
case AL_BYTE_OFFSET:
- case AL_BYTE_RW_OFFSETS_EXT:
+ case AL_BYTE_RW_OFFSETS_SOFT:
// Take into account the original format of the Buffer
if((OriginalFormat == AL_FORMAT_MONO_IMA4) ||
(OriginalFormat == AL_FORMAT_STEREO_IMA4))
diff --git a/include/AL/alext.h b/include/AL/alext.h
index eadc715d..c78b8c36 100644
--- a/include/AL/alext.h
+++ b/include/AL/alext.h
@@ -143,6 +143,16 @@ ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
#define AL_SOURCE_DISTANCE_MODEL 0x200
#endif
+#ifndef AL_SOFT_buffer_sub_data
+#define AL_SOFT_buffer_sub_data 1
+#define AL_BYTE_RW_OFFSETS_SOFT 0x1031
+#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
+typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
+#ifdef AL_ALEXT_PROTOTYPES
+AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
+#endif
+#endif
+
#ifdef __cplusplus
}
#endif