diff options
author | XANTRONIX Development | 2022-03-12 17:21:55 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-03-12 17:21:55 -0500 |
commit | 533ccaa23ca82bce45c6fd54580f2d2fdc0c34fa (patch) | |
tree | 7c8330f7f5567ea8c41bc4e1e5b068a62a8b7c01 | |
parent | 5f54f5f23964fdcb494627c1aa866c74eb9a03c4 (diff) | |
download | xas-533ccaa23ca82bce45c6fd54580f2d2fdc0c34fa.tar.gz xas-533ccaa23ca82bce45c6fd54580f2d2fdc0c34fa.tar.bz2 xas-533ccaa23ca82bce45c6fd54580f2d2fdc0c34fa.zip |
Avoid divide-by-zero when frequency set to 0
-rw-r--r-- | src/synth.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/synth.c b/src/synth.c index 9c974e5..41522a6 100644 --- a/src/synth.c +++ b/src/synth.c @@ -94,8 +94,14 @@ static ssize_t synth_fill(xas_synth *synth, xas_audio_stream *stream) { size_t i; - for (i=0; i<count; i++) { - samples[i] = synth->sample(synth); + if (synth->frequency > 0) { + for (i=0; i<count; i++) { + samples[i] = synth->sample(synth); + } + } else { + for (i=0; i<count; i++) { + samples[i] = 0; + } } return count; |