Merge pull request #650 from nixtrix/keysoundvolumefix
Autokeysounds are no longer twice as loud when playing keysounded charts with two players.
This commit is contained in:
+3
-18
@@ -46,8 +46,7 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain )
|
|||||||
RString sSongDir = pSong->GetSongDir();
|
RString sSongDir = pSong->GetSongDir();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add all current autoplay sounds in both players to the chain. If a sound is
|
* Add all current autoplay sounds in both players to the chain.
|
||||||
* common to both players, don't pan it; otherwise pan it to that player's side.
|
|
||||||
*/
|
*/
|
||||||
int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->GetMasterPlayerNumber()].GetNumTracks();
|
int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->GetMasterPlayerNumber()].GetNumTracks();
|
||||||
for( int t = 0; t < iNumTracks; t++ )
|
for( int t = 0; t < iNumTracks; t++ )
|
||||||
@@ -79,21 +78,6 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain )
|
|||||||
FOREACH_EnabledPlayer(pn)
|
FOREACH_EnabledPlayer(pn)
|
||||||
tn[pn] = m_ndAutoKeysoundsOnly[pn].GetTapNote( t, iRow );
|
tn[pn] = m_ndAutoKeysoundsOnly[pn].GetTapNote( t, iRow );
|
||||||
|
|
||||||
/* Do all enabled players have the same note here? (Having no note at all
|
|
||||||
* counts as having a different note.) */
|
|
||||||
bool bSoundIsGlobal = true;
|
|
||||||
{
|
|
||||||
PlayerNumber pn = GetNextEnabledPlayer((PlayerNumber)-1);
|
|
||||||
const TapNote &tap = tn[pn];
|
|
||||||
pn = GetNextEnabledPlayer(pn);
|
|
||||||
while( pn != PLAYER_INVALID )
|
|
||||||
{
|
|
||||||
if( tn[pn].type != TapNoteType_AutoKeysound || tn[pn].iKeysoundIndex != tap.iKeysoundIndex )
|
|
||||||
bSoundIsGlobal = false;
|
|
||||||
pn = GetNextEnabledPlayer(pn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_EnabledPlayer(pn)
|
FOREACH_EnabledPlayer(pn)
|
||||||
{
|
{
|
||||||
if( tn[pn] == TAP_EMPTY )
|
if( tn[pn] == TAP_EMPTY )
|
||||||
@@ -106,7 +90,8 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain )
|
|||||||
float fSeconds = GAMESTATE->m_pCurSteps[pn]->GetTimingData()->GetElapsedTimeFromBeatNoOffset( NoteRowToBeat(iRow) ) + SOUNDMAN->GetPlayLatency();
|
float fSeconds = GAMESTATE->m_pCurSteps[pn]->GetTimingData()->GetElapsedTimeFromBeatNoOffset( NoteRowToBeat(iRow) ) + SOUNDMAN->GetPlayLatency();
|
||||||
|
|
||||||
float fPan = 0;
|
float fPan = 0;
|
||||||
if( !bSoundIsGlobal )
|
// If two players are playing, pan the keysounds to each player's respective side
|
||||||
|
if( GAMESTATE->GetNumPlayersEnabled() == 2 )
|
||||||
fPan = (pn == PLAYER_1)? -1.0f:+1.0f;
|
fPan = (pn == PLAYER_1)? -1.0f:+1.0f;
|
||||||
int iIndex = pChain->LoadSound( sKeysoundFilePath );
|
int iIndex = pChain->LoadSound( sKeysoundFilePath );
|
||||||
pChain->AddSound( iIndex, fSeconds, fPan );
|
pChain->AddSound( iIndex, fSeconds, fPan );
|
||||||
|
|||||||
Reference in New Issue
Block a user