Use the spinlock mutex in EQPool
This commit is contained in:
parent
76654d56ea
commit
f3e37cc713
2 changed files with 4 additions and 3 deletions
|
|
@ -108,7 +108,7 @@ sfz::EQPool::EQPool(const MidiState& state, int numEQs)
|
|||
|
||||
sfz::EQHolderPtr sfz::EQPool::getEQ(const EQDescription& description, unsigned numChannels, float velocity)
|
||||
{
|
||||
const std::unique_lock<std::mutex> lock { eqGuard, std::try_to_lock };
|
||||
const std::unique_lock<SpinMutex> lock { eqGuard, std::try_to_lock };
|
||||
if (!lock.owns_lock())
|
||||
return {};
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ size_t sfz::EQPool::getActiveEQs() const
|
|||
|
||||
size_t sfz::EQPool::setnumEQs(size_t numEQs)
|
||||
{
|
||||
const std::lock_guard<std::mutex> eqLock { eqGuard };
|
||||
const std::lock_guard<SpinMutex> eqLock { eqGuard };
|
||||
|
||||
swapAndPopAll(eqs, [](sfz::EQHolderPtr& eq) { return eq.use_count() == 1; });
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "SfzFilter.h"
|
||||
#include "EQDescription.h"
|
||||
#include "MidiState.h"
|
||||
#include "utility/SpinMutex.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
|
@ -115,7 +116,7 @@ public:
|
|||
*/
|
||||
void setSampleRate(float sampleRate);
|
||||
private:
|
||||
std::mutex eqGuard;
|
||||
SpinMutex eqGuard;
|
||||
float sampleRate { config::defaultSampleRate };
|
||||
const MidiState& midiState;
|
||||
std::vector<EQHolderPtr> eqs;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue