summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/synth.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/synth.c b/src/synth.c
index 082a383..86990e8 100644
--- a/src/synth.c
+++ b/src/synth.c
@@ -28,7 +28,9 @@ static int16_t sample_square(xas_synth *synth) {
static float tau = 2.0f * M_PI;
if (synth->state == XAS_SYNTH_ACTIVE) {
- ret = synth->phase > 0.0? INT16_MAX / 4: INT16_MIN / 4;
+ ret = (synth->phase - M_PI) > 0.0?
+ INT16_MAX / 4:
+ INT16_MIN / 4;
synth->phase += tau / (synth->format.sample_rate / synth->frequency);