summaryrefslogtreecommitdiff
path: root/libs/plugins/reasonablesynth.lv2
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-23 13:41:20 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-23 13:41:20 -0500
commit7000afdc66c9e0ae8dcf9ec080517dabba1e7f34 (patch)
tree19574ed8a1fbafa6bed222d8cf817ee1c8098314 /libs/plugins/reasonablesynth.lv2
parent065e1e63342633f72725a5309926f71c87804293 (diff)
parent40d8c5ae01f25e02457c554170a53d537246a7d4 (diff)
fix merge conflict with master
Diffstat (limited to 'libs/plugins/reasonablesynth.lv2')
-rw-r--r--libs/plugins/reasonablesynth.lv2/rsynth.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/libs/plugins/reasonablesynth.lv2/rsynth.c b/libs/plugins/reasonablesynth.lv2/rsynth.c
index a6c74aa26c..eff01d8d69 100644
--- a/libs/plugins/reasonablesynth.lv2/rsynth.c
+++ b/libs/plugins/reasonablesynth.lv2/rsynth.c
@@ -186,22 +186,25 @@ static void synthesize_sineP (RSSynthChannel* sc,
float env = adsr_env(sc, note);
if (sc->adsr_cnt[note] == 0) break;
const float amp = vol * env;
-
- left[i] += amp * sinf(2.0 * M_PI * phase);
- left[i] += .300 * amp * sinf(2.0 * M_PI * phase * 2.0);
- left[i] += .150 * amp * sinf(2.0 * M_PI * phase * 3.0);
- left[i] += .080 * amp * sinf(2.0 * M_PI * phase * 4.0);
- //left[i] -= .007 * amp * sinf(2.0 * M_PI * phase * 5.0);
- //left[i] += .010 * amp * sinf(2.0 * M_PI * phase * 6.0);
- left[i] += .020 * amp * sinf(2.0 * M_PI * phase * 7.0);
- phase += fq;
- right[i] += amp * sinf(2.0 * M_PI * phase);
- right[i] += .300 * amp * sinf(2.0 * M_PI * phase * 2.0);
- right[i] += .150 * amp * sinf(2.0 * M_PI * phase * 3.0);
- right[i] -= .080 * amp * sinf(2.0 * M_PI * phase * 4.0);
- //right[i] += .007 * amp * sinf(2.0 * M_PI * phase * 5.0);
- //right[i] += .010 * amp * sinf(2.0 * M_PI * phase * 6.0);
- right[i] -= .020 * amp * sinf(2.0 * M_PI * phase * 7.0);
+ if (amp > 1e-10) {
+ left[i] += amp * sinf(2.0 * M_PI * phase);
+ left[i] += .300 * amp * sinf(2.0 * M_PI * phase * 2.0);
+ left[i] += .150 * amp * sinf(2.0 * M_PI * phase * 3.0);
+ left[i] += .080 * amp * sinf(2.0 * M_PI * phase * 4.0);
+ //left[i] -= .007 * amp * sinf(2.0 * M_PI * phase * 5.0);
+ //left[i] += .010 * amp * sinf(2.0 * M_PI * phase * 6.0);
+ left[i] += .020 * amp * sinf(2.0 * M_PI * phase * 7.0);
+ phase += fq;
+ right[i] += amp * sinf(2.0 * M_PI * phase);
+ right[i] += .300 * amp * sinf(2.0 * M_PI * phase * 2.0);
+ right[i] += .150 * amp * sinf(2.0 * M_PI * phase * 3.0);
+ right[i] -= .080 * amp * sinf(2.0 * M_PI * phase * 4.0);
+ //right[i] += .007 * amp * sinf(2.0 * M_PI * phase * 5.0);
+ //right[i] += .010 * amp * sinf(2.0 * M_PI * phase * 6.0);
+ right[i] -= .020 * amp * sinf(2.0 * M_PI * phase * 7.0);
+ } else {
+ phase += fq;
+ }
if (phase > 1.0) phase -= 2.0;
}
sc->phase[note] = phase;
@@ -221,7 +224,7 @@ static void process_key (void *synth,
RSSynthChannel* sc = &rs->sc[chn];
const int8_t vel = sc->miditable[note];
const int8_t msg = sc->midimsgs[note];
- const float vol = /* master_volume */ 0.25 * fabsf(vel) / 127.0;
+ const float vol = /* master_volume */ 0.1 * fabsf(vel) / 127.0;
const float phase = sc->phase[note];
sc->midimsgs[note] = 0;