Start work on replacing/removing global locks

This commit is contained in:
Vesa
2014-08-03 14:49:45 +03:00
parent 3bbb81cf24
commit 9e1cdd0441
13 changed files with 123 additions and 65 deletions

View File

@@ -22,8 +22,8 @@
*
*/
#ifndef _ENVELOPE_AND_LFO_PARAMETERS_H
#define _ENVELOPE_AND_LFO_PARAMETERS_H
#ifndef ENVELOPE_AND_LFO_PARAMETERS_H
#define ENVELOPE_AND_LFO_PARAMETERS_H
#include <QtCore/QVector>

View File

@@ -231,6 +231,8 @@ private:
QMutex m_notesMutex;
int m_runningMidiNotes[NumKeys];
QMutex m_midiNotesMutex;
bool m_sustainPedalPressed;
bool m_silentBuffersProcessed;

View File

@@ -308,6 +308,16 @@ public:
{
m_inputFramesMutex.unlock();
}
void lockPlayHandleRemoval()
{
m_playHandleRemovalMutex.lock();
}
void unlockPlayHandleRemoval()
{
m_playHandleRemovalMutex.unlock();
}
// audio-buffer-mgm
void bufferToPort( const sampleFrame * _buf,
@@ -449,7 +459,8 @@ private:
QMutex m_globalMutex;
QMutex m_inputFramesMutex;
QMutex m_playHandleRemovalMutex;
fifo * m_fifo;
fifoWriter * m_fifoWriter;

View File

@@ -27,6 +27,7 @@
#include <QtCore/QThread>
#include <QtCore/QVector>
#include <QtCore/QMutex>
#include "ThreadableJob.h"
#include "lmms_basics.h"
@@ -84,7 +85,18 @@ public:
return !isFinished();
}
void lock()
{
m_processingLock.lock();
}
void unlock()
{
m_processingLock.unlock();
}
bool tryLock()
{
return m_processingLock.tryLock();
}
virtual void play( sampleFrame* buffer ) = 0;
virtual bool isFinished( void ) const = 0;
@@ -108,6 +120,7 @@ private:
Type m_type;
f_cnt_t m_offset;
const QThread* m_affinity;
QMutex m_processingLock;
} ;

View File

@@ -119,7 +119,7 @@ public:
{
return m_length;
}
virtual void movePosition( const MidiTime & _pos );
virtual void changeLength( const MidiTime & _length );
@@ -508,6 +508,18 @@ public:
m_height = _height;
}
void lock()
{
m_processingLock.lock();
}
void unlock()
{
m_processingLock.unlock();
}
bool tryLock()
{
return m_processingLock.tryLock();
}
public slots:
virtual void setName( const QString & _new_name )
@@ -533,6 +545,7 @@ private:
tcoVector m_trackContentObjects;
QMutex m_processingLock;
friend class trackView;