Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #5050: Add Mixer threading comments #5069

Merged
merged 1 commit into from Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/Mixer.h
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/core/Mixer.cpp
Expand Up @@ -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();
}
Expand Down