RageSoundManager::AttenuateBuf -> RageSoundUtil::Attenuate
comment
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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): */
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user