I get compiler errors relating to this 'lock' issue.
Looking at the code it seems that there's namespace pollution between the
enum definition:
typedef enum { init, lock, unlock, destroy } lockset;
and the multithreading lock.
I appended enum_ to the variables and made these diffs.
--- src/Misc/SynthEngine.h.orig 2017-10-26 03:09:04 UTC
+++ src/Misc/SynthEngine.h
@@ -46,7 +46,7 @@ using namespace std;
#include "Misc/Config.h"
#include "Params/PresetsStore.h"
-typedef enum { init, lock, unlock, destroy } lockset;
+typedef enum { enum_init, enum_lock, enum_unlock, enum_destroy } lockset;
class EffectMgr;
class Part;
=============================================
--- src/Misc/SynthEngine.cpp.orig 2017-10-26 03:11:35 UTC
+++ src/Misc/SynthEngine.cpp
@@ -604,11 +604,11 @@ void SynthEngine::NoteOn(unsigned char chan, unsigned
if (partonoffRead(npart))
{
#ifdef MUTEX
- actionLock(lock);
+ actionLock(enum_lock);
#endif
part[npart]->NoteOn(note, velocity, keyshift);
#ifdef MUTEX
- actionLock(unlock);
+ actionLock(enum_unlock);
#endif
}
else if (VUpeak.values.parts[npart] > (-velocity))
@@ -640,11 +640,11 @@ void SynthEngine::NoteOff(unsigned char chan, unsigned
if (chan == (part[npart]->Prcvchn & 0xef) && partonoffRead(npart))
{
#ifdef MUTEX
- actionLock(lock);
+ actionLock(enum_lock);
#endif
part[npart]->NoteOff(note);
#ifdef MUTEX
- actionLock(unlock);
+ actionLock(enum_unlock);
#endif
}
}
@@ -2183,7 +2183,7 @@ int SynthEngine::MasterAudio(float *outl [NUM_MIDI_PAR
else
{
#ifdef MUTEX
- actionLock(lock);
+ actionLock(enum_lock);
#endif
// Compute part samples and store them ->partoutl,partoutr
for (int npart = 0; npart < Runtime.NumAvailableParts; ++npart)
@@ -2337,7 +2337,7 @@ int SynthEngine::MasterAudio(float *outl [NUM_MIDI_PAR
}
}
#ifdef MUTEX
- actionLock(unlock);
+ actionLock(enum_unlock);
#endif
// Peak calculation for mixed outputs
VUpeak.values.vuRmsPeakL = 1e-12f;
@@ -2487,11 +2487,11 @@ bool SynthEngine::actionLock(lockset request)
switch (request)
{
- case lock:
+ case enum_lock:
chk = pthread_mutex_lock(processLock);
break;
- case unlock:
+ case enum_unlock:
chk = pthread_mutex_unlock(processLock);
break;
=============================================
--- src/Effects/EffectMgr.cpp.orig 2017-10-26 03:15:27 UTC
+++ src/Effects/EffectMgr.cpp
@@ -151,9 +151,9 @@ void EffectMgr::changepreset_nolock(unsigned char npre
// Change the preset of the current effect(with thread locking)
void EffectMgr::changepreset(unsigned char npreset)
{
- synth->actionLock(lock);
+ synth->actionLock(enum_lock);
changepreset_nolock(npreset);
- synth->actionLock(unlock);
+ synth->actionLock(enum_unlock);
}
@@ -169,9 +169,9 @@ void EffectMgr::seteffectpar_nolock(int npar, unsigned
// Change a parameter of the current effect (with thread locking)
void EffectMgr::seteffectpar(int npar, unsigned char value)
{
- synth->actionLock(lock);
+ synth->actionLock(enum_lock);
seteffectpar_nolock(npar, value);
- synth->actionLock(unlock);
+ synth->actionLock(enum_unlock);
}
would those changes or something similar be acceptable?