use RageSoundReader_Pan for panning
This commit is contained in:
+17
-15
@@ -291,7 +291,9 @@ void Player::Init(
|
|||||||
m_sMessageToSendOnStep = ssprintf("StepP%d",pn+1);
|
m_sMessageToSendOnStep = ssprintf("StepP%d",pn+1);
|
||||||
|
|
||||||
|
|
||||||
m_soundMine.Load( THEME->GetPathS(sType,"mine"), true );
|
RageSoundLoadParams SoundParams;
|
||||||
|
SoundParams.m_bSupportPan = true;
|
||||||
|
m_soundMine.Load( THEME->GetPathS(sType,"mine"), true, &SoundParams );
|
||||||
|
|
||||||
/* Attacks can be launched in course modes and in battle modes. They both come
|
/* Attacks can be launched in course modes and in battle modes. They both come
|
||||||
* here to play, but allow loading a different sound for different modes. */
|
* here to play, but allow loading a different sound for different modes. */
|
||||||
@@ -299,22 +301,20 @@ void Player::Init(
|
|||||||
{
|
{
|
||||||
case PLAY_MODE_RAVE:
|
case PLAY_MODE_RAVE:
|
||||||
case PLAY_MODE_BATTLE:
|
case PLAY_MODE_BATTLE:
|
||||||
m_soundAttackLaunch.Load( THEME->GetPathS(sType,"battle attack launch"), true );
|
m_soundAttackLaunch.Load( THEME->GetPathS(sType,"battle attack launch"), true, &SoundParams );
|
||||||
m_soundAttackEnding.Load( THEME->GetPathS(sType,"battle attack ending"), true );
|
m_soundAttackEnding.Load( THEME->GetPathS(sType,"battle attack ending"), true, &SoundParams );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_soundAttackLaunch.Load( THEME->GetPathS(sType,"course attack launch"), true );
|
m_soundAttackLaunch.Load( THEME->GetPathS(sType,"course attack launch"), true, &SoundParams );
|
||||||
m_soundAttackEnding.Load( THEME->GetPathS(sType,"course attack ending"), true );
|
m_soundAttackEnding.Load( THEME->GetPathS(sType,"course attack ending"), true, &SoundParams );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RageSoundParams p;
|
float fBalance = GameSoundManager::GetPlayerBalance( pn );
|
||||||
p.m_Balance = GameSoundManager::GetPlayerBalance( pn );
|
m_soundMine.SetProperty( "Pan", fBalance );
|
||||||
|
m_soundAttackLaunch.SetProperty( "Pan", fBalance );
|
||||||
m_soundMine.SetParams( p );
|
m_soundAttackEnding.SetProperty( "Pan", fBalance );
|
||||||
m_soundAttackLaunch.SetParams( p );
|
|
||||||
m_soundAttackEnding.SetParams( p );
|
|
||||||
|
|
||||||
if( m_pCombo )
|
if( m_pCombo )
|
||||||
{
|
{
|
||||||
@@ -465,15 +465,17 @@ void Player::Load()
|
|||||||
RString sSongDir = pSong->GetSongDir();
|
RString sSongDir = pSong->GetSongDir();
|
||||||
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
|
m_vKeysounds.resize( pSong->m_vsKeysoundFile.size() );
|
||||||
|
|
||||||
RageSoundParams p;
|
RageSoundLoadParams SoundParams;
|
||||||
p.m_Balance = GameSoundManager::GetPlayerBalance( pn );
|
SoundParams.m_bSupportPan = true;
|
||||||
|
|
||||||
|
float fBalance = GameSoundManager::GetPlayerBalance( pn );
|
||||||
for( unsigned i=0; i<m_vKeysounds.size(); i++ )
|
for( unsigned i=0; i<m_vKeysounds.size(); i++ )
|
||||||
{
|
{
|
||||||
RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
|
RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[i];
|
||||||
RageSound& sound = m_vKeysounds[i];
|
RageSound& sound = m_vKeysounds[i];
|
||||||
if( sound.GetLoadedFilePath() != sKeysoundFilePath )
|
if( sound.GetLoadedFilePath() != sKeysoundFilePath )
|
||||||
sound.Load( sKeysoundFilePath, true );
|
sound.Load( sKeysoundFilePath, true, &SoundParams );
|
||||||
sound.SetParams( p );
|
sound.SetProperty( "Pan", fBalance );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pPlayerStageStats )
|
if( m_pPlayerStageStats )
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "arch/ArchHooks/ArchHooks.h"
|
#include "arch/ArchHooks/ArchHooks.h"
|
||||||
#include "RageSoundUtil.h"
|
#include "RageSoundUtil.h"
|
||||||
|
|
||||||
|
#include "RageSoundReader_Pan.h"
|
||||||
#include "RageSoundReader_PitchChange.h"
|
#include "RageSoundReader_PitchChange.h"
|
||||||
#include "RageSoundReader_Preload.h"
|
#include "RageSoundReader_Preload.h"
|
||||||
#include "RageSoundReader_Resample_Good.h"
|
#include "RageSoundReader_Resample_Good.h"
|
||||||
@@ -45,7 +46,6 @@ RageSoundParams::RageSoundParams():
|
|||||||
m_LengthSeconds = -1;
|
m_LengthSeconds = -1;
|
||||||
m_FadeLength = 0;
|
m_FadeLength = 0;
|
||||||
m_Volume = 1.0f;
|
m_Volume = 1.0f;
|
||||||
m_Balance = 0; // center
|
|
||||||
m_fPitch = 1.0f;
|
m_fPitch = 1.0f;
|
||||||
m_fSpeed = 1.0f;
|
m_fSpeed = 1.0f;
|
||||||
m_bAccurateSync = false;
|
m_bAccurateSync = false;
|
||||||
@@ -56,6 +56,7 @@ RageSoundParams::RageSoundParams():
|
|||||||
RageSoundLoadParams::RageSoundLoadParams()
|
RageSoundLoadParams::RageSoundLoadParams()
|
||||||
{
|
{
|
||||||
m_bSupportRateChanging = false;
|
m_bSupportRateChanging = false;
|
||||||
|
m_bSupportPan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RageSound::RageSound():
|
RageSound::RageSound():
|
||||||
@@ -225,6 +226,9 @@ bool RageSound::Load( RString sSoundFilePath, bool bPrecache, const RageSoundLoa
|
|||||||
m_pSource = pRate;
|
m_pSource = pRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( pParams->m_bSupportPan )
|
||||||
|
m_pSource = new RageSoundReader_Pan( m_pSource );
|
||||||
|
|
||||||
m_sFilePath = sSoundFilePath;
|
m_sFilePath = sSoundFilePath;
|
||||||
|
|
||||||
m_Mutex.SetName( ssprintf("RageSound (%s)", Basename(sSoundFilePath).c_str() ) );
|
m_Mutex.SetName( ssprintf("RageSound (%s)", Basename(sSoundFilePath).c_str() ) );
|
||||||
@@ -418,9 +422,6 @@ bool RageSound::GetDataToPlay( int16_t *pBuffer, int iFrames, int64_t &iStreamFr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This block goes from iStreamFrame to iStreamFrame+iGotFrames. */
|
|
||||||
RageSoundUtil::Pan( pBuffer, iGotFrames, m_Param.m_Balance );
|
|
||||||
|
|
||||||
iFramesStored += iGotFrames;
|
iFramesStored += iGotFrames;
|
||||||
iFrames -= iGotFrames;
|
iFrames -= iGotFrames;
|
||||||
pBuffer += iGotFrames * channels;
|
pBuffer += iGotFrames * channels;
|
||||||
|
|||||||
@@ -41,9 +41,6 @@ struct RageSoundParams
|
|||||||
|
|
||||||
float m_Volume; // multiplies with SOUNDMAN->GetMixVolume()
|
float m_Volume; // multiplies with SOUNDMAN->GetMixVolume()
|
||||||
|
|
||||||
/* Pan: -1, left; 1, right */
|
|
||||||
float m_Balance;
|
|
||||||
|
|
||||||
/* Number of samples input and output when changing speed. Currently,
|
/* Number of samples input and output when changing speed. Currently,
|
||||||
* this is either 1/1, 5/4 or 4/5. */
|
* this is either 1/1, 5/4 or 4/5. */
|
||||||
float m_fPitch;
|
float m_fPitch;
|
||||||
@@ -79,6 +76,9 @@ struct RageSoundLoadParams
|
|||||||
/* If true, speed and pitch changes will be supported for this sound, at a
|
/* If true, speed and pitch changes will be supported for this sound, at a
|
||||||
* small memory penalty if not used. */
|
* small memory penalty if not used. */
|
||||||
bool m_bSupportRateChanging;
|
bool m_bSupportRateChanging;
|
||||||
|
|
||||||
|
/* If true, panning will be supported for this sound. */
|
||||||
|
bool m_bSupportPan;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RageSound: public RageSoundBase
|
class RageSound: public RageSoundBase
|
||||||
|
|||||||
Reference in New Issue
Block a user