- 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);
}
}
+104 -14
View File
@@ -1896,6 +1896,39 @@ JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcess
m_labelDebug->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
addAndMakeVisible (m_btn_midiClockLed = new ButtonLED (L"MidiClock"));
addAndMakeVisible (m_label_lfo0_midisync_factor = new Label ("LFO 1 Midi Sync. Factor",
TRANS("value")));
m_label_lfo0_midisync_factor->setTooltip (TRANS("LFO 1 Midi Sync. Factor"));
m_label_lfo0_midisync_factor->setFont (Font (14.00f, Font::plain));
m_label_lfo0_midisync_factor->setJustificationType (Justification::centred);
m_label_lfo0_midisync_factor->setEditable (true, true, false);
m_label_lfo0_midisync_factor->setColour (Label::outlineColourId, Colour (0x00000000));
m_label_lfo0_midisync_factor->setColour (TextEditor::textColourId, Colours::azure);
m_label_lfo0_midisync_factor->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
m_label_lfo0_midisync_factor->setColour (TextEditor::highlightColourId, Colour (0x00f7f7f7));
m_label_lfo0_midisync_factor->addListener (this);
addAndMakeVisible (m_slider_lfo0_midisync_divisor = new Slider ("LFO 1 Midi Sync Divisor"));
m_slider_lfo0_midisync_divisor->setTooltip (TRANS("LFO 1 Midi Sync Divisor"));
m_slider_lfo0_midisync_divisor->setRange (0, 1, 0);
m_slider_lfo0_midisync_divisor->setSliderStyle (Slider::RotaryVerticalDrag);
m_slider_lfo0_midisync_divisor->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
m_slider_lfo0_midisync_divisor->setColour (Slider::rotarySliderFillColourId, Colour (0x7fffffff));
m_slider_lfo0_midisync_divisor->setColour (Slider::rotarySliderOutlineColourId, Colour (0x66ffffff));
m_slider_lfo0_midisync_divisor->addListener (this);
addAndMakeVisible (m_comboBox_lfo0_midisync_mode = new ComboBox ("LFO 1 Midi Sync Mode"));
m_comboBox_lfo0_midisync_mode->setTooltip (TRANS("LFO 1 Midi Sync Mode"));
m_comboBox_lfo0_midisync_mode->setEditableText (false);
m_comboBox_lfo0_midisync_mode->setJustificationType (Justification::centred);
m_comboBox_lfo0_midisync_mode->setTextWhenNothingSelected (String::empty);
m_comboBox_lfo0_midisync_mode->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
m_comboBox_lfo0_midisync_mode->addItem (TRANS("Off"), 1);
m_comboBox_lfo0_midisync_mode->addItem (TRANS("F"), 2);
m_comboBox_lfo0_midisync_mode->addItem (TRANS("P"), 3);
m_comboBox_lfo0_midisync_mode->addItem (TRANS("F + P"), 4);
m_comboBox_lfo0_midisync_mode->addListener (this);
//[UserPreSize]
//[/UserPreSize]
@@ -2183,6 +2216,10 @@ JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcess
m_slider_lfo1_symmetry->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_1_SYMMETRY));
m_slider_lfo2_symmetry->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_2_SYMMETRY));
m_slider_lfo3_symmetry->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_3_SYMMETRY));
m_slider_lfo0_midisync_divisor->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_0_MIDISYNC_BEATDIV));
// m_slider_lfo1_midisync_divisor->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_1_MIDISYNC_BEATDIV));
// m_slider_lfo2_midisync_divisor->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_2_MIDISYNC_BEATDIV));
// m_slider_lfo3_midisync_divisor->setComponentID(String("SLIDER ") + String(SYNTH_PARAM_LFO_3_MIDISYNC_BEATDIV));
// --------------------------------------------------------------------
// Labels
@@ -2279,6 +2316,10 @@ JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcess
m_label_lfo1_symmetry->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_1_SYMMETRY));
m_label_lfo2_symmetry->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_2_SYMMETRY));
m_label_lfo3_symmetry->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_3_SYMMETRY));
m_label_lfo0_midisync_factor->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_0_MIDISYNC_BEATDIV));
// m_label_lfo1_midisync_factor->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_1_MIDISYNC_BEATDIV));
// m_label_lfo2_midisync_factor->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_2_MIDISYNC_BEATDIV));
// m_label_lfo3_midisync_factor->setComponentID(String("LABEL ") + String(SYNTH_PARAM_LFO_3_MIDISYNC_BEATDIV));
// --------------------------------------------------------------------
// Comboboxes
@@ -2313,6 +2354,11 @@ JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcess
m_comboBox_lfo3_shape->setComponentID(String("COMBOBOX ") + String(SYNTH_PARAM_LFO_3_SHAPE));
m_comboBox_vcf_order->setComponentID(String("COMBOBOX ") + String(SYNTH_PARAM_VCF_ORDER));
m_comboBox_lfo0_midisync_mode->setComponentID(String("COMBOBOX ") + String(SYNTH_PARAM_LFO_0_MIDISYNC_MODE));
// m_comboBox_lfo1_midisync_mode->setComponentID(String("COMBOBOX ") + String(SYNTH_PARAM_LFO_1_MIDISYNC_MODE));
// m_comboBox_lfo2_midisync_mode->setComponentID(String("COMBOBOX ") + String(SYNTH_PARAM_LFO_2_MIDISYNC_MODE));
// m_comboBox_lfo3_midisync_mode->setComponentID(String("COMBOBOX ") + String(SYNTH_PARAM_LFO_3_MIDISYNC_MODE));
// --------------------------------------------------------------------
getProcessor()->addActionListener(this);
@@ -2571,6 +2617,9 @@ JaySynthAudioProcessorEditor::~JaySynthAudioProcessorEditor()
m_label_num_voices_playing = nullptr;
m_labelDebug = nullptr;
m_btn_midiClockLed = nullptr;
m_label_lfo0_midisync_factor = nullptr;
m_slider_lfo0_midisync_divisor = nullptr;
m_comboBox_lfo0_midisync_mode = nullptr;
//[Destructor]. You can add your own custom destruction code here..
@@ -2843,7 +2892,7 @@ void JaySynthAudioProcessorEditor::paint (Graphics& g)
g.setColour (Colours::black);
g.setFont (Font (10.00f, Font::plain));
g.drawText (TRANS("Smooth"),
386, 120, 44, 16,
386, 256, 44, 16,
Justification::centred, true);
g.setColour (Colours::black);
@@ -3215,7 +3264,7 @@ void JaySynthAudioProcessorEditor::paint (Graphics& g)
g.setColour (Colours::black);
g.setFont (Font (10.00f, Font::plain));
g.drawText (TRANS("Symmetry"),
362, 256, 48, 16,
338, 256, 48, 16,
Justification::centred, true);
g.setColour (Colours::black);
@@ -3380,6 +3429,12 @@ void JaySynthAudioProcessorEditor::paint (Graphics& g)
966, 394, 100, 18,
Justification::centredRight, true);
g.setColour (Colours::black);
g.setFont (Font (10.00f, Font::plain));
g.drawText (TRANS("Divisor"),
386, 119, 48, 16,
Justification::centred, true);
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
@@ -3437,7 +3492,7 @@ void JaySynthAudioProcessorEditor::resized()
m_label_lfo1_speed->setBounds (452, 70, 52, 20);
m_comboBox_osc0_shape->setBounds (244, 68, 64, 16);
m_comboBox_osc1_shape->setBounds (244, 382, 64, 16);
m_comboBox_lfo0_shape->setBounds (354, 38, 64, 16);
m_comboBox_lfo0_shape->setBounds (355, 38, 64, 16);
m_comboBox_lfo1_shape->setBounds (470, 38, 64, 16);
m_slider_lfo2_speed->setBounds (346, 402, 36, 36);
m_slider_lfo3_speed->setBounds (460, 402, 36, 36);
@@ -3459,8 +3514,8 @@ void JaySynthAudioProcessorEditor::resized()
m_comboBox_vcf_type->setBounds (880, 74, 68, 16);
m_slider_lfo1_smooth->setBounds (506, 88, 36, 36);
m_label_lfo1_smooth->setBounds (498, 70, 52, 20);
m_slider_lfo0_smooth->setBounds (392, 88, 36, 36);
m_label_lfo0_smooth->setBounds (384, 70, 52, 20);
m_slider_lfo0_smooth->setBounds (392, 224, 36, 36);
m_label_lfo0_smooth->setBounds (384, 206, 52, 20);
m_slider_lfo2_smooth->setBounds (392, 402, 36, 36);
m_label_lfo2_smooth->setBounds (384, 384, 52, 20);
m_slider_lfo3_smooth->setBounds (506, 402, 36, 36);
@@ -3561,8 +3616,8 @@ void JaySynthAudioProcessorEditor::resized()
m_label_lfo3_attack->setBounds (498, 452, 52, 20);
m_button_lfo0_restart_enable->setBounds (356, 278, 16, 16);
m_button_lfo0_individual_enable->setBounds (402, 278, 16, 16);
m_slider_lfo0_symmetry->setBounds (370, 224, 36, 36);
m_label_lfo0_symmetry->setBounds (362, 206, 52, 20);
m_slider_lfo0_symmetry->setBounds (346, 224, 36, 36);
m_label_lfo0_symmetry->setBounds (338, 206, 52, 20);
m_slider_lfo1_symmetry->setBounds (484, 224, 36, 36);
m_label_lfo1_symmetry->setBounds (476, 206, 52, 20);
m_button_lfo1_restart_enable->setBounds (468, 277, 16, 16);
@@ -3596,6 +3651,9 @@ void JaySynthAudioProcessorEditor::resized()
m_label_num_voices_playing->setBounds (1060, 598, 42, 18);
m_labelDebug->setBounds (966, 274, 150, 24);
m_btn_midiClockLed->setBounds (1058, 272, 32, 32);
m_label_lfo0_midisync_factor->setBounds (384, 70, 52, 20);
m_slider_lfo0_midisync_divisor->setBounds (392, 88, 36, 36);
m_comboBox_lfo0_midisync_mode->setBounds (393, 12, 47, 16);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
@@ -4000,6 +4058,11 @@ void JaySynthAudioProcessorEditor::sliderValueChanged (Slider* sliderThatWasMove
//[UserSliderCode_m_slider_vcf_q_amt1] -- add your slider handling code here..
//[/UserSliderCode_m_slider_vcf_q_amt1]
}
else if (sliderThatWasMoved == m_slider_lfo0_midisync_divisor)
{
//[UserSliderCode_m_slider_lfo0_midisync_divisor] -- add your slider handling code here..
//[/UserSliderCode_m_slider_lfo0_midisync_divisor]
}
//[UsersliderValueChanged_Post]
//[/UsersliderValueChanged_Post]
@@ -4465,6 +4528,11 @@ void JaySynthAudioProcessorEditor::labelTextChanged (Label* labelThatHasChanged)
//[UserLabelCode_m_label_num_voices_playing] -- add your label text handling code here..
//[/UserLabelCode_m_label_num_voices_playing]
}
else if (labelThatHasChanged == m_label_lfo0_midisync_factor)
{
//[UserLabelCode_m_label_lfo0_midisync_factor] -- add your label text handling code here..
//[/UserLabelCode_m_label_lfo0_midisync_factor]
}
//[UserlabelTextChanged_Post]
//[/UserlabelTextChanged_Post]
@@ -4761,6 +4829,11 @@ void JaySynthAudioProcessorEditor::comboBoxChanged (ComboBox* comboBoxThatHasCha
//[UserComboBoxCode_m_comboBox_vcf_q_src1] -- add your combo box handling code here..
//[/UserComboBoxCode_m_comboBox_vcf_q_src1]
}
else if (comboBoxThatHasChanged == m_comboBox_lfo0_midisync_mode)
{
//[UserComboBoxCode_m_comboBox_lfo0_midisync_mode] -- add your combo box handling code here..
//[/UserComboBoxCode_m_comboBox_lfo0_midisync_mode]
}
//[UsercomboBoxChanged_Post]
//[/UsercomboBoxChanged_Post]
@@ -5335,7 +5408,7 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="878 54 72 16" fill="solid: ff000000" hasStroke="0" text="VCF type"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="386 120 44 16" fill="solid: ff000000" hasStroke="0" text="Smooth"
<TEXT pos="386 256 44 16" fill="solid: ff000000" hasStroke="0" text="Smooth"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="160 154 70 16" fill="solid: ff000000" hasStroke="0" text="PWM amt. 1"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
@@ -5459,7 +5532,7 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="384 502 48 16" fill="solid: ff000000" hasStroke="0" text="Attack"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="362 256 48 16" fill="solid: ff000000" hasStroke="0" text="Symmetry"
<TEXT pos="338 256 48 16" fill="solid: ff000000" hasStroke="0" text="Symmetry"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="500 290 44 16" fill="solid: ff000000" hasStroke="0" text="Polyphon"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
@@ -5515,6 +5588,8 @@ BEGIN_JUCER_METADATA
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
<TEXT pos="966 394 100 18" fill="solid: ffffffff" hasStroke="0" text="Max. Polyphony :"
fontname="Default font" fontsize="11" bold="0" italic="0" justification="34"/>
<TEXT pos="386 119 48 16" fill="solid: ff000000" hasStroke="0" text="Divisor"
fontname="Default font" fontsize="10" bold="0" italic="0" justification="36"/>
</BACKGROUND>
<LABEL name="Colon" id="49ecaccc9d2b3ddd" memberName="m_label_colon"
virtualName="" explicitFocusOrder="0" pos="220 660 24 28" textCol="ffffffff"
@@ -5770,7 +5845,7 @@ BEGIN_JUCER_METADATA
editable="0" layout="36" items="Saw&#10;Pulse&#10;Tri&#10;Sine&#10;Impulse"
textWhenNonSelected="" textWhenNoItems="(no choices)"/>
<COMBOBOX name="LFO 1 shape" id="4b842eb425ff0d67" memberName="m_comboBox_lfo0_shape"
virtualName="" explicitFocusOrder="0" pos="354 38 64 16" tooltip="LFO 1 shape"
virtualName="" explicitFocusOrder="0" pos="355 38 64 16" tooltip="LFO 1 shape"
editable="0" layout="36" items="Sine&#10;Cosine&#10;Saw&#10;Square&#10;Tri&#10;S&amp;H 1&#10;S&amp;H 2&#10;1-Sine&#10;1-Cosine&#10;1-Saw&#10;1-Square&#10;1-Tri"
textWhenNonSelected="" textWhenNoItems="(no choices)"/>
<COMBOBOX name="LFO 2 shape" id="f3beb17b618b89c7" memberName="m_comboBox_lfo1_shape"
@@ -5865,12 +5940,12 @@ BEGIN_JUCER_METADATA
focusDiscardsChanges="0" fontname="Default font" fontsize="14"
bold="0" italic="0" justification="36"/>
<SLIDER name="LFO 1 smooth" id="fb6d892c7346c915" memberName="m_slider_lfo0_smooth"
virtualName="" explicitFocusOrder="0" pos="392 88 36 36" tooltip="LFO 1 smooth [%]"
virtualName="" explicitFocusOrder="0" pos="392 224 36 36" tooltip="LFO 1 smooth [%]"
rotarysliderfill="7fffffff" rotaryslideroutline="66ffffff" min="0"
max="1" int="0" style="RotaryVerticalDrag" textBoxPos="NoTextBox"
textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
<LABEL name="LFO 1 smooth" id="4a0362e95d693bc2" memberName="m_label_lfo0_smooth"
virtualName="" explicitFocusOrder="0" pos="384 70 52 20" edTextCol="ff000000"
virtualName="" explicitFocusOrder="0" pos="384 206 52 20" edTextCol="ff000000"
edBkgCol="0" labelText="value" editableSingleClick="1" editableDoubleClick="1"
focusDiscardsChanges="0" fontname="Default font" fontsize="14"
bold="0" italic="0" justification="36"/>
@@ -6328,12 +6403,12 @@ BEGIN_JUCER_METADATA
txtcol="ffffffff" buttonText="" connectedEdges="0" needsCallback="0"
radioGroupId="0" state="0"/>
<SLIDER name="LFO 1 Symmetry" id="908862f0a9f4df90" memberName="m_slider_lfo0_symmetry"
virtualName="" explicitFocusOrder="0" pos="370 224 36 36" tooltip="LFO 1 Symmetry [%]"
virtualName="" explicitFocusOrder="0" pos="346 224 36 36" tooltip="LFO 1 Symmetry [%]"
rotarysliderfill="7fffffff" rotaryslideroutline="66ffffff" min="0"
max="1" int="0" style="RotaryVerticalDrag" textBoxPos="NoTextBox"
textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
<LABEL name="LFO 1 Symmetry" id="bb8547fe5f39b0b6" memberName="m_label_lfo0_symmetry"
virtualName="" explicitFocusOrder="0" pos="362 206 52 20" outlineCol="0"
virtualName="" explicitFocusOrder="0" pos="338 206 52 20" outlineCol="0"
edTextCol="fff0ffff" edBkgCol="0" hiliteCol="f7f7f7" labelText="value"
editableSingleClick="1" editableDoubleClick="1" focusDiscardsChanges="0"
fontname="Default font" fontsize="14" bold="0" italic="0" justification="36"/>
@@ -6494,6 +6569,21 @@ BEGIN_JUCER_METADATA
<JUCERCOMP name="MidiClock" id="5a40cdd54b6e8060" memberName="m_btn_midiClockLed"
virtualName="" explicitFocusOrder="0" pos="1058 272 32 32" sourceFile="ButtonLED.cpp"
constructorParams="L&quot;MidiClock&quot;"/>
<LABEL name="LFO 1 Midi Sync. Factor" id="5e64aafc6664225a" memberName="m_label_lfo0_midisync_factor"
virtualName="" explicitFocusOrder="0" pos="384 70 52 20" tooltip="LFO 1 Midi Sync. Factor"
outlineCol="0" edTextCol="fff0ffff" edBkgCol="0" hiliteCol="f7f7f7"
labelText="value" editableSingleClick="1" editableDoubleClick="1"
focusDiscardsChanges="0" fontname="Default font" fontsize="14"
bold="0" italic="0" justification="36"/>
<SLIDER name="LFO 1 Midi Sync Divisor" id="aa98192fcd0b651c" memberName="m_slider_lfo0_midisync_divisor"
virtualName="" explicitFocusOrder="0" pos="392 88 36 36" tooltip="LFO 1 Midi Sync Divisor"
rotarysliderfill="7fffffff" rotaryslideroutline="66ffffff" min="0"
max="1" int="0" style="RotaryVerticalDrag" textBoxPos="NoTextBox"
textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
<COMBOBOX name="LFO 1 Midi Sync Mode" id="4d7c3239958eae23" memberName="m_comboBox_lfo0_midisync_mode"
virtualName="" explicitFocusOrder="0" pos="393 12 47 16" tooltip="LFO 1 Midi Sync Mode"
editable="0" layout="36" items="Off&#10;F&#10;P&#10;F + P" textWhenNonSelected=""
textWhenNoItems="(no choices)"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
+3
View File
@@ -315,6 +315,9 @@ private:
ScopedPointer<Label> m_label_num_voices_playing;
ScopedPointer<Label> m_labelDebug;
ScopedPointer<ButtonLED> m_btn_midiClockLed;
ScopedPointer<Label> m_label_lfo0_midisync_factor;
ScopedPointer<Slider> m_slider_lfo0_midisync_divisor;
ScopedPointer<ComboBox> m_comboBox_lfo0_midisync_mode;
//==============================================================================
+53 -17
View File
@@ -71,15 +71,17 @@ synth_float_t phase_det(synth_float_t lo, synth_float_t ref)
return perr;
}
void Sync_init(sync_t *pObj)
void Sync_init(sync_t *pObj, lfo_t *pLfo)
{
pObj->phase = 0;
pObj->phase_int = 0;
pObj->phase_ref = 0;
pObj->omega = 0.0;
pObj->accu = 0;
pObj->klead = 1.0;
pObj->klag = 0.04/200;
pObj->phase_update = 0;
pObj->pLfo = pLfo;
}
void Sync_phase_update(sync_t *pObj, synth_float_t phase_ref)
@@ -90,8 +92,35 @@ void Sync_phase_update(sync_t *pObj, synth_float_t phase_ref)
sync_result_t Sync_process(sync_t *pObj, synth_float_t omega_base)
{
int sync_mode = (int)pObj->pLfo->param[LFO_PARAM2_MIDISYNC_MODE];
synth_float_t phase_ref = pObj->phase_ref;
sync_result_t result;
result.phase = Sync_mod(pObj->phase + pObj->omega, 1.0);
pObj->phase_int = Sync_mod(pObj->phase_int + pObj->omega, 1.0);
switch (sync_mode)
{
case LFO_SYNC_MODE_OFF:
pObj->phase = Sync_mod(pObj->phase + omega_base, 1.0);
break;
case LFO_SYNC_MODE_F:
pObj->phase = Sync_mod(pObj->phase + pObj->omega, 1.0);
break;
case LFO_SYNC_MODE_F_P:
pObj->phase = pObj->phase_int;
break;
case LFO_SYNC_MODE_P:
pObj->phase = Sync_mod(pObj->phase + omega_base, 1.0);
if (pObj->phase_update && phase_ref == 0)
{
pObj->phase = 0;
}
break;
}
result.phase = Sync_mod(pObj->phase, 1.0);
result.is_cycle_start = (pObj->phase > result.phase);
pObj->phase = result.phase;
@@ -99,8 +128,8 @@ sync_result_t Sync_process(sync_t *pObj, synth_float_t omega_base)
if (pObj->phase_update)
{
pObj->phase_update = 0;
perr = phase_det(pObj->phase, pObj->phase_ref);
SynthDebug("phase_ref=%f, phase_lo=%f, perr=%f\n", pObj->phase_ref, pObj->phase, perr);
perr = phase_det(pObj->phase_int, phase_ref);
SynthDebug("phase_ref=%f, phase_lo=%f, perr=%f\n", phase_ref, pObj->phase_int, perr);
// SynthDebug("syncOnFreqUpdate(): BPM=%f\n", omega*pObj->fs*60);
}
@@ -136,7 +165,7 @@ void LFO_Init(lfo_t *pObj, synth_float_t fs)
Noise_Init(&pObj->noise, 1+(UINT32)clock() * (UINT32)clock());
Sync_init(&pObj->sync);
Sync_init(&pObj->sync, pObj);
}
void LFO_Free(lfo_t *pObj)
@@ -170,6 +199,7 @@ void LFO_SetFS(lfo_t *pObj, synth_float_t fs)
void LFO_Reset(lfo_t *pObj, synth_float_t initial_phase)
{
pObj->sync.phase = initial_phase;
pObj->smooth_out = 0;
pObj->delay_x = 0;
pObj->attack_y = 0;
@@ -180,43 +210,49 @@ void LFO_Reset(lfo_t *pObj, synth_float_t initial_phase)
void LFO_sync(lfo_t *pObj, synth_float_t phase_ref)
{
synth_float_t note_1_x = pObj->param[LFO_PARAM2_MIDISYNC_BEATDIV];
phase_ref = Sync_mod(note_1_x*phase_ref, 1.0);
Sync_phase_update(&pObj->sync, phase_ref);
}
void LFO_Param2Set(lfo_t *pObj, UINT32 type, synth_float_t value)
{
int param_changed = 0;
if (pObj->param[type] != value)
{
pObj->param[type] = value;
param_changed = 1;
}
switch(type)
{
case LFO_PARAM2_WAVEFORM:
if (pObj->param[type] == (UINT32)value)
break;
pObj->param[type] = (UINT32)value;
pObj->freq_update_req = 1;
pObj->freq_update_req = param_changed;
break;
case LFO_PARAM2_FREQ:
pObj->param[type] = value;
pObj->freq_update_req = 1;
pObj->freq_update_req = param_changed;
break;
case LFO_PARAM2_SMOOTH:
pObj->param[type] = value;
if (param_changed)
{
LFO_smmother_update(pObj);
}
break;
case LFO_PARAM2_DELAY:
pObj->param[type] = value;
pObj->freq_update_req = 1;
pObj->freq_update_req = param_changed;
break;
case LFO_PARAM2_ATTACK:
pObj->param[type] = value;
pObj->freq_update_req = 1;
pObj->freq_update_req = param_changed;
break;
case LFO_PARAM2_SYMMETRY:
pObj->param[type] = value;
if (param_changed)
{
pObj->offset = 0.5 *value;
}
break;
default:
+14 -1
View File
@@ -29,6 +29,15 @@ enum
LFO_NUM_WAVEFORMS
};
enum
{
LFO_SYNC_MODE_OFF,
LFO_SYNC_MODE_F,
LFO_SYNC_MODE_P,
LFO_SYNC_MODE_F_P,
LFO_NUM_SYNC_MODES
};
enum
{
LFO_PARAM2_WAVEFORM,
@@ -37,12 +46,15 @@ enum
LFO_PARAM2_DELAY,
LFO_PARAM2_ATTACK,
LFO_PARAM2_SYMMETRY,
LFO_PARAM2_MIDISYNC_MODE,
LFO_PARAM2_MIDISYNC_BEATDIV,
LFO_NUM_PARAMS
};
typedef struct _ssync_t
{
synth_float_t phase;
synth_float_t phase_int;
synth_float_t phase_ref;
synth_float_t omega;
@@ -51,6 +63,7 @@ typedef struct _ssync_t
synth_float_t accu;
int phase_update;
struct _slfo_t *pLfo;
} sync_t;
@@ -68,7 +81,7 @@ extern "C" {
// --------------------------------------------------------------
// Exported functions
// --------------------------------------------------------------
void Sync_init(sync_t *pObj);
void Sync_init(sync_t *pObj, struct _slfo_t *pLfo);
void Sync_phase_update(sync_t *pObj, synth_float_t phase_ref);
sync_result_t Sync_process(sync_t *pObj, synth_float_t omega_base);
synth_float_t Sync_mod(synth_float_t x, synth_float_t y);
+41 -1
View File
@@ -672,7 +672,47 @@ static const param_info_t param_info[] =
SYNTH_PARAM_LFO_3_SYMMETRY,
"LFO 4 symmetry",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.5, /*min*/-100, /*pcenter*/0, /*max*/100, /*interval*/0.1
}
},
{
SYNTH_PARAM_LFO_0_MIDISYNC_MODE,
"LFO 1 Midi Sync Mode",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/0, /*pcenter*/-1, /*max*/LFO_NUM_SYNC_MODES-1, /*interval*/1
},
{
SYNTH_PARAM_LFO_1_MIDISYNC_MODE,
"LFO 2 Midi Sync Mode",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/0, /*pcenter*/-1, /*max*/LFO_NUM_SYNC_MODES-1, /*interval*/1
},
{
SYNTH_PARAM_LFO_2_MIDISYNC_MODE,
"LFO 3 Midi Sync Mode",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/0, /*pcenter*/-1, /*max*/LFO_NUM_SYNC_MODES-1, /*interval*/1
},
{
SYNTH_PARAM_LFO_3_MIDISYNC_MODE,
"LFO 4 Midi Sync Mode",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/0, /*pcenter*/-1, /*max*/LFO_NUM_SYNC_MODES-1, /*interval*/1
},
{
SYNTH_PARAM_LFO_0_MIDISYNC_BEATDIV,
"LFO 1 Midi Sync Beat Divisor",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/1, /*pcenter*/-1, /*max*/32, /*interval*/1
},
{
SYNTH_PARAM_LFO_1_MIDISYNC_BEATDIV,
"LFO 2 Midi Sync Beat Divisor",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/1, /*pcenter*/-1, /*max*/32, /*interval*/1
},
{
SYNTH_PARAM_LFO_2_MIDISYNC_BEATDIV,
"LFO 3 Midi Sync Beat Divisor",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/1, /*pcenter*/-1, /*max*/32, /*interval*/1
},
{
SYNTH_PARAM_LFO_3_MIDISYNC_BEATDIV,
"LFO 4 Midi Sync Beat Divisor",
/*Base*/1.0, /*kexp*/1.0, /*scenter*/0.0, /*min*/1, /*pcenter*/-1, /*max*/32, /*interval*/1
},
};
// --------------------------------------------------------------
+8
View File
@@ -139,6 +139,14 @@ enum
SYNTH_PARAM_LFO_1_SYMMETRY,
SYNTH_PARAM_LFO_2_SYMMETRY,
SYNTH_PARAM_LFO_3_SYMMETRY,
SYNTH_PARAM_LFO_0_MIDISYNC_MODE,
SYNTH_PARAM_LFO_1_MIDISYNC_MODE,
SYNTH_PARAM_LFO_2_MIDISYNC_MODE,
SYNTH_PARAM_LFO_3_MIDISYNC_MODE,
SYNTH_PARAM_LFO_0_MIDISYNC_BEATDIV,
SYNTH_PARAM_LFO_1_MIDISYNC_BEATDIV,
SYNTH_PARAM_LFO_2_MIDISYNC_BEATDIV,
SYNTH_PARAM_LFO_3_MIDISYNC_BEATDIV,
SYNTH_NUM_PARAMS
};
+25
View File
@@ -651,6 +651,31 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
}
break;
case VOICE_PARAM_LFO_0_MIDISYNC_MODE:
case VOICE_PARAM_LFO_1_MIDISYNC_MODE:
case VOICE_PARAM_LFO_2_MIDISYNC_MODE:
case VOICE_PARAM_LFO_3_MIDISYNC_MODE:
LFO_Param2Set(&pObj->lfo[type-VOICE_PARAM_LFO_0_MIDISYNC_MODE], LFO_PARAM2_MIDISYNC_MODE, (int)pObj->param[type]);
// First voice sets params for global LFOs
if (pObj->id == 0)
{
LFO_Param2Set(&pObj->pCom->glfo[type-VOICE_PARAM_LFO_0_MIDISYNC_MODE], LFO_PARAM2_MIDISYNC_MODE, pObj->param[type]);
}
break;
case VOICE_PARAM_LFO_0_MIDISYNC_BEATDIV:
case VOICE_PARAM_LFO_1_MIDISYNC_BEATDIV:
case VOICE_PARAM_LFO_2_MIDISYNC_BEATDIV:
case VOICE_PARAM_LFO_3_MIDISYNC_BEATDIV:
LFO_Param2Set(&pObj->lfo[type-VOICE_PARAM_LFO_0_MIDISYNC_BEATDIV], LFO_PARAM2_MIDISYNC_BEATDIV, (int)pObj->param[type]);
// First voice sets params for global LFOs
if (pObj->id == 0)
{
LFO_Param2Set(&pObj->pCom->glfo[type-VOICE_PARAM_LFO_0_MIDISYNC_BEATDIV], LFO_PARAM2_MIDISYNC_BEATDIV, pObj->param[type]);
}
break;
default:
break;
+8
View File
@@ -142,6 +142,14 @@ enum
VOICE_PARAM_LFO_1_SYMMETRY,
VOICE_PARAM_LFO_2_SYMMETRY,
VOICE_PARAM_LFO_3_SYMMETRY,
VOICE_PARAM_LFO_0_MIDISYNC_MODE,
VOICE_PARAM_LFO_1_MIDISYNC_MODE,
VOICE_PARAM_LFO_2_MIDISYNC_MODE,
VOICE_PARAM_LFO_3_MIDISYNC_MODE,
VOICE_PARAM_LFO_0_MIDISYNC_BEATDIV,
VOICE_PARAM_LFO_1_MIDISYNC_BEATDIV,
VOICE_PARAM_LFO_2_MIDISYNC_BEATDIV,
VOICE_PARAM_LFO_3_MIDISYNC_BEATDIV,
VOICE_NUM_PARAMS
};