If a sound is started, plays for a while, then stopped, repositioned and
started quickly, queued position data from the previous play will still be flushed. We clear already-flushed data in StopMixing (pos_map.clear()) so we don't have stale data, but some is being re-flushed afterwards because we have the same ID. Change sound IDs when stopping a sound. (The symptom was the first frame in Play mode in the editor would process using an old position; the position was usually later in the song, which sometimes marked hold notes as dead.)
This commit is contained in:
@@ -122,14 +122,11 @@ void RageSoundManager::Update(float delta)
|
||||
}
|
||||
|
||||
/* Register the given sound, and return a unique ID. */
|
||||
int RageSoundManager::RegisterSound( RageSound *p )
|
||||
void RageSoundManager::RegisterSound( RageSound *p )
|
||||
{
|
||||
LockMut(g_SoundManMutex); /* lock for access to all_sounds and iID */
|
||||
|
||||
g_SoundManMutex.Lock(); /* lock for access to all_sounds */
|
||||
all_sounds.insert( p );
|
||||
|
||||
static int iID = 0;
|
||||
return ++iID;
|
||||
g_SoundManMutex.Unlock(); /* finished with all_sounds */
|
||||
}
|
||||
|
||||
void RageSoundManager::UnregisterSound( RageSound *p )
|
||||
@@ -139,6 +136,14 @@ void RageSoundManager::UnregisterSound( RageSound *p )
|
||||
g_SoundManMutex.Unlock(); /* finished with all_sounds */
|
||||
}
|
||||
|
||||
/* Return a unique ID. */
|
||||
int RageSoundManager::GetUniqueID()
|
||||
{
|
||||
LockMut(g_SoundManMutex); /* serialize iID */
|
||||
static int iID = 0;
|
||||
return ++iID;
|
||||
}
|
||||
|
||||
void RageSoundManager::RegisterPlayingSound( RageSound *p )
|
||||
{
|
||||
g_SoundManMutex.Lock(); /* lock for access to playing_sounds */
|
||||
|
||||
Reference in New Issue
Block a user