From 10602697094fe64473e4abc842ac3c117bf44bbf Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 2 Apr 2004 21:28:06 +0000 Subject: [PATCH] add StartDecodeThread to fix potential GetSampleRate race (will break sound drivers until I update them) --- .../src/arch/Sound/RageSoundDriver_Generic_Software.cpp | 7 ++++++- .../src/arch/Sound/RageSoundDriver_Generic_Software.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp index 0905ab27d8..c8ea1315b2 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.cpp @@ -288,12 +288,17 @@ void RageSound_Generic_Software::StopMixing( RageSoundBase *snd ) } +void RageSound_Generic_Software::StartDecodeThread() +{ + ASSERT( !m_DecodeThread.IsCreated() ); + m_DecodeThread.Create( DecodeThread_start, this ); +} + RageSound_Generic_Software::RageSound_Generic_Software() { shutdown_decode_thread = false; m_DecodeThread.SetName("Decode thread"); - m_DecodeThread.Create( DecodeThread_start, this ); } RageSound_Generic_Software::~RageSound_Generic_Software() diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h index 97670474e9..1e81438332 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_Generic_Software.h @@ -86,6 +86,10 @@ class RageSound_Generic_Software: public RageSoundDriver bool GetDataForSound( sound &s ); protected: + /* Start the decoding. This should be called once the hardware is set up and + * GetSampleRate will return the correct value. */ + void StartDecodeThread(); + /* Override this to set the priority of the decoding thread, which should be above * normal priority but not realtime. */ virtual void SetupDecodingThread() { }