mirror of
https://codeberg.org/armin/trommelkiste.git
synced 2026-09-01 04:10:46 +02:00
Fix track signal indicator sometimes not showing for short samples
Use a latch pattern for trackActive: the audio thread sets it true whenever a voice is active, and the UI timer atomically reads and clears it via exchange(false). This eliminates the race where the flag was cleared at the start of every processBlock, causing the 30Hz timer to miss brief activations from short samples.
This commit is contained in:
parent
e1f36c8569
commit
2cded52eef
3 changed files with 3 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <juce_audio_processors/juce_audio_processors.h>
|
||||
#include <juce_audio_formats/juce_audio_formats.h>
|
||||
#include <juce_dsp/juce_dsp.h>
|
||||
#include <atomic>
|
||||
#include <random>
|
||||
|
||||
static constexpr int NUM_TRACKS = 10;
|
||||
|
|
@ -50,7 +51,7 @@ public:
|
|||
};
|
||||
|
||||
Track tracks[NUM_TRACKS];
|
||||
bool trackActive[NUM_TRACKS] = {};
|
||||
std::atomic<bool> trackActive[NUM_TRACKS] = {};
|
||||
juce::AudioProcessorValueTreeState apvts;
|
||||
|
||||
// Sample library
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue