octal-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

square might be out of tune


From: ben
Subject: square might be out of tune
Date: Tue Mar 6 18:54:19 2001
User-agent: Mutt/1.2.5i

I was looking at squaregen.c to try to make a sawtooth generator, and I
think line 164 which says

        if (phase >= 1.0) phase = 0.0;

should be changed to

        if (phase >= 1.0) phase -= 1.0;

In the first one, the position in the wave is always set back to 0
without taking into account how far it may have gone past 1; setting
phase to ((current position) - 1) compensates for that, I think.  I know
it's just an example generator, but it should be fixed since other
generators will be based on it..

ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]