Fixed code problems

This commit is contained in:
2025-08-08 16:35:04 +02:00
parent 2ec3cc9543
commit f05e3be55f
3 changed files with 40 additions and 43 deletions
+22 -22
View File
@@ -726,24 +726,6 @@ JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcess
m_comboBox_vcf_type->addItem (TRANS("BPF"), 3); m_comboBox_vcf_type->addItem (TRANS("BPF"), 3);
m_comboBox_vcf_type->addListener (this); m_comboBox_vcf_type->addListener (this);
addAndMakeVisible (m_slider_lfo1_smooth = new Slider ("LFO 2 smooth"));
m_slider_lfo1_smooth->setTooltip (TRANS("LFO 2 smooth [%]"));
m_slider_lfo1_smooth->setRange (0, 1, 0);
m_slider_lfo1_smooth->setSliderStyle (Slider::RotaryVerticalDrag);
m_slider_lfo1_smooth->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
m_slider_lfo1_smooth->setColour (Slider::rotarySliderFillColourId, Colour (0x7fffffff));
m_slider_lfo1_smooth->setColour (Slider::rotarySliderOutlineColourId, Colour (0x66ffffff));
m_slider_lfo1_smooth->addListener (this);
addAndMakeVisible (m_label_lfo1_smooth = new Label ("LFO 2 smooth",
TRANS("value")));
m_label_lfo1_smooth->setFont (Font (14.00f, Font::plain));
m_label_lfo1_smooth->setJustificationType (Justification::centred);
m_label_lfo1_smooth->setEditable (true, true, false);
m_label_lfo1_smooth->setColour (TextEditor::textColourId, Colours::black);
m_label_lfo1_smooth->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
m_label_lfo1_smooth->addListener (this);
addAndMakeVisible (m_slider_lfo0_smooth = new Slider ("LFO 1 smooth")); addAndMakeVisible (m_slider_lfo0_smooth = new Slider ("LFO 1 smooth"));
m_slider_lfo0_smooth->setTooltip (TRANS("LFO 1 smooth [%]")); m_slider_lfo0_smooth->setTooltip (TRANS("LFO 1 smooth [%]"));
m_slider_lfo0_smooth->setRange (0, 1, 0); m_slider_lfo0_smooth->setRange (0, 1, 0);
@@ -762,6 +744,24 @@ JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcess
m_label_lfo0_smooth->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); m_label_lfo0_smooth->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
m_label_lfo0_smooth->addListener (this); m_label_lfo0_smooth->addListener (this);
addAndMakeVisible (m_slider_lfo1_smooth = new Slider ("LFO 2 smooth"));
m_slider_lfo1_smooth->setTooltip (TRANS("LFO 2 smooth [%]"));
m_slider_lfo1_smooth->setRange (0, 1, 0);
m_slider_lfo1_smooth->setSliderStyle (Slider::RotaryVerticalDrag);
m_slider_lfo1_smooth->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
m_slider_lfo1_smooth->setColour (Slider::rotarySliderFillColourId, Colour (0x7fffffff));
m_slider_lfo1_smooth->setColour (Slider::rotarySliderOutlineColourId, Colour (0x66ffffff));
m_slider_lfo1_smooth->addListener (this);
addAndMakeVisible (m_label_lfo1_smooth = new Label ("LFO 2 smooth",
TRANS("value")));
m_label_lfo1_smooth->setFont (Font (14.00f, Font::plain));
m_label_lfo1_smooth->setJustificationType (Justification::centred);
m_label_lfo1_smooth->setEditable (true, true, false);
m_label_lfo1_smooth->setColour (TextEditor::textColourId, Colours::black);
m_label_lfo1_smooth->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
m_label_lfo1_smooth->addListener (this);
addAndMakeVisible (m_slider_lfo2_smooth = new Slider ("LFO 3 smooth")); addAndMakeVisible (m_slider_lfo2_smooth = new Slider ("LFO 3 smooth"));
m_slider_lfo2_smooth->setTooltip (TRANS("LFO 3 smooth [%]")); m_slider_lfo2_smooth->setTooltip (TRANS("LFO 3 smooth [%]"));
m_slider_lfo2_smooth->setRange (0, 1, 0); m_slider_lfo2_smooth->setRange (0, 1, 0);
@@ -2497,10 +2497,10 @@ JaySynthAudioProcessorEditor::~JaySynthAudioProcessorEditor()
m_label_synth_name = nullptr; m_label_synth_name = nullptr;
m_label_synth_version = nullptr; m_label_synth_version = nullptr;
m_comboBox_vcf_type = nullptr; m_comboBox_vcf_type = nullptr;
m_slider_lfo1_smooth = nullptr;
m_label_lfo1_smooth = nullptr;
m_slider_lfo0_smooth = nullptr; m_slider_lfo0_smooth = nullptr;
m_label_lfo0_smooth = nullptr; m_label_lfo0_smooth = nullptr;
m_slider_lfo1_smooth = nullptr;
m_label_lfo1_smooth = nullptr;
m_slider_lfo2_smooth = nullptr; m_slider_lfo2_smooth = nullptr;
m_label_lfo2_smooth = nullptr; m_label_lfo2_smooth = nullptr;
m_slider_lfo3_smooth = nullptr; m_slider_lfo3_smooth = nullptr;
@@ -3535,10 +3535,10 @@ void JaySynthAudioProcessorEditor::resized()
m_label_synth_name->setBounds (12, 662, 92, 24); m_label_synth_name->setBounds (12, 662, 92, 24);
m_label_synth_version->setBounds (978, 662, 132, 24); m_label_synth_version->setBounds (978, 662, 132, 24);
m_comboBox_vcf_type->setBounds (880, 74, 68, 16); 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, 224, 36, 36); m_slider_lfo0_smooth->setBounds (392, 224, 36, 36);
m_label_lfo0_smooth->setBounds (384, 206, 52, 20); m_label_lfo0_smooth->setBounds (384, 206, 52, 20);
m_slider_lfo1_smooth->setBounds (506, 88, 36, 36);
m_label_lfo1_smooth->setBounds (498, 70, 52, 20);
m_slider_lfo2_smooth->setBounds (392, 402, 36, 36); m_slider_lfo2_smooth->setBounds (392, 402, 36, 36);
m_label_lfo2_smooth->setBounds (384, 384, 52, 20); m_label_lfo2_smooth->setBounds (384, 384, 52, 20);
m_slider_lfo3_smooth->setBounds (506, 402, 36, 36); m_slider_lfo3_smooth->setBounds (506, 402, 36, 36);
+2 -2
View File
@@ -177,10 +177,10 @@ private:
ScopedPointer<Label> m_label_synth_name; ScopedPointer<Label> m_label_synth_name;
ScopedPointer<Label> m_label_synth_version; ScopedPointer<Label> m_label_synth_version;
ScopedPointer<ComboBox> m_comboBox_vcf_type; ScopedPointer<ComboBox> m_comboBox_vcf_type;
ScopedPointer<Slider> m_slider_lfo1_smooth;
ScopedPointer<Label> m_label_lfo1_smooth;
ScopedPointer<Slider> m_slider_lfo0_smooth; ScopedPointer<Slider> m_slider_lfo0_smooth;
ScopedPointer<Label> m_label_lfo0_smooth; ScopedPointer<Label> m_label_lfo0_smooth;
ScopedPointer<Slider> m_slider_lfo1_smooth;
ScopedPointer<Label> m_label_lfo1_smooth;
ScopedPointer<Slider> m_slider_lfo2_smooth; ScopedPointer<Slider> m_slider_lfo2_smooth;
ScopedPointer<Label> m_label_lfo2_smooth; ScopedPointer<Label> m_label_lfo2_smooth;
ScopedPointer<Slider> m_slider_lfo3_smooth; ScopedPointer<Slider> m_slider_lfo3_smooth;
+16 -19
View File
@@ -5,6 +5,7 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include "synth/synth_types.h"
#include "synth_defs.h" #include "synth_defs.h"
#include "vector_utils.h" #include "vector_utils.h"
#include "voice.h" #include "voice.h"
@@ -280,7 +281,7 @@ void VoiceEvent(voice_t *pObj, UINT32 type)
VCO_Reset(&pObj->vco[i], pObj->param[VOICE_PARAM_OSC_0_PHASE+i]); VCO_Reset(&pObj->vco[i], pObj->param[VOICE_PARAM_OSC_0_PHASE+i]);
VCO_Start(&pObj->vco[i]); VCO_Start(&pObj->vco[i]);
Smooth_SetValue(&pObj->smooth_vco_enable[i], pObj->param[VOICE_PARAM_OSC_0_ENABLE+i]*(1E-6+pObj->param[VOICE_PARAM_OSC_0_LEVEL+i])); Smooth_SetValue(&pObj->smooth_vco_enable[i], pObj->param[VOICE_PARAM_OSC_0_ENABLE+i]*((synth_float_t)1E-6+pObj->param[VOICE_PARAM_OSC_0_LEVEL+i]));
} }
for (i = 0; i < VOICE_NUM_LFO; i++) for (i = 0; i < VOICE_NUM_LFO; i++)
@@ -366,7 +367,7 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
break; break;
case VOICE_PARAM_MASTER_TUNE: case VOICE_PARAM_MASTER_TUNE:
pObj->param[type] = pow(2, value/(12*100)); pObj->param[type] = pow(2, (double)value/(double)(12*100));
pObj->vco_pitch[0] = getPitch(pObj, 0); pObj->vco_pitch[0] = getPitch(pObj, 0);
pObj->vco_pitch[1] = getPitch(pObj, 1); pObj->vco_pitch[1] = getPitch(pObj, 1);
break; break;
@@ -389,7 +390,7 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
case VOICE_PARAM_OSC_0_DETUNE: case VOICE_PARAM_OSC_0_DETUNE:
case VOICE_PARAM_OSC_1_DETUNE: case VOICE_PARAM_OSC_1_DETUNE:
pObj->param[type] = pow(2, value/(12*100)); pObj->param[type] = pow(2, (double)value/(double)(12*100));
pObj->vco_pitch[type-VOICE_PARAM_OSC_0_DETUNE] = getPitch(pObj, type-VOICE_PARAM_OSC_0_DETUNE); pObj->vco_pitch[type-VOICE_PARAM_OSC_0_DETUNE] = getPitch(pObj, type-VOICE_PARAM_OSC_0_DETUNE);
break; break;
@@ -471,8 +472,8 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
VCF_SetType(&pObj->vcf, (int)pObj->param[type]); VCF_SetType(&pObj->vcf, (int)pObj->param[type]);
if (pObj->id == 0) if (pObj->id == 0)
{ {
VCF_SetType(&pObj->pCom->gvcf[0], pObj->param[type]); VCF_SetType(&pObj->pCom->gvcf[0], (UINT32)pObj->param[type]);
VCF_SetType(&pObj->pCom->gvcf[1], pObj->param[type]); VCF_SetType(&pObj->pCom->gvcf[1], (UINT32)pObj->param[type]);
} }
break; break;
@@ -480,8 +481,8 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
VCF_SetOrder(&pObj->vcf, (int)(pObj->param[type]+1)*2); VCF_SetOrder(&pObj->vcf, (int)(pObj->param[type]+1)*2);
if (pObj->id == 0) if (pObj->id == 0)
{ {
VCF_SetOrder(&pObj->pCom->gvcf[0], (int)(pObj->param[type]+1)*2); VCF_SetOrder(&pObj->pCom->gvcf[0], (UINT32)(pObj->param[type]+1)*2);
VCF_SetOrder(&pObj->pCom->gvcf[1], (int)(pObj->param[type]+1)*2); VCF_SetOrder(&pObj->pCom->gvcf[1], (UINT32)(pObj->param[type]+1)*2);
} }
break; break;
@@ -696,14 +697,10 @@ void VoiceProcessDataV_Common(voice_t *pObj, float *pOut1, float *pOut2, UINT32
{ {
UINT32 i; UINT32 i;
voice_common_t *pCom = pObj->pCom; (void)pOut1;
synth_float_t *pModSrc[VOICE_NUM_MOD_SOURCES]; (void)pOut2;
synth_float_t env_gain;
// Temp Variables voice_common_t *pCom = pObj->pCom;
synth_float_t vcf_fm[SYNTH_MAX_BUFSIZE];
synth_float_t vcf_qm[SYNTH_MAX_BUFSIZE];
synth_float_t temp[SYNTH_MAX_BUFSIZE];
// First voice only // First voice only
if (pObj->id == 0) if (pObj->id == 0)
@@ -814,7 +811,7 @@ void VoiceProcessDataV_Common(voice_t *pObj, float *pOut1, float *pOut2, UINT32
pOut2[i] = pCom->pBuf_VCF_gbl_out[i]; pOut2[i] = pCom->pBuf_VCF_gbl_out[i];
#endif #endif
if (pObj->param[VOICE_PARAM_NOISE_ENABLE] > 0.5) if (pObj->param[VOICE_PARAM_NOISE_ENABLE] > (synth_float_t)0.5)
{ {
if ((int)pObj->param[VOICE_PARAM_NOISE_SHAPE] == VOICE_NOISE_SHAPE_WHITE) if ((int)pObj->param[VOICE_PARAM_NOISE_SHAPE] == VOICE_NOISE_SHAPE_WHITE)
{ {
@@ -915,13 +912,13 @@ void VoiceProcessDataV(voice_t *pObj, float *pOut1, float *pOut2, UINT32 len)
// Process smoothing for VCO switching // Process smoothing for VCO switching
for (i=0; i < (INT32)VOICE_NUM_OSC; i++) for (i=0; i < (INT32)VOICE_NUM_OSC; i++)
{ {
vco_is_disabled[i] = Smooth_is_settled(&pObj->smooth_vco_enable[i], 0) && (pObj->param[VOICE_PARAM_OSC_0_ENABLE+i] < 0.5); vco_is_disabled[i] = Smooth_is_settled(&pObj->smooth_vco_enable[i], 0) && (UINT32)(pObj->param[VOICE_PARAM_OSC_0_ENABLE+i] < (synth_float_t)0.5);
} }
// Process pitche for VCOs // Process pitche for VCOs
for (i=0; i < (INT32)VOICE_NUM_OSC; i++) for (i=0; i < (INT32)VOICE_NUM_OSC; i++)
{ {
if (pObj->param[VOICE_PARAM_PORTAMENTO_TIME] <= 0.001) if (pObj->param[VOICE_PARAM_PORTAMENTO_TIME] <= (synth_float_t)0.001)
{ {
Add_inplace_VS(vco_pitch[i], 0, pObj->vco_pitch[i], len); Add_inplace_VS(vco_pitch[i], 0, pObj->vco_pitch[i], len);
} }
@@ -1210,9 +1207,9 @@ void VoiceProcessDataV(voice_t *pObj, float *pOut1, float *pOut2, UINT32 len)
// Filter envelope and filtering // Filter envelope and filtering
for (i=0; i < (INT32)VOICE_NUM_OSC; i++) for (i=0; i < (INT32)VOICE_NUM_OSC; i++)
{ {
vco_is_disabled[i] = Smooth_is_settled(&pObj->smooth_vco_enable[i], 0) && (pObj->param[VOICE_PARAM_OSC_0_ENABLE+i] < 0.5); vco_is_disabled[i] = Smooth_is_settled(&pObj->smooth_vco_enable[i], 0) && (pObj->param[VOICE_PARAM_OSC_0_ENABLE+i] < (synth_float_t)0.5);
} }
if (vco_is_disabled[0] && vco_is_disabled[1] && (pObj->param[VOICE_PARAM_NOISE_ENABLE] < 0.5)) if (vco_is_disabled[0] && vco_is_disabled[1] && (pObj->param[VOICE_PARAM_NOISE_ENABLE] < (synth_float_t)0.5))
{ {
pBuf_Postvcf = osc_out; pBuf_Postvcf = osc_out;
} }