summaryrefslogtreecommitdiff
path: root/sound.c
diff options
context:
space:
mode:
authorAutechre2021-02-24 03:58:08 +0100
committerGitHub2021-02-24 03:58:08 +0100
commit28aa08de9900000d2c42d903f8e5dfdbcdb55ea8 (patch)
treefd76187fc7def92e5ed31f7e28611f916a2d8f70 /sound.c
parent300d0c0028e400eabd81dc718ee8cd8c6459b256 (diff)
parent349e47f0b251b42c7a3d7e2d8072ce976a55b54c (diff)
downloadpicogpsp-28aa08de9900000d2c42d903f8e5dfdbcdb55ea8.tar.gz
picogpsp-28aa08de9900000d2c42d903f8e5dfdbcdb55ea8.tar.bz2
picogpsp-28aa08de9900000d2c42d903f8e5dfdbcdb55ea8.zip
Merge pull request #94 from davidgfnet/master
Small fixes to division by zero
Diffstat (limited to 'sound.c')
-rw-r--r--sound.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound.c b/sound.c
index 126fb5d..10a3261 100644
--- a/sound.c
+++ b/sound.c
@@ -273,8 +273,11 @@ u32 gbc_sound_master_volume;
else \
rate = rate + (rate >> gs->sweep_shift); \
\
- if(rate > 2048) \
- rate = 2048; \
+ if(rate > 2047) { \
+ rate = 2047; \
+ gs->active_flag = 0; \
+ break; \
+ } \
\
frequency_step = float_to_fp16_16(((131072.0f / (2048 - rate)) * 8.0f) \
/ sound_frequency); \