Daiki Kato / PwmOutSpeaker
Revision:
2:436529700217
Parent:
1:8ec133daca4c
Child:
3:37a886d77bae
--- a/PwmOutSpeaker.cpp	Fri Mar 24 03:22:57 2017 +0000
+++ b/PwmOutSpeaker.cpp	Fri Mar 24 06:55:24 2017 +0000
@@ -102,8 +102,8 @@
                 Thread::wait(1);
             }
             wk_vol = _speaker_vol;
+            wk_ofs = (1.0f - wk_vol) / 2;
             if (_length == 8) {
-                wk_ofs = (1.0f - wk_vol) / 2;
                 _pwm_duty_buf[_bottom] = ((float)p_data[i++] / (float)0xff) * wk_vol + wk_ofs;
                 if (_channel == 1) {
                     _pwm_duty_buf[_bottom + 1] = _pwm_duty_buf[_bottom];