- LFO: added Sync modes Frequency, Phase and Frequency + Phase

- added GUI Parameter MIDISYNC_MODE and MIDISYNC_BERATDIV
- wired MIDISYNC params down to global LFO

git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@726 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2020-08-15 12:32:16 +00:00
parent 7b731dd270
commit 0f8abfd428
9 changed files with 278 additions and 42 deletions
+20 -7
View File
@@ -28,9 +28,8 @@
#include "synth/lfo.h"
#ifndef WITH_DEV_SYNCED_LFO
#define WITH_DEV_SYNCED_LFO 0
#define WITH_DEV_SYNCED_LFO 1
#endif
#define DEV_SYNCED_LFO_FACTOR 1
//==============================================================================
/** A JaySynth that just plays incredible sounds.. */
@@ -93,7 +92,7 @@ JaySynth::JaySynth (int num_voices, String pathToWaves)
ppHumanizedSliders[i] = new synth_float_t[max_num_voices];
for (j=0; j < max_num_voices; j++)
{
sprintf(paramName, "%s Voice# %03d", getParamInfo(i)->pName, j);
snprintf(paramName, sizeof(paramName), "%s Voice# %03d", getParamInfo(i)->pName, j);
paramInfoInit(&humanize_voice_param[i][j], getParamInfo(i)->id, paramName);
paramInfoCopy(&humanize_voice_param[i][j], getParamInfo(i));
ppHumanizedSliders[i][j] = 0;
@@ -809,6 +808,20 @@ void JaySynth::setParam(int paramID, int voice)
voice_param_type = VOICE_PARAM_LFO_0_SYMMETRY + (paramID - SYNTH_PARAM_LFO_0_SYMMETRY);
break;
case SYNTH_PARAM_LFO_0_MIDISYNC_MODE:
case SYNTH_PARAM_LFO_1_MIDISYNC_MODE:
case SYNTH_PARAM_LFO_2_MIDISYNC_MODE:
case SYNTH_PARAM_LFO_3_MIDISYNC_MODE:
voice_param_type = VOICE_PARAM_LFO_0_MIDISYNC_MODE + (paramID - SYNTH_PARAM_LFO_0_MIDISYNC_MODE);
break;
case SYNTH_PARAM_LFO_0_MIDISYNC_BEATDIV:
case SYNTH_PARAM_LFO_1_MIDISYNC_BEATDIV:
case SYNTH_PARAM_LFO_2_MIDISYNC_BEATDIV:
case SYNTH_PARAM_LFO_3_MIDISYNC_BEATDIV:
voice_param_type = VOICE_PARAM_LFO_0_MIDISYNC_BEATDIV + (paramID - SYNTH_PARAM_LFO_0_MIDISYNC_BEATDIV);
break;
default:
break;
}
@@ -1153,7 +1166,7 @@ void JaySynth::handleMidiEvent (const MidiMessage& m)
if (m_isMidiClockStarted)
{
#if WITH_DEV_SYNCED_LFO
voiceSetMidiBeat(m_clock_cnt_bar % m_numMidiclocksPerQuarterNote);
voiceSetMidiBeat(m_clock_cnt_bar);
#endif
if (m_clock_cnt_bar % m_numMidiClocksPerBeat == 0)
{
@@ -1173,16 +1186,16 @@ void JaySynth::handleMidiEvent (const MidiMessage& m)
}
}
void JaySynth::voiceSetMidiBeat(int quarterBeatCount)
void JaySynth::voiceSetMidiBeat(int barBeatCount)
{
lfo_t *pLfo = &m_pVoices[0].pCom->glfo[0];
synth_float_t phase = Sync_mod(DEV_SYNCED_LFO_FACTOR*(synth_float_t)quarterBeatCount/m_numMidiclocksPerQuarterNote, 1.0);
synth_float_t phase = Sync_mod((synth_float_t)barBeatCount/m_numMidiClocksPerBar, 1.0);
LFO_sync(pLfo, phase);
for (int i=0; i < max_num_voices; i++)
{
JaySynthVoice* const voice = voices.getUnchecked (i);
voice->setMidiBeat(quarterBeatCount);
voice->setMidiBeat(barBeatCount);
}
}