mirror of
https://codeberg.org/armin/sm-26.git
synced 2026-10-11 17:01:53 +02:00
Add README, thread-safe engine, standalone format
This commit is contained in:
parent
8734ac25f1
commit
001a5a5324
4 changed files with 78 additions and 2 deletions
|
|
@ -42,6 +42,7 @@ void SynthEngine::reset()
|
|||
|
||||
void SynthEngine::loadPreset (const Preset& p)
|
||||
{
|
||||
juce::SpinLock::ScopedLockType lock (paramLock);
|
||||
for (int i = 0; i < kNumParams; ++i)
|
||||
params[i] = p.base[i];
|
||||
for (int i = 0; i < kNumKnobs; ++i)
|
||||
|
|
@ -63,6 +64,7 @@ void SynthEngine::setPresetIndex (int i)
|
|||
void SynthEngine::setParam (int id, float n01)
|
||||
{
|
||||
if (id < 0 || id >= kNumParams) return;
|
||||
juce::SpinLock::ScopedLockType lock (paramLock);
|
||||
params[id] = juce::jlimit (0.0f, 1.0f, n01);
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +81,8 @@ SynthEngine::KnobView SynthEngine::knobView (int knob) const
|
|||
k.name = knobNames[knob];
|
||||
k.param = knobParams[knob];
|
||||
k.value01 = getParam (k.param);
|
||||
k.lo = knobLows[knob];
|
||||
k.hi = knobHighs[knob];
|
||||
return k;
|
||||
}
|
||||
|
||||
|
|
@ -192,6 +196,14 @@ void SynthEngine::process (AudioBuffer<float>& buffer, MidiBuffer& midi,
|
|||
wasPlaying = transportPlaying;
|
||||
lastBpmValue = (bpm > 10.0 && bpm < 300.0) ? bpm : 120.0;
|
||||
|
||||
std::array<float, kNumParams> snap;
|
||||
{
|
||||
juce::SpinLock::ScopedLockType lock (paramLock);
|
||||
for (int i = 0; i < kNumParams; ++i)
|
||||
snap[(size_t) i] = params[i];
|
||||
}
|
||||
const float* const params = snap.data();
|
||||
|
||||
const float cutN01 = params[PCUTOFF];
|
||||
const float resN01 = params[PRES];
|
||||
const float fenvN01 = params[PFENV];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue