You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Mixer::renderNextBuffer(), when a clear signal is received (by calling Mixer::clear(), which sets m_clearSignal to true), Mixer::clearInternal() gets called and it simply adds every PlayHandle except InstrumentPlayHandles from m_playHandles to m_playHandlesToRemove. However, right after Mixer::clearInternal() is called in Mixer::renderNextBuffer(), a loop iterates through m_playHandlesToRemove and removes the same PlayHandles from m_playHandles. In other words, it unnecessarily stores a list of PlayHandles to be removed only to actually remove then right afterwards. Mixer::clear() seems to be called only within Song::stop().
Other than Mixer::clear(), the only method that adds a play handle to m_playHandlesToRemove is Mixer::removePlayHandle(), which is only called by the FileBrowser class to stop a preset preview PlayHandle. Also, only one preset preview PlayHandle seems to be active at a time.
Solution
Add the members PresetPreviewPlayHandle m_presetPreviewPlayHandle and bool m_presetPreviewStopped to Mixer.
Create the method Mixer::addPresetPreviewPlayHandle():
Mixer::clearInternal was added in #2879 by @jasp00 to fix a deadlock. I think we can remove it once we find a solution without deadlocks.
For preset previewing, I'm not sure why that can be an issue. I also think Mixer is not a place for handling preset previews.
Problem
In
Mixer::renderNextBuffer()
, when a clear signal is received (by callingMixer::clear()
, which setsm_clearSignal
totrue
),Mixer::clearInternal()
gets called and it simply adds everyPlayHandle
exceptInstrumentPlayHandle
s fromm_playHandles
tom_playHandlesToRemove
. However, right afterMixer::clearInternal()
is called inMixer::renderNextBuffer()
, a loop iterates throughm_playHandlesToRemove
and removes the samePlayHandles
fromm_playHandles
. In other words, it unnecessarily stores a list ofPlayHandles
to be removed only to actually remove then right afterwards.Mixer::clear()
seems to be called only withinSong::stop()
.Other than
Mixer::clear()
, the only method that adds a play handle to m_playHandlesToRemove isMixer::removePlayHandle()
, which is only called by theFileBrowser
class to stop a preset previewPlayHandle
. Also, only one preset previewPlayHandle
seems to be active at a time.Solution
Add the members
PresetPreviewPlayHandle m_presetPreviewPlayHandle
andbool m_presetPreviewStopped
toMixer
.Create the method
Mixer::addPresetPreviewPlayHandle()
:Mixer::stopPresetPreview()
:Mixer::renderNextBuffer()
so that:becomes something like:
FileBrowser.cpp
with the new methods.The text was updated successfully, but these errors were encountered: