Fixed code problems
This commit is contained in:
+16
-19
@@ -5,6 +5,7 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "synth/synth_types.h"
|
||||
#include "synth_defs.h"
|
||||
#include "vector_utils.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_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++)
|
||||
@@ -366,7 +367,7 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
|
||||
break;
|
||||
|
||||
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[1] = getPitch(pObj, 1);
|
||||
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_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);
|
||||
break;
|
||||
|
||||
@@ -471,8 +472,8 @@ void VoiceParam2Set(voice_t *pObj, UINT32 type, synth_float_t value)
|
||||
VCF_SetType(&pObj->vcf, (int)pObj->param[type]);
|
||||
if (pObj->id == 0)
|
||||
{
|
||||
VCF_SetType(&pObj->pCom->gvcf[0], pObj->param[type]);
|
||||
VCF_SetType(&pObj->pCom->gvcf[1], pObj->param[type]);
|
||||
VCF_SetType(&pObj->pCom->gvcf[0], (UINT32)pObj->param[type]);
|
||||
VCF_SetType(&pObj->pCom->gvcf[1], (UINT32)pObj->param[type]);
|
||||
}
|
||||
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);
|
||||
if (pObj->id == 0)
|
||||
{
|
||||
VCF_SetOrder(&pObj->pCom->gvcf[0], (int)(pObj->param[type]+1)*2);
|
||||
VCF_SetOrder(&pObj->pCom->gvcf[1], (int)(pObj->param[type]+1)*2);
|
||||
VCF_SetOrder(&pObj->pCom->gvcf[0], (UINT32)(pObj->param[type]+1)*2);
|
||||
VCF_SetOrder(&pObj->pCom->gvcf[1], (UINT32)(pObj->param[type]+1)*2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -696,14 +697,10 @@ void VoiceProcessDataV_Common(voice_t *pObj, float *pOut1, float *pOut2, UINT32
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
voice_common_t *pCom = pObj->pCom;
|
||||
synth_float_t *pModSrc[VOICE_NUM_MOD_SOURCES];
|
||||
synth_float_t env_gain;
|
||||
(void)pOut1;
|
||||
(void)pOut2;
|
||||
|
||||
// Temp Variables
|
||||
synth_float_t vcf_fm[SYNTH_MAX_BUFSIZE];
|
||||
synth_float_t vcf_qm[SYNTH_MAX_BUFSIZE];
|
||||
synth_float_t temp[SYNTH_MAX_BUFSIZE];
|
||||
voice_common_t *pCom = pObj->pCom;
|
||||
|
||||
// First voice only
|
||||
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];
|
||||
|
||||
#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)
|
||||
{
|
||||
@@ -915,13 +912,13 @@ void VoiceProcessDataV(voice_t *pObj, float *pOut1, float *pOut2, UINT32 len)
|
||||
// Process smoothing for VCO switching
|
||||
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
|
||||
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);
|
||||
}
|
||||
@@ -1210,9 +1207,9 @@ void VoiceProcessDataV(voice_t *pObj, float *pOut1, float *pOut2, UINT32 len)
|
||||
// Filter envelope and filtering
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user