From a1442a62414ef12a986bbd239b4079b7c643a453 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 15 Nov 2015 22:40:21 -0800 Subject: [PATCH] Pass the context to ALBuffer::load --- src/buffer.cpp | 6 +++--- src/buffer.h | 3 ++- src/context.cpp | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/buffer.cpp b/src/buffer.cpp index 6af19a9..836eb43 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -31,7 +31,7 @@ void ALBuffer::cleanup() } -void ALBuffer::load(ALuint frames, ALenum format, bool loop_points, SharedPtr decoder, const std::string &name) +void ALBuffer::load(ALuint frames, ALenum format, SharedPtr decoder, const std::string &name, ALContext *ctx) { std::vector data(FramesToBytes(frames, mSampleConfig, mSampleType)); @@ -47,11 +47,11 @@ void ALBuffer::load(ALuint frames, ALenum format, bool loop_points, SharedPtr(loop_pts.first, loop_pts.second-1); } - SharedPtr msg = ALContext::GetCurrent()->getMessageHandler(); + SharedPtr msg = ctx->getMessageHandler(); if(msg.get()) msg->bufferLoading(name, mSampleConfig, mSampleType, mFrequency, data); alBufferData(mId, format, &data[0], data.size(), mFrequency); - if(loop_points) + if(ctx->hasExtension(SOFT_loop_points)) { ALint pts[2]{(ALint)loop_pts.first, (ALint)loop_pts.second}; alBufferiv(mId, AL_LOOP_POINTS_SOFT, pts); diff --git a/src/buffer.h b/src/buffer.h index 2c592dc..cba629e 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -12,6 +12,7 @@ namespace alure { class ALDevice; +class ALContext; ALuint FramesToBytes(ALuint size, SampleConfig chans, SampleType type); @@ -50,7 +51,7 @@ public: if(iter != mSources.cend()) mSources.erase(iter); } - void load(ALuint frames, ALenum format, bool loop_points, SharedPtr decoder, const std::string &name); + void load(ALuint frames, ALenum format, SharedPtr decoder, const std::string &name, ALContext *ctx); void setLoaded() { mIsLoaded = true; } bool isReady() const { return mLoadStatus == BufferLoad_Ready; } diff --git a/src/context.cpp b/src/context.cpp index 51986bd..c222ec9 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -292,8 +292,7 @@ void ALContext::backgroundProc() { for(PendingBuffer &pendbuf : mPendingBuffers) pendbuf.mBuffer->load(pendbuf.mFrames, pendbuf.mFormat, - hasExtension(SOFT_loop_points), - pendbuf.mDecoder, pendbuf.mName); + pendbuf.mDecoder, pendbuf.mName, this); mPendingBuffers.clear(); auto source = mStreamingSources.begin(); -- 2.11.4.GIT