commit c161651cc4482789e77b3800777aa30e1cc8db2e
parent 122a3ddf22875153a5efca0e7bb7d61bb2cee125
Author: fundamental <[email protected]>
Date: Wed, 22 Feb 2012 11:45:35 -0500
Oscillgen: Added Circle Waveform (lievenmoors)
- Circle waveform added to the listing of possible base waveforms
- Updated associated logs
Diffstat:
5 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/AUTHORS.txt b/AUTHORS.txt
@@ -20,5 +20,5 @@ Contributors:
Ryan Billing (APhaser)
Hans Petter Selasky (OSS Midi, FreeBSD support)
Damien Goutte-Gattat (Bank select midi support)
- Lieven Moors (Spike waveform)
+ Lieven Moors (Spike/Circle waveform)
diff --git a/ChangeLog b/ChangeLog
@@ -1016,3 +1016,6 @@
06 Feb 2012 (Mark McCurry)
- Adding --exec-after-init option
+
+22 Feb 2012 (Liven Moors)
+ - Added circle waveform to oscilator options
diff --git a/HISTORY.txt b/HISTORY.txt
@@ -1,7 +1,7 @@
2.4.2
- New IO backend support
- MIDI bank select
- - Spike waveform
+ - Spike/Circle waveform
- Faster subsynth
- --exec-after-init flag
- Version information compiled in
diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp
@@ -1286,6 +1286,27 @@ FUNC(spike)
}
}
+FUNC(circle)
+{
+ // a is parameter: 0 -> 0.5 -> 1 // O.5 = circle
+ float b, y;
+
+ b = 2 - (a * 2); // b goes from 2 to 0
+ x = x * 4;
+
+ if (x < 2){
+ x = x - 1; // x goes from -1 to 1
+ if ((x < -b) || (x > b)) y = 0;
+ else y = sqrt(1 - (pow(x, 2) / pow(b, 2))); // normally * a^2, but a stays 1
+ }
+ else{
+ x = x - 3; // x goes from -1 to 1 as well
+ if ((x < -b) || (x > b)) y = 0;
+ else y = -sqrt(1 - (pow(x, 2) / pow(b, 2)));
+ }
+ return y;
+}
+
typedef float (*base_func)(float, float);
base_func getBaseFunction(unsigned char func)
@@ -1297,7 +1318,7 @@ base_func getBaseFunction(unsigned char func)
return NULL;
func--;
- assert(func < 14);
+ assert(func < 15);
base_func functions[] = {
basefunc_triangle,
basefunc_pulse,
@@ -1313,6 +1334,7 @@ base_func getBaseFunction(unsigned char func)
basefunc_chebyshev,
basefunc_sqr,
basefunc_spike,
+ basefunc_circle,
};
return functions[func];
}
diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl
@@ -517,6 +517,10 @@ if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodula
label Spike
xywh {122 122 100 20} labelfont 1 labelsize 11
}
+ MenuItem {} {
+ label Circle
+ xywh {122 122 100 20} labelfont 1 labelsize 11
+ }
}
Fl_Box {} {
label {Base Func.}