- humanizing based on jittered slider positions
git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@267 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+31
-13
@@ -79,15 +79,18 @@ JaySynth::JaySynth (int num_voices, String pathToWaves)
|
||||
|
||||
// Init humanize parameter from global parameter constraints
|
||||
humanize_voice_param = new param_info_t*[SYNTH_NUM_PARAMS];
|
||||
|
||||
ppHumanizedSliders = new synth_float_t*[SYNTH_NUM_PARAMS];
|
||||
|
||||
for (i=0; i < SYNTH_NUM_PARAMS; i++)
|
||||
{
|
||||
humanize_voice_param[i] = new param_info_t[max_num_voices];
|
||||
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);
|
||||
paramInfoInit(&humanize_voice_param[i][j], getParamInfo(i)->id, paramName);
|
||||
paramInfoCopy(&humanize_voice_param[i][j], getParamInfo(i));
|
||||
ppHumanizedSliders[i][j] = 0;
|
||||
}
|
||||
}
|
||||
updateParameters();
|
||||
@@ -126,8 +129,10 @@ JaySynth::~JaySynth()
|
||||
paramInfoFree(&humanize_voice_param[i][j]);
|
||||
}
|
||||
delete (humanize_voice_param[i]);
|
||||
delete (ppHumanizedSliders[i]);
|
||||
}
|
||||
delete (humanize_voice_param);
|
||||
delete (ppHumanizedSliders);
|
||||
|
||||
for (i = max_num_voices; --i >= 0;)
|
||||
removeVoice(i);
|
||||
@@ -179,6 +184,8 @@ void JaySynth::humanizeParam (int paramID, bool useRandom, UINT32 random_seed, s
|
||||
/*pcenter*/-1E6/*getParamInfo(i)->pcenter*/,
|
||||
/*pmax*/getParamInfo(paramID)->pmax * (1+spread),
|
||||
/*pinterval*/0);
|
||||
|
||||
ppHumanizedSliders[paramID][j] = spread;
|
||||
}
|
||||
Noise_Free(&noise);
|
||||
#else
|
||||
@@ -249,14 +256,14 @@ void JaySynth::humanizeModeChanged(void)
|
||||
void JaySynth::humanizeVarianceChanged_VCO(void)
|
||||
{
|
||||
#ifdef WITH_OLD_HUMANIZE
|
||||
humanizeParam(SYNTH_PARAM_TUNE, true, 0x1234561, 0, 0.2*humanize_var_vco);
|
||||
humanizeParam(SYNTH_PARAM_OSC_0_DETUNE, true, 0x293857, 0, 2*humanize_var_vco);
|
||||
humanizeParam(SYNTH_PARAM_OSC_1_DETUNE, true, 0x137573, 0, 2*humanize_var_vco);
|
||||
humanizeParam(SYNTH_PARAM_TUNE, true, 0x1234561, 0, 0.5*humanize_var_vco);
|
||||
// humanizeParam(SYNTH_PARAM_OSC_0_DETUNE, true, 0x293857, 0, humanize_var_vco);
|
||||
// humanizeParam(SYNTH_PARAM_OSC_1_DETUNE, true, 0x137573, 0, humanize_var_vco);
|
||||
|
||||
// Re-Read parameter
|
||||
setParameter(SYNTH_PARAM_TUNE, params[SYNTH_PARAM_TUNE]);
|
||||
setParameter(SYNTH_PARAM_OSC_0_DETUNE, params[SYNTH_PARAM_OSC_0_DETUNE]);
|
||||
setParameter(SYNTH_PARAM_OSC_1_DETUNE, params[SYNTH_PARAM_OSC_1_DETUNE]);
|
||||
// setParameter(SYNTH_PARAM_OSC_0_DETUNE, params[SYNTH_PARAM_OSC_0_DETUNE]);
|
||||
// setParameter(SYNTH_PARAM_OSC_1_DETUNE, params[SYNTH_PARAM_OSC_1_DETUNE]);
|
||||
#else
|
||||
int i;
|
||||
synth_float_t f_ref;
|
||||
@@ -280,8 +287,8 @@ void JaySynth::humanizeVarianceChanged_VCO(void)
|
||||
|
||||
void JaySynth::humanizeVarianceChanged_VCF(void)
|
||||
{
|
||||
humanizeParam(SYNTH_PARAM_VCF_F, true, 0x1234561, 0, 2*humanize_var_vcf);
|
||||
humanizeParam(SYNTH_PARAM_VCF_Q, true, 0x1234561, 0, 0.2*humanize_var_vcf);
|
||||
humanizeParam(SYNTH_PARAM_VCF_F, true, 0x1234561, 0, 0.5*humanize_var_vcf);
|
||||
humanizeParam(SYNTH_PARAM_VCF_Q, true, 0x1234561, 0, 0.05*humanize_var_vcf);
|
||||
|
||||
// Re-Read parameter
|
||||
setParameter(SYNTH_PARAM_VCF_F, params[SYNTH_PARAM_VCF_F]);
|
||||
@@ -781,17 +788,16 @@ void JaySynth::setParam(int paramID, int voice)
|
||||
|
||||
if (isHumanize)
|
||||
{
|
||||
param_info_t *pConstraints = getParamInfo(paramID);
|
||||
param_info_t *pHumanized;
|
||||
synth_float_t slider;
|
||||
for (i=voice_min; i <= voice_max; i++)
|
||||
{
|
||||
param = params[paramID] + controls[paramID];
|
||||
slider = toSlider(pParamInfo, params[paramID]) + ppHumanizedSliders[paramID][i];
|
||||
param = toParam(pParamInfo, slider) + controls[paramID];
|
||||
for (j=0; j < SYNTH_PER_VOICE_CONTROL_SIZE; j++)
|
||||
param += pPer_voice_controls[i].ctrl[j][paramID];
|
||||
|
||||
param = clampParam(pParamInfo, param);
|
||||
pHumanized = &humanize_voice_param[paramID][i];
|
||||
((JaySynthVoice*)getVoice(i))->setParameter(voice_param_type, toParam(pHumanized, toSlider(pConstraints, param)));
|
||||
((JaySynthVoice*)getVoice(i))->setParameter(voice_param_type, param);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1019,6 +1025,14 @@ void JaySynth::handleMidiEvent (const MidiMessage& m)
|
||||
m.getControllerNumber(),
|
||||
m.getControllerValue());
|
||||
}
|
||||
else if (m.isMidiMachineControlMessage())
|
||||
{
|
||||
SynthDebug("MidiMachineControlMessage(%08X)\n", m.getMidiMachineControlCommand());
|
||||
}
|
||||
else if (m.isTempoMetaEvent())
|
||||
{
|
||||
SynthDebug("TempoMetaEvent\n");
|
||||
}
|
||||
else if (m.isMidiStart())
|
||||
{
|
||||
SynthDebug("MidiStart\n");
|
||||
@@ -1047,6 +1061,10 @@ void JaySynth::handleMidiEvent (const MidiMessage& m)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SynthDebug("Unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user