aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alBuffer.h16
-rw-r--r--OpenAL32/alBuffer.c51
-rw-r--r--OpenAL32/alSource.c18
3 files changed, 42 insertions, 43 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h
index c3835f97..1347eebd 100644
--- a/OpenAL32/Include/alBuffer.h
+++ b/OpenAL32/Include/alBuffer.h
@@ -77,9 +77,9 @@ enum FmtChannels {
FmtStereo,
FmtRear,
FmtQuad,
- Fmt51ChanWFX,
- Fmt61ChanWFX,
- Fmt71ChanWFX,
+ FmtX51,
+ FmtX61,
+ FmtX71,
};
void DecomposeFormat(ALenum format, enum FmtType *type, enum FmtChannels *order);
@@ -103,9 +103,9 @@ static __inline ALuint ChannelsFromFmt(enum FmtChannels chans)
case FmtStereo: return 2;
case FmtRear: return 2;
case FmtQuad: return 4;
- case Fmt51ChanWFX: return 6;
- case Fmt61ChanWFX: return 7;
- case Fmt71ChanWFX: return 8;
+ case FmtX51: return 6;
+ case FmtX61: return 7;
+ case FmtX71: return 8;
}
return 0;
}
@@ -120,11 +120,11 @@ typedef struct ALbuffer
ALvoid *data;
ALsizei size;
- ALsizei frequency;
+ ALsizei Frequency;
enum FmtType FmtType;
enum FmtChannels FmtChannels;
- ALenum eOriginalFormat;
+ ALenum OriginalFormat;
ALsizei OriginalSize;
ALsizei OriginalAlign;
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index db705977..de79d8e4 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -371,19 +371,19 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
if(temp)
{
ALBuf->data = temp;
+ ALBuf->size = newsize;
+
ConvertDataIMA4(ALBuf->data, data, Channels, newsize/(65*Channels*NewBytes));
- ALBuf->eOriginalFormat = format;
- ALBuf->size = newsize;
- ALBuf->frequency = freq;
+ ALBuf->Frequency = freq;
+ DecomposeFormat(NewFormat, &ALBuf->FmtType, &ALBuf->FmtChannels);
ALBuf->LoopStart = 0;
ALBuf->LoopEnd = newsize / Channels / NewBytes;
- DecomposeFormat(NewFormat, &ALBuf->FmtType, &ALBuf->FmtChannels);
-
- ALBuf->OriginalSize = size;
- ALBuf->OriginalAlign = 36 * Channels;
+ ALBuf->OriginalFormat = format;
+ ALBuf->OriginalSize = size;
+ ALBuf->OriginalAlign = 36 * Channels;
}
else
alSetError(Context, AL_OUT_OF_MEMORY);
@@ -431,7 +431,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const
alSetError(Context, AL_INVALID_NAME);
else if(length < 0 || offset < 0 || (length > 0 && data == NULL))
alSetError(Context, AL_INVALID_VALUE);
- else if(ALBuf->eOriginalFormat != format)
+ else if(ALBuf->OriginalFormat != format)
alSetError(Context, AL_INVALID_ENUM);
else if(offset > ALBuf->OriginalSize ||
length > ALBuf->OriginalSize-offset ||
@@ -801,7 +801,7 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum eParam, ALint *plVa
switch(eParam)
{
case AL_FREQUENCY:
- *plValue = pBuffer->frequency;
+ *plValue = pBuffer->Frequency;
break;
case AL_BITS:
@@ -1212,6 +1212,7 @@ static ALenum LoadData(ALbuffer *ALBuf, const ALvoid *data, ALsizei size, ALuint
temp = realloc(ALBuf->data, newsize);
if(!temp) return AL_OUT_OF_MEMORY;
ALBuf->data = temp;
+ ALBuf->size = newsize;
if(data != NULL)
{
@@ -1219,18 +1220,16 @@ static ALenum LoadData(ALbuffer *ALBuf, const ALvoid *data, ALsizei size, ALuint
ConvertData(ALBuf->data, DstType, data, SrcType, newsize/NewBytes);
}
- ALBuf->eOriginalFormat = OrigFormat;
- ALBuf->size = newsize;
- ALBuf->frequency = freq;
+ ALBuf->Frequency = freq;
+ ALBuf->FmtType = DstType;
+ ALBuf->FmtChannels = DstChannels;
ALBuf->LoopStart = 0;
ALBuf->LoopEnd = newsize / NewChannels / NewBytes;
- ALBuf->FmtType = DstType;
- ALBuf->FmtChannels = DstChannels;
-
- ALBuf->OriginalSize = size;
- ALBuf->OriginalAlign = OrigBytes * OrigChannels;
+ ALBuf->OriginalFormat = OrigFormat;
+ ALBuf->OriginalSize = size;
+ ALBuf->OriginalAlign = OrigBytes * OrigChannels;
return AL_NO_ERROR;
}
@@ -1455,39 +1454,39 @@ void DecomposeFormat(ALenum format, enum FmtType *type, enum FmtChannels *order)
break;
case AL_FORMAT_51CHN8:
*type = FmtUByte;
- *order = Fmt51ChanWFX;
+ *order = FmtX51;
break;
case AL_FORMAT_51CHN16:
*type = FmtShort;
- *order = Fmt51ChanWFX;
+ *order = FmtX51;
break;
case AL_FORMAT_51CHN32:
*type = FmtFloat;
- *order = Fmt51ChanWFX;
+ *order = FmtX51;
break;
case AL_FORMAT_61CHN8:
*type = FmtUByte;
- *order = Fmt61ChanWFX;
+ *order = FmtX61;
break;
case AL_FORMAT_61CHN16:
*type = FmtShort;
- *order = Fmt61ChanWFX;
+ *order = FmtX61;
break;
case AL_FORMAT_61CHN32:
*type = FmtFloat;
- *order = Fmt61ChanWFX;
+ *order = FmtX61;
break;
case AL_FORMAT_71CHN8:
*type = FmtUByte;
- *order = Fmt71ChanWFX;
+ *order = FmtX71;
break;
case AL_FORMAT_71CHN16:
*type = FmtShort;
- *order = Fmt71ChanWFX;
+ *order = FmtX71;
break;
case AL_FORMAT_71CHN32:
*type = FmtFloat;
- *order = Fmt71ChanWFX;
+ *order = FmtX71;
break;
default:
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 34d33a38..fd258872 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1572,8 +1572,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
{
if(BufferList->buffer)
{
- Frequency = BufferList->buffer->frequency;
- Format = BufferList->buffer->eOriginalFormat;
+ Frequency = BufferList->buffer->Frequency;
+ Format = BufferList->buffer->OriginalFormat;
break;
}
BufferList = BufferList->next;
@@ -1592,8 +1592,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
if(Frequency == -1 && Format == -1)
{
- Frequency = buffer->frequency;
- Format = buffer->eOriginalFormat;
+ Frequency = buffer->Frequency;
+ Format = buffer->OriginalFormat;
if(buffer->FmtChannels == FmtMono)
Source->Update = CalcSourceParams;
@@ -1602,7 +1602,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
Source->NeedsUpdate = AL_TRUE;
}
- else if(Frequency != buffer->frequency || Format != buffer->eOriginalFormat)
+ else if(Frequency != buffer->Frequency || Format != buffer->OriginalFormat)
{
alSetError(Context, AL_INVALID_OPERATION);
goto done;
@@ -1817,8 +1817,8 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A
}
// Get Current Buffer Size and frequency (in milliseconds)
- BufferFreq = (ALfloat)Buffer->frequency;
- OriginalFormat = Buffer->eOriginalFormat;
+ BufferFreq = (ALfloat)Buffer->Frequency;
+ OriginalFormat = Buffer->OriginalFormat;
Channels = ChannelsFromFmt(Buffer->FmtChannels);
Bytes = BytesFromFmt(Buffer->FmtType);
@@ -1994,7 +1994,7 @@ static ALint GetByteOffset(ALsource *Source)
{
case AL_BYTE_OFFSET:
// Take into consideration the original format
- ByteOffset = FramesFromBytes(Source->lOffset, Buffer->eOriginalFormat);
+ ByteOffset = FramesFromBytes(Source->lOffset, Buffer->OriginalFormat);
ByteOffset *= FrameSizeFromFmt(Buffer->FmtType, Buffer->FmtChannels);
break;
@@ -2004,7 +2004,7 @@ static ALint GetByteOffset(ALsource *Source)
case AL_SEC_OFFSET:
// Note - lOffset is internally stored as Milliseconds
- ByteOffset = (ALint)(Source->lOffset / 1000.0 * Buffer->frequency);
+ ByteOffset = (ALint)(Source->lOffset / 1000.0 * Buffer->Frequency);
ByteOffset *= BytesFromFmt(Buffer->FmtType);
break;
}