- added sync multiplicator

git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@722 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2020-08-11 19:21:52 +00:00
parent 4c6f9859bd
commit a430c135e7
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -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++)
+1
View File
@@ -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)
}