Merge branch 'calf-updates'

* calf-updates:
  Fix incorrect plugin class (spotted by Luis Garrido).
  Add windowing-based antialiasing to hard sync in Monosynth; update last stretch even if synth is idle. (cherry picked from commit d64a0487d88f6730ef90dd6d79b892ad4a114138)
This commit is contained in:
Tobias Doerffel
2010-07-24 23:42:51 +02:00
3 changed files with 31 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
par_lforate, par_lfodelay, par_lfofilter, par_lfopitch, par_lfopw, par_mwhl_lfo, par_scaledetune,
par_env2tocutoff, par_env2tores, par_env2toamp,
par_env2attack, par_env2decay, par_env2sustain, par_env2fade, par_env2release,
par_stretch1,
par_stretch1, par_window1,
par_lfo1trig, par_lfo2trig,
par_lfo2rate, par_lfo2delay,
param_count };

View File

@@ -185,7 +185,7 @@ CALF_PORT_PROPS(rotary_speaker) = {
{ 0, 0, 1, 0, PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_h", "High rotor" },
};
CALF_PLUGIN_INFO(rotary_speaker) = { 0x8483, "RotarySpeaker", "Calf Rotary Speaker", "Krzysztof Foltman", calf_plugins::calf_copyright_info, "SimulationPlugin" };
CALF_PLUGIN_INFO(rotary_speaker) = { 0x8483, "RotarySpeaker", "Calf Rotary Speaker", "Krzysztof Foltman", calf_plugins::calf_copyright_info, "SimulatorPlugin" };
////////////////////////////////////////////////////////////////////////////
@@ -703,7 +703,8 @@ CALF_PORT_PROPS(monosynth) = {
{ 0, -10000,10000, 21, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER | PF_UNIT_MSEC, NULL, "adsr2_f", "EG2 Fade" },
{ 50, 10,20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_FADER | PF_UNIT_MSEC, NULL, "adsr2_r", "Release" },
{ 1, 1, 16, 0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "o1_stretch", "Osc1 Stretch" },
{ 1, 1, 16, 0, PF_FLOAT | PF_SCALE_LOG | PF_UNIT_COEF | PF_CTL_KNOB, NULL, "o1_stretch", "Osc1 Stretch" },
{ 0, 0, 1, 0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "o1_window", "Osc1 Window" },
{ 0, 0, 1, 0, PF_ENUM | PF_CTL_COMBO, monosynth_lfotrig_names, "lfo1_trig", "LFO1 Trigger Mode" },
{ 0, 0, 1, 0, PF_ENUM | PF_CTL_COMBO, monosynth_lfotrig_names, "lfo2_trig", "LFO2 Trigger Mode" },

View File

@@ -222,12 +222,24 @@ bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int
if (wave == wave_sqr)
wave = wave_saw;
float *waveform = waves[wave].original;
float rnd_start = 1 - *params[par_window1] * 0.5f;
float scl = rnd_start < 1.0 ? 1.f / (1 - rnd_start) : 0.f;
for (int i = 0; i < points; i++)
{
int pos = i * S / points;
float r = 1;
if (index == par_wave1)
{
float ph = i * 1.0 / points;
if (ph < 0.5f)
ph = 1.f - ph;
ph = (ph - rnd_start) * scl;
if (ph < 0)
ph = 0;
r = 1.0 - ph * ph;
pos = int(pos * 1.0 * last_stretch1 / 65536.0 ) % S;
data[i] = (sign * waveform[pos] + waveform[(pos + shift) & (S - 1)]) / (sign == -1 ? 1 : 2);
}
data[i] = r * (sign * waveform[pos] + waveform[(pos + shift) & (S - 1)]) / (sign == -1 ? 1 : 2);
}
return true;
}
@@ -281,10 +293,20 @@ void monosynth_audio_module::calculate_buffer_oscs(float lfo1)
float cur_xfade = last_xfade;
float xfade_step = (new_xfade - cur_xfade) * (1.0 / step_size);
float rnd_start = 1 - *params[par_window1] * 0.5f;
float scl = rnd_start < 1.0 ? 1.f / (1 - rnd_start) : 0.f;
for (uint32_t i = 0; i < step_size; i++)
{
//buffer[i] = lerp(osc1.get_phaseshifted(shift1, mix1), osc2.get_phaseshifted(shift2, mix2), cur_xfade);
buffer[i] = lerp(osc1.get_phasedist(stretch1, shift1, mix1), osc2.get_phaseshifted(shift2, mix2), cur_xfade);
float o1phase = osc1.phase / (65536.0 * 65536.0);
if (o1phase < 0.5)
o1phase = 1 - o1phase;
o1phase = (o1phase - rnd_start) * scl;
if (o1phase < 0)
o1phase = 0;
float r = 1.0 - o1phase * o1phase;
buffer[i] = lerp(r * osc1.get_phasedist(stretch1, shift1, mix1), osc2.get_phaseshifted(shift2, mix2), cur_xfade);
osc1.advance();
osc2.advance();
shift1 += shift_delta1;
@@ -436,6 +458,9 @@ void monosynth_audio_module::calculate_step()
envelope2.advance();
lfo1.get();
lfo2.get();
float modsrc[modsrc_count] = { 1, velocity, inertia_pressure.get_last(), modwheel_value, envelope1.value, envelope2.value, 0.5+0.5*lfo1.last, 0.5+0.5*lfo2.last};
calculate_modmatrix(moddest, moddest_count, modsrc);
last_stretch1 = (int32_t)(65536 * dsp::clip(*params[par_stretch1] + 0.01f * moddest[moddest_o1stretch], 1.f, 16.f));
return;
}
lfo1.set_freq(*params[par_lforate], crate);