From eff229107ad8d16c2c93b9cdddadeafeda52b1f6 Mon Sep 17 00:00:00 2001 From: angel Date: Sun, 15 Oct 2006 18:57:36 +0000 Subject: [PATCH] The wobble effect now includes a new gain argument. git-svn-id: file:///home/angel/tmp/svn-triptico/ahxm/trunk@5661 c87de0a0-a11c-0410-a1e5-866214bc28b2 --- RELEASE_NOTES | 7 +++++++ ahxm.h | 2 +- compiler.y | 8 +++++++- doc/ahs_overview_ii.txt | 6 ++++++ ss_eff.c | 8 +++++--- ss_song.c | 3 ++- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index d648e4b..b1c41cc 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,6 +1,13 @@ Ann Hell Ex Machina Release Notes ================================= +1.0.9 +----- + + * The wobble effect now accepts a 'gain' argument, to control the amount + of effect applied to the signal. If not set, it uses a default of 0.8 + (previous versions acted as if a 1.0 value was set). + 1.0.8 ----- diff --git a/ahxm.h b/ahxm.h index 648d053..8c0083a 100644 --- a/ahxm.h +++ b/ahxm.h @@ -497,7 +497,7 @@ void ss_eff_comb(struct ss_eff ** ec, double size, sample_t gain); void ss_eff_allpass(struct ss_eff ** ec, double size, sample_t gain); void ss_eff_flanger(struct ss_eff ** ec, double size, sample_t gain, double depth, double freq, double phase); -void ss_eff_wobble(struct ss_eff ** ec, double freq, double phase); +void ss_eff_wobble(struct ss_eff ** ec, double freq, double phase, sample_t gain); void ss_eff_square_wobble(struct ss_eff ** ec, double freq, double phase); void ss_eff_half_wobble(struct ss_eff ** ec, double freq, double phase); void ss_eff_fader(struct ss_eff ** ec, double size, sample_t initial, sample_t final); diff --git a/compiler.y b/compiler.y index 8aa7e98..4128405 100644 --- a/compiler.y +++ b/compiler.y @@ -1094,7 +1094,13 @@ xc_cmd: | SS_EFF_WOBBLE integer number number { /* wobble effect */ add_ss_eff_event(SONG_EV_SS_EFF_WOBBLE, - $2, 0, 0, 0, $3, $4, 0, 0); + $2, 0, 0.8, 0, $3, $4, 0, 0); + } + + | SS_EFF_WOBBLE integer number number number { + /* wobble effect, with gain */ + add_ss_eff_event(SONG_EV_SS_EFF_WOBBLE, + $2, 0, $5, 0, $3, $4, 0, 0); } | SS_EFF_SQWOBBLE integer number number { diff --git a/doc/ahs_overview_ii.txt b/doc/ahs_overview_ii.txt index 249acb5..c7c7969 100644 --- a/doc/ahs_overview_ii.txt +++ b/doc/ahs_overview_ii.txt @@ -254,6 +254,7 @@ wobble ~~~~~~ wobble + wobble Creates a wobble effect in . Amplitude will have a sine wave applied with a frequency of , so volume will effectively go from @@ -261,6 +262,11 @@ full amplitude to silence twice a period. The initial value for the phase is set in . The wobble effect can be used to implement tremolos with short frequencies and pan effects with long ones. +If is set, it's the ratio of wobbled / unmodified signal, ranging +from 1 (full wobbled) to 0 (no effect). If not set, has a default +value of 0.8. This behaviour is new in 1.0.9; previous versions didn't +accept the 4th argument and acted as if a gain of 1.0 was given. + Examples: /* tremolo (10Hz frequency) */ diff --git a/ss_eff.c b/ss_eff.c index 44eb760..f51d1ff 100644 --- a/ss_eff.c +++ b/ss_eff.c @@ -347,7 +347,8 @@ static sample_t func_wobble(struct ss_eff * e, sample_t input) { sample_t s; - s = input * ss_eff_lfo(e); + s = (input * ss_eff_lfo(e) * e->gain) + + (input * (1.0 - e->gain)); return(s); } @@ -358,6 +359,7 @@ static sample_t func_wobble(struct ss_eff * e, sample_t input) * @ec: the effect chain * @freq: frequency [0..1] * @phase: initial phase [0..1] + * @gain: ammount of effect [0..1] * * Adds a wobble effect, where the sample amplitudes are * multiplied by an LFO, so sound volume wobbles from full @@ -366,11 +368,11 @@ static sample_t func_wobble(struct ss_eff * e, sample_t input) * fractional part of a period, being 0 the start of the period, * 0.5 half a period and so on. The LFO is sinusoidal. */ -void ss_eff_wobble(struct ss_eff ** ec, double freq, double phase) +void ss_eff_wobble(struct ss_eff ** ec, double freq, double phase, sample_t gain) { struct ss_eff * e; - e = ss_eff_add(ec, 0, 0, func_wobble); + e = ss_eff_add(ec, 0, gain, func_wobble); ss_eff_set_lfo(e, freq, phase, 0); } diff --git a/ss_song.c b/ss_song.c index 12f4848..2031be4 100644 --- a/ss_song.c +++ b/ss_song.c @@ -873,7 +873,8 @@ static int process_this_frame_events(int skip_frames) case SONG_EV_SS_EFF_WOBBLE: ss_eff_wobble(&i->effs[e->ss_eff.channel], - e->ss_eff.freq, e->ss_eff.phase); + e->ss_eff.freq, e->ss_eff.phase, + e->ss_eff.gain); break; -- 2.11.4.GIT