aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-05-24 06:12:20 -0700
committerChris Robinson <[email protected]>2019-05-24 06:12:20 -0700
commit9c63bbd6ce90146939891f56cb0265e5d65ec846 (patch)
tree8b86fe726dc4dd4ea2d020e61c745657119a3db7
parent1945b50834e2be380e0ad206f9deefacb455191b (diff)
Use raw bytes for the buffer data
-rw-r--r--Alc/mixvoice.cpp14
-rw-r--r--OpenAL32/Include/alBuffer.h3
-rw-r--r--OpenAL32/alBuffer.cpp5
3 files changed, 12 insertions, 10 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index f539f119..5c7ce95d 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -271,17 +271,17 @@ template<> inline ALfloat LoadSample<FmtAlaw>(FmtTypeTraits<FmtAlaw>::Type val)
{ return aLawDecompressionTable[val] * (1.0f/32768.0f); }
template<FmtType T>
-inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, ALint srcstep,
+inline void LoadSampleArray(ALfloat *RESTRICT dst, const al::byte *src, ALint srcstep,
const ptrdiff_t samples)
{
using SampleType = typename FmtTypeTraits<T>::Type;
- const SampleType *ssrc = static_cast<const SampleType*>(src);
+ const SampleType *RESTRICT ssrc{reinterpret_cast<const SampleType*>(src)};
for(ALsizei i{0};i < samples;i++)
dst[i] += LoadSample<T>(ssrc[i*srcstep]);
}
-void LoadSamples(ALfloat *RESTRICT dst, const ALvoid *RESTRICT src, ALint srcstep, FmtType srctype,
+void LoadSamples(ALfloat *RESTRICT dst, const al::byte *src, ALint srcstep, FmtType srctype,
const ptrdiff_t samples)
{
#define HANDLE_FMT(T) case T: LoadSampleArray<T>(dst, src, srcstep, samples); break
@@ -327,7 +327,7 @@ ALfloat *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&B
const ptrdiff_t DataSize{std::min<ptrdiff_t>(SizeToDo, buffer->SampleLen-DataPosInt)};
CompLen = std::max<ptrdiff_t>(CompLen, DataSize);
- const ALbyte *Data{buffer->mData.data()};
+ const al::byte *Data{buffer->mData.data()};
Data += (DataPosInt*NumChannels + chan)*SampleSize;
LoadSamples(SrcData, Data, NumChannels, buffer->mFmtType, DataSize);
@@ -353,7 +353,7 @@ ALfloat *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&B
const ptrdiff_t DataSize{std::min<ptrdiff_t>(SizeToDo, buffer->SampleLen-DataPosInt)};
CompLen = std::max<ptrdiff_t>(CompLen, DataSize);
- const ALbyte *Data{buffer->mData.data()};
+ const al::byte *Data{buffer->mData.data()};
Data += (DataPosInt*NumChannels + chan)*SampleSize;
LoadSamples(SrcData, Data, NumChannels, buffer->mFmtType, DataSize);
@@ -379,7 +379,7 @@ ALfloat *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&B
buffer->SampleLen-LoopStart)};
CompLen = std::max<ptrdiff_t>(CompLen, DataSize);
- const ALbyte *Data{buffer->mData.data()};
+ const al::byte *Data{buffer->mData.data()};
Data += (LoopStart*NumChannels + chan)*SampleSize;
LoadSamples(SrcData, Data, NumChannels, buffer->mFmtType, DataSize);
@@ -418,7 +418,7 @@ ALfloat *LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *Buf
const ptrdiff_t DataSize{std::min<ptrdiff_t>(SizeToDo, buffer->SampleLen-DataPosInt)};
CompLen = std::max<ptrdiff_t>(CompLen, DataSize);
- const ALbyte *Data{buffer->mData.data()};
+ const al::byte *Data{buffer->mData.data()};
Data += (DataPosInt*NumChannels + chan)*SampleSize;
LoadSamples(SrcData, Data, NumChannels, buffer->mFmtType, DataSize);
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h
index ec9f6c37..22e99b99 100644
--- a/OpenAL32/Include/alBuffer.h
+++ b/OpenAL32/Include/alBuffer.h
@@ -8,6 +8,7 @@
#include "inprogext.h"
#include "atomic.h"
#include "vector.h"
+#include "albyte.h"
/* User formats */
@@ -86,7 +87,7 @@ inline ALsizei FrameSizeFromFmt(FmtChannels chans, FmtType type)
struct ALbuffer {
- al::vector<ALbyte,16> mData;
+ al::vector<al::byte,16> mData;
ALsizei Frequency{0};
ALbitfieldSOFT Access{0u};
diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp
index 1dc37ec7..4524f81c 100644
--- a/OpenAL32/alBuffer.cpp
+++ b/OpenAL32/alBuffer.cpp
@@ -288,7 +288,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, U
newsize = (newsize+15) & ~0xf;
if(newsize != ALBuf->BytesAlloc)
{
- al::vector<ALbyte,16> newdata(newsize);
+ al::vector<al::byte,16> newdata(newsize);
if((access&AL_PRESERVE_DATA_BIT_SOFT))
{
ALsizei tocopy{std::min(newsize, ALBuf->BytesAlloc)};
@@ -318,7 +318,8 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, U
{
assert(static_cast<long>(SrcType) == static_cast<long>(DstType));
if(data != nullptr && !ALBuf->mData.empty())
- std::copy_n(static_cast<const ALbyte*>(data), frames*FrameSize, ALBuf->mData.begin());
+ std::copy_n(static_cast<const al::byte*>(data), frames*FrameSize,
+ ALBuf->mData.begin());
ALBuf->OriginalAlign = 1;
}
ALBuf->OriginalSize = size;