Fixed sawtooth gen
This commit is contained in:
parent
7341d8a8cf
commit
2d4e2e06c2
|
@ -88,8 +88,10 @@ struct wav gen_saw(float amp, float freq, int sr, int ch)
|
||||||
if (amp > 1) amp = 1;
|
if (amp > 1) amp = 1;
|
||||||
if (amp < 0) amp = 0;
|
if (amp < 0) amp = 0;
|
||||||
|
|
||||||
|
samp = amp*SHRT_MAX;
|
||||||
|
|
||||||
for (int i = 0; i < new.frames; i++) {
|
for (int i = 0; i < new.frames; i++) {
|
||||||
short val = 2 * ( (i/new.frames) - floor( (0.5 + (i/new.frames))));
|
short val = samp * 2 * i/sr - samp;
|
||||||
for (int j = 0; j < new.ch; j++) {
|
for (int j = 0; j < new.ch; j++) {
|
||||||
new.data[i+j] = val;
|
new.data[i+j] = val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue