diff --git a/include/Mixer.h b/include/Mixer.h index cea592905a3..69ea0d12d86 100644 --- a/include/Mixer.h +++ b/include/Mixer.h @@ -315,6 +315,7 @@ class LMMS_EXPORT Mixer : public QObject inline bool isMetronomeActive() const { return m_metronomeActive; } inline void setMetronomeActive(bool value = true) { m_metronomeActive = value; } + //! Block until a change in model can be done (i.e. wait for audio thread) void requestChangeInModel(); void doneChangeInModel(); @@ -366,6 +367,8 @@ class LMMS_EXPORT Mixer : public QObject void clearInternal(); + //! Called by the audio thread to give control to other threads, + //! such that they can do changes in the model (like e.g. removing effects) void runChangesInModel(); bool m_renderOnly; diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 7e41f2097d9..2550b072e76 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -831,7 +831,9 @@ void Mixer::runChangesInModel() if( m_changesSignal ) { m_waitChangesMutex.lock(); + // allow changes in the model from other threads ... m_changesRequestCondition.wakeOne(); + // ... and wait until they are done m_changesMixerCondition.wait( &m_waitChangesMutex ); m_waitChangesMutex.unlock(); }