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:
@@ -72,7 +72,9 @@ RageSound::RageSound():
|
||||
databuf.reserve(internal_buffer_size);
|
||||
|
||||
/* Register ourself. */
|
||||
ID = SOUNDMAN->RegisterSound( this );
|
||||
SOUNDMAN->RegisterSound( this );
|
||||
|
||||
ID = SOUNDMAN->GetUniqueID();
|
||||
}
|
||||
|
||||
RageSound::~RageSound()
|
||||
@@ -98,8 +100,11 @@ RageSound::RageSound(const RageSound &cpy):
|
||||
|
||||
*this = cpy;
|
||||
|
||||
/* Register ourself. We have a different ID than our parent. */
|
||||
ID = SOUNDMAN->RegisterSound( this );
|
||||
/* Register ourself. */
|
||||
SOUNDMAN->RegisterSound( this );
|
||||
|
||||
/* We have a different ID than our parent. */
|
||||
ID = SOUNDMAN->GetUniqueID();
|
||||
}
|
||||
|
||||
RageSound &RageSound::operator=( const RageSound &cpy )
|
||||
@@ -605,6 +610,12 @@ void RageSound::StopPlaying()
|
||||
|
||||
max_driver_frame = 0;
|
||||
pos_map.Clear();
|
||||
|
||||
/* We may still have positions queued up in RageSoundManager. We need to make sure
|
||||
* that we don't accept those; otherwise, if we start playing again quickly, they'll
|
||||
* confuse GetPositionSeconds(). Do this by changing our ID. */
|
||||
ID = SOUNDMAN->GetUniqueID();
|
||||
|
||||
// LOG->Trace("StopPlaying %p finished (%s)", this, this->GetLoadedFilePath().c_str());
|
||||
|
||||
m_Mutex.Unlock();
|
||||
|
||||
Reference in New Issue
Block a user