aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--al/buffer.cpp14
-rw-r--r--al/buffer.h2
-rw-r--r--core/buffer_storage.h3
3 files changed, 12 insertions, 7 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index c654abd7..c2aafb6f 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -357,16 +357,17 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
* size could cause problems for apps that use AL_SIZE to try to get the
* buffer's play length.
*/
- if(newsize != ALBuf->mData.size())
+ if(newsize != ALBuf->mDataStorage.size())
{
auto newdata = al::vector<al::byte,16>(newsize, al::byte{});
if((access&AL_PRESERVE_DATA_BIT_SOFT))
{
- const size_t tocopy{minz(newdata.size(), ALBuf->mData.size())};
- std::copy_n(ALBuf->mData.begin(), tocopy, newdata.begin());
+ const size_t tocopy{minz(newdata.size(), ALBuf->mDataStorage.size())};
+ std::copy_n(ALBuf->mDataStorage.begin(), tocopy, newdata.begin());
}
- newdata.swap(ALBuf->mData);
+ newdata.swap(ALBuf->mDataStorage);
}
+ ALBuf->mData = ALBuf->mDataStorage;
#ifdef ALSOFT_EAX
eax_x_ram_clear(*context->mALDevice, *ALBuf);
#endif
@@ -425,8 +426,9 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq,
static constexpr size_t line_size{DeviceBase::MixerLineSize*MaxPitch + MaxResamplerEdge};
const size_t line_blocks{(line_size + align-1) / align};
- using BufferVectorType = decltype(ALBuf->mData);
- BufferVectorType(line_blocks*BlockSize).swap(ALBuf->mData);
+ using BufferVectorType = decltype(ALBuf->mDataStorage);
+ BufferVectorType(line_blocks*BlockSize).swap(ALBuf->mDataStorage);
+ ALBuf->mData = ALBuf->mDataStorage;
#ifdef ALSOFT_EAX
eax_x_ram_clear(*context->mALDevice, *ALBuf);
diff --git a/al/buffer.h b/al/buffer.h
index da7da740..64ebe1f3 100644
--- a/al/buffer.h
+++ b/al/buffer.h
@@ -26,7 +26,7 @@ enum class EaxStorage : uint8_t {
struct ALbuffer : public BufferStorage {
ALbitfieldSOFT Access{0u};
- al::vector<al::byte,16> mData;
+ al::vector<al::byte,16> mDataStorage;
ALuint OriginalSize{0};
diff --git a/core/buffer_storage.h b/core/buffer_storage.h
index d1941a48..282d5b53 100644
--- a/core/buffer_storage.h
+++ b/core/buffer_storage.h
@@ -5,6 +5,7 @@
#include "albyte.h"
#include "alnumeric.h"
+#include "alspan.h"
#include "ambidefs.h"
@@ -84,6 +85,8 @@ struct BufferStorage {
CallbackType mCallback{nullptr};
void *mUserData{nullptr};
+ al::span<al::byte> mData;
+
uint mSampleRate{0u};
FmtChannels mChannels{FmtMono};
FmtType mType{FmtShort};