PC speaker: fix timer issue

This commit is contained in:
tildearrow 2022-04-24 17:48:04 -05:00
parent 521b311692
commit f99ba810fe

View file

@ -53,6 +53,7 @@ void DivPlatformPCSpeaker::acquire_unfilt(short* bufL, short* bufR, size_t start
for (size_t i=start; i<start+len; i++) { for (size_t i=start; i<start+len; i++) {
if (on) { if (on) {
pos-=PCSPKR_DIVIDER; pos-=PCSPKR_DIVIDER;
if (pos>freq) pos=freq;
while (pos<0) { while (pos<0) {
if (freq<1) { if (freq<1) {
pos=1; pos=1;
@ -71,6 +72,7 @@ void DivPlatformPCSpeaker::acquire_cone(short* bufL, short* bufR, size_t start,
for (size_t i=start; i<start+len; i++) { for (size_t i=start; i<start+len; i++) {
if (on) { if (on) {
pos-=PCSPKR_DIVIDER; pos-=PCSPKR_DIVIDER;
if (pos>freq) pos=freq;
while (pos<0) { while (pos<0) {
if (freq<1) { if (freq<1) {
pos=1; pos=1;
@ -95,6 +97,7 @@ void DivPlatformPCSpeaker::acquire_piezo(short* bufL, short* bufR, size_t start,
for (size_t i=start; i<start+len; i++) { for (size_t i=start; i<start+len; i++) {
if (on) { if (on) {
pos-=PCSPKR_DIVIDER; pos-=PCSPKR_DIVIDER;
if (pos>freq) pos=freq;
while (pos<0) { while (pos<0) {
if (freq<1) { if (freq<1) {
pos=1; pos=1;