diff options
author | XANTRONIX Development | 2022-03-08 20:28:13 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-03-08 20:28:13 -0500 |
commit | ba45cfe089c6430ab80bc8652dc88a837a59fc9a (patch) | |
tree | dcb64a3528eef8ff50bcba19d1dc425b9efbe925 /src | |
parent | 60241cb0856bc7deafb052c0665de91878153de4 (diff) | |
download | xas-ba45cfe089c6430ab80bc8652dc88a837a59fc9a.tar.gz xas-ba45cfe089c6430ab80bc8652dc88a837a59fc9a.tar.bz2 xas-ba45cfe089c6430ab80bc8652dc88a837a59fc9a.zip |
Fix duty cycle term in square wave synthesis
Diffstat (limited to 'src')
-rw-r--r-- | src/synth.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/synth.c b/src/synth.c index 0be572d..9c974e5 100644 --- a/src/synth.c +++ b/src/synth.c @@ -30,7 +30,7 @@ static int16_t sample_square(xas_synth *synth) { float duty = synth->duty; if (synth->state == XAS_SYNTH_ACTIVE) { - ret = ((duty * synth->phase) - M_PI) > 0.0? + ret = (synth->phase - (duty * tau)) > 0.0? (int16_t)roundf(synth->gain * (INT16_MAX / 4)): (int16_t)roundf(synth->gain * (INT16_MIN / 4)); |