[SCM] calf/master: + Monosynth: add inertia for pitch wheel
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:39:20 UTC 2013
The following commit has been merged in the master branch:
commit 3c2be5653b0696f59cdd860449a1ab5a16f217b1
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat Feb 7 21:39:44 2009 +0000
+ Monosynth: add inertia for pitch wheel
Conflicts:
src/calf/modules_synths.h
src/monosynth.cpp
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 608fecb..f35fa49 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -57,7 +57,7 @@ public:
dsp::biquad_d1_lerp<float> filter2;
int wave1, wave2, filter_type, last_filter_type;
float freq, start_freq, target_freq, cutoff, decay_factor, fgain, fgain_delta, separation;
- float detune, xpose, xfade, pitchbend, ampctl, fltctl, queue_vel;
+ float detune, xpose, xfade, ampctl, fltctl, queue_vel;
float odcr, porta_time, lfo_bend, lfo_clock, last_lfov, modwheel_value;
int queue_note_on, stop_count, modwheel_value_int;
int legato;
@@ -65,8 +65,9 @@ public:
dsp::keystack stack;
dsp::gain_smoothing master;
dsp::inertia<dsp::exponential_ramp> inertia_cutoff;
-
- monosynth_audio_module();
+ dsp::inertia<dsp::exponential_ramp> inertia_pitchbend;
+
+ monosynth_audio_module();
static void precalculate_waves(progress_report_iface *reporter);
void set_sample_rate(uint32_t sr);
void delayed_note_on();
@@ -78,14 +79,14 @@ public:
/// Handle pitch bend message.
inline void pitch_bend(int value)
{
- pitchbend = pow(2.0, value / 8192.0);
+ inertia_pitchbend.set_inertia(pow(2.0, value / 8192.0));
}
/// Update oscillator frequency based on base frequency, detune amount, pitch bend scaling factor and sample rate.
inline void set_frequency()
{
float detune_scaled = (detune - 1); // * log(freq / 440);
- osc1.set_freq(freq * (1 - detune_scaled) * pitchbend * lfo_bend, srate);
- osc2.set_freq(freq * (1 + detune_scaled) * pitchbend * lfo_bend * xpose, srate);
+ osc1.set_freq(freq * (1 - detune_scaled) * inertia_pitchbend.get_last() * lfo_bend, srate);
+ osc2.set_freq(freq * (1 + detune_scaled) * inertia_pitchbend.get_last() * lfo_bend * xpose, srate);
}
/// Handle control change messages.
void control_change(int controller, int value);
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index a1cdcda..c861e4e 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -36,6 +36,7 @@ float silence[4097];
monosynth_audio_module::monosynth_audio_module()
: inertia_cutoff(exponential_ramp(1))
+, inertia_pitchbend(exponential_ramp(1))
{
}
@@ -44,7 +45,7 @@ void monosynth_audio_module::activate() {
output_pos = 0;
queue_note_on = -1;
stop_count = 0;
- pitchbend = 1.f;
+ inertia_pitchbend.set_now(1.f);
lfo_bend = 1.0;
modwheel_value = 0.f;
modwheel_value_int = 0;
@@ -353,7 +354,8 @@ void monosynth_audio_module::set_sample_rate(uint32_t sr) {
phaseshifter.set_ap(1000.f, sr);
fgain = 0.f;
fgain_delta = 0.f;
- inertia_cutoff.ramp.set_length(crate / 30); // 1/30s
+ inertia_cutoff.ramp.set_length(crate / 30); // 1/30s
+ inertia_pitchbend.ramp.set_length(crate / 30); // 1/30s
}
void monosynth_audio_module::calculate_step()
@@ -389,6 +391,7 @@ void monosynth_audio_module::calculate_step()
lfo_clock += odcr;
if (fabs(*params[par_lfopitch]) > small_value<float>())
lfo_bend = pow(2.0f, *params[par_lfopitch] * lfov * (1.f / 1200.0f));
+ inertia_pitchbend.step();
set_frequency();
envelope.advance();
float env = envelope.value;
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list