From 93adfa9c7d245b24995c441e0608fa9907fb811b Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Tue, 28 Jun 2011 22:07:14 -0700 Subject: [PATCH] :%s/^I/ /ge --- .../PubUtilLib/plAudioCore/plSoundBuffer.cpp | 86 +++++++++---------- .../PubUtilLib/plAudioCore/plSoundBuffer.h | 42 ++++----- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp index d2a0304b..bc4f1948 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp @@ -76,30 +76,30 @@ static plAudioFileReader *CreateReader( hsBool fullpath, const char filename[], hsError plSoundPreloader::Run() { - hsTArray templist; - - while (fRunning) - { - fCritSect.Lock(); - for (int i = fBuffers.GetCount(); i > 0; i--) - { - templist.Append(fBuffers.Pop()); - } - fCritSect.Unlock(); - - if (templist.GetCount() == 0) - { - fEvent.Wait(); - } - else - { + hsTArray templist; + + while (fRunning) + { + fCritSect.Lock(); + for (int i = fBuffers.GetCount(); i > 0; i--) + { + templist.Append(fBuffers.Pop()); + } + fCritSect.Unlock(); + + if (templist.GetCount() == 0) + { + fEvent.Wait(); + } + else + { plAudioFileReader *reader = nil; - for (int i = templist.GetCount(); i > 0; i--) - { - plSoundBuffer* buf = templist.Pop(); + for (int i = templist.GetCount(); i > 0; i--) + { + plSoundBuffer* buf = templist.Pop(); - if (buf->GetData()) - { + if (buf->GetData()) + { reader = CreateReader(true, buf->GetFileName(), buf->GetAudioReaderType(), buf->GetReaderSelect()); if( reader ) @@ -109,39 +109,39 @@ hsError plSoundPreloader::Run() buf->SetAudioReader(reader); // give sound buffer reader, since we may need it later } else - { + { buf->SetError(); - } - } + } + } - buf->SetLoaded(true); - } - } - } + buf->SetLoaded(true); + } + } + } // we need to be sure that all buffers are removed from our load list when shutting this thread down or we will hang, // since the sound buffer will wait to be destroyed until it is marked as loaded - fCritSect.Lock(); - for (int i = fBuffers.GetCount(); i > 0; i--) - { - plSoundBuffer* buf = fBuffers.Pop(); - buf->SetLoaded(true); - } - fCritSect.Unlock(); - - return hsOK; + fCritSect.Lock(); + for (int i = fBuffers.GetCount(); i > 0; i--) + { + plSoundBuffer* buf = fBuffers.Pop(); + buf->SetLoaded(true); + } + fCritSect.Unlock(); + + return hsOK; } static plSoundPreloader gLoaderThread; void plSoundBuffer::Init() { - gLoaderThread.Start(); + gLoaderThread.Start(); } void plSoundBuffer::Shutdown() { - gLoaderThread.Stop(); + gLoaderThread.Stop(); } //// Constructor/Destructor ////////////////////////////////////////////////// @@ -350,8 +350,8 @@ plSoundBuffer::ELoadReturnVal plSoundBuffer::AsyncLoad(plAudioFileReader::Stream return kError; } - gLoaderThread.AddBuffer(this); - fLoading = true; + gLoaderThread.AddBuffer(this); + fLoading = true; } if(fLoaded) { @@ -553,4 +553,4 @@ plAudioFileReader *plSoundBuffer::IGetReader( hsBool fullpath ) RoundDataPos( fDataLength ); return reader; -} \ No newline at end of file +} diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h index b35f7534..c2579e2a 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h @@ -145,34 +145,34 @@ protected: class plSoundPreloader : public hsThread { protected: - hsTArray fBuffers; - hsEvent fEvent; - bool fRunning; - hsMutex fCritSect; + hsTArray fBuffers; + hsEvent fEvent; + bool fRunning; + hsMutex fCritSect; public: - virtual hsError Run(); + virtual hsError Run(); - virtual void Start() { - fRunning = true; - hsThread::Start(); - } + virtual void Start() { + fRunning = true; + hsThread::Start(); + } - virtual void Stop() { - fRunning = false; - fEvent.Signal(); - hsThread::Stop(); - } + virtual void Stop() { + fRunning = false; + fEvent.Signal(); + hsThread::Stop(); + } - bool IsRunning() const { return fRunning; } + bool IsRunning() const { return fRunning; } - void AddBuffer(plSoundBuffer* buffer) { - fCritSect.Lock(); - fBuffers.Push(buffer); - fCritSect.Unlock(); + void AddBuffer(plSoundBuffer* buffer) { + fCritSect.Lock(); + fBuffers.Push(buffer); + fCritSect.Unlock(); - fEvent.Signal(); - } + fEvent.Signal(); + } }; #endif //_plSoundBuffer_h