Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions linux/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
CSound* pSound = static_cast<CSound*> ( arg );
int i;

// make sure we are locked during execution
QMutexLocker locker(&pSound->MutexAudioProcessCb);

if ( pSound->IsRunning() && ( nframes == static_cast<jack_nframes_t> ( pSound->iJACKBufferSizeMono ) ) )
{
// get input data pointer
Expand Down
10 changes: 5 additions & 5 deletions src/soundbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ void CSoundBase::Stop()
// set flag so that thread can leave the main loop
bRun = false;

// give thread some time to terminate
if ( !bIsCallbackAudioInterface )
{
wait ( 5000 );
}
// drain the audio process callback
QMutexLocker locker(&MutexAudioProcessCb);
}

void CSoundBase::run()
{
// make sure we are locked during execution
QMutexLocker locker(&MutexAudioProcessCb);

// main loop of working thread
while ( bRun )
{
Expand Down
2 changes: 2 additions & 0 deletions src/soundbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <QThread>
#include <QString>
#include <QMutex>
#ifndef HEADLESS
# include <QMessageBox>
#endif
Expand Down Expand Up @@ -137,6 +138,7 @@ class CSoundBase : public QThread

void run();
bool bRun;
QMutex MutexAudioProcessCb;

void ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes );

Expand Down