diff --git a/Source/JaySynth.cpp b/Source/JaySynth.cpp index edd2a25..4dae68d 100644 --- a/Source/JaySynth.cpp +++ b/Source/JaySynth.cpp @@ -26,6 +26,12 @@ #define WITH_OLD_HUMANIZE +#include "synth/lfo.h" +#ifndef WITH_DEV_SYNCED_LFO +#define WITH_DEV_SYNCED_LFO 0 +#endif +#define DEV_SYNCED_LFO_FACTOR 2 + //============================================================================== /** A JaySynth that just plays incredible sounds.. */ JaySynth::JaySynth (int num_voices, String pathToWaves) @@ -1146,7 +1152,9 @@ void JaySynth::handleMidiEvent (const MidiMessage& m) m_clock_cnt_bar = m_clock_cnt_bar % m_numMidiClocksPerBar; if (m_isMidiClockStarted) { +#if WITH_DEV_SYNCED_LFO voiceSetMidiBeat(m_clock_cnt_bar % m_numMidiclocksPerQuarterNote); +#endif if (m_clock_cnt_bar % m_numMidiClocksPerBeat == 0) { // Send quarter pulse with current BPM estimation @@ -1168,7 +1176,7 @@ void JaySynth::handleMidiEvent (const MidiMessage& m) void JaySynth::voiceSetMidiBeat(int quarterBeatCount) { lfo_t *pLfo = &m_pVoices[0].pCom->glfo[0]; - synth_float_t phase = (synth_float_t)quarterBeatCount/m_numMidiclocksPerQuarterNote; + synth_float_t phase = Sync_mod(DEV_SYNCED_LFO_FACTOR*(synth_float_t)quarterBeatCount/m_numMidiclocksPerQuarterNote, 1.0); LFO_sync(pLfo, phase); for (int i=0; i < max_num_voices; i++) diff --git a/Source/synth/lfo.h b/Source/synth/lfo.h index 2b70c14..21bd598 100644 --- a/Source/synth/lfo.h +++ b/Source/synth/lfo.h @@ -75,6 +75,7 @@ void Sync_set_callback(sync_t *pObj, void *pFuncObj, SyncOnProcess funcSyncOnPro void Sync_phase_update(sync_t *pObj, synth_float_t phase_ref); void Sync_process(sync_t *pObj); +synth_float_t Sync_mod(synth_float_t x, synth_float_t y); #if defined(__cplusplus) }