diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index b538d819e8..f181ddb030 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -1,5 +1,13 @@ -/* Handle and provide an interface to the sound driver. Delete sounds that - * have been detached from their owner when they're finished playing. */ +/* + * This manager has several distinct purposes: + * + * Load and handle with the sound driver. + * Handle most communication between the sound driver and RageSound. + * Factory and reference count RageSoundReader objects for RageSound. + * User-level: + * - global volume management + * - sound detaching ("play and delete when done playing") + */ #include "global.h" #include "RageSoundManager.h" @@ -347,16 +355,6 @@ void RageSoundManager::SetPlayOnlyCriticalSounds( bool bPlayOnlyCriticalSounds ) g_SoundManMutex.Unlock(); /* finished with m_bPlayOnlyCriticalSounds */ } -/* Standalone helpers: */ -void RageSoundManager::AttenuateBuf( int16_t *pBuf, int iSamples, float fVolume ) -{ - while( iSamples-- ) - { - *pBuf = int16_t( (*pBuf) * fVolume ); - ++pBuf; - } -} - /* * Copyright (c) 2002-2004 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/RageSoundManager.h b/stepmania/src/RageSoundManager.h index 55a82e5ce0..f98c62fd0d 100644 --- a/stepmania/src/RageSoundManager.h +++ b/stepmania/src/RageSoundManager.h @@ -58,8 +58,6 @@ public: RageSound *PlaySound( RageSound &snd, const RageSoundParams *params = NULL ); RageSound *PlayCopyOfSound( RageSound &snd, const RageSoundParams *params = NULL ); - static void AttenuateBuf( int16_t *pBuf, int iSamples, float fVolume ); - private: /* Set of sounds that we've taken over (and are responsible for deleting * when they're finished playing): */ diff --git a/stepmania/src/RageSoundUtil.cpp b/stepmania/src/RageSoundUtil.cpp index ac293648ff..03abd4a62f 100644 --- a/stepmania/src/RageSoundUtil.cpp +++ b/stepmania/src/RageSoundUtil.cpp @@ -5,6 +5,15 @@ /* Some of these functions assume a channel count: */ static const int channels = 2; +void RageSoundUtil::Attenuate( int16_t *pBuf, int iSamples, float fVolume ) +{ + while( iSamples-- ) + { + *pBuf = int16_t( (*pBuf) * fVolume ); + ++pBuf; + } +} + /* Pan buffer left or right; fPos is -1...+1. Buffer is assumed to be stereo. */ void RageSoundUtil::Pan( int16_t *buffer, int frames, float fPos ) { diff --git a/stepmania/src/RageSoundUtil.h b/stepmania/src/RageSoundUtil.h index 8872f7a57e..c49cc387fe 100644 --- a/stepmania/src/RageSoundUtil.h +++ b/stepmania/src/RageSoundUtil.h @@ -5,6 +5,7 @@ namespace RageSoundUtil { + void Attenuate( int16_t *pBuf, int iSamples, float fVolume ); void Pan( int16_t *pBuffer, int iFrames, float fPos ); void Fade( int16_t *pBuffer, int iFrames, float fStartVolume, float fEndVolume ); void ConvertMonoToStereoInPlace( int16_t *pBuffer, int iFrames );