瀏覽代碼

Fix WAVEFORM_TRIANGLE_VARIABLE at less than 1.0 amplitude

dds
PaulStoffregen 6 年之前
父節點
當前提交
fd2947410a
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. +4
    -4
      synth_waveform.cpp

+ 4
- 4
synth_waveform.cpp 查看文件

@@ -138,10 +138,10 @@ void AudioSynthWaveform::update(void)
*bp++ = ((n >> 16) * magnitude) >> 16;
} else if (ph < 0xFFFFFFFF - pulse_width/2) {
uint32_t n = 0x7FFFFFFF - (((ph - pulse_width/2) >> 16) * fall);
*bp++ = ((n >> 16) * magnitude) >> 16;
*bp++ = (((int32_t)n >> 16) * magnitude) >> 16;
} else {
uint32_t n = ((ph + pulse_width/2) >> 16) * rise + 0x80000000;
*bp++ = ((n >> 16) * magnitude) >> 16;
*bp++ = (((int32_t)n >> 16) * magnitude) >> 16;
}
ph += inc;
}
@@ -356,10 +356,10 @@ void AudioSynthWaveformModulated::update(void)
*bp++ = ((n >> 16) * magnitude) >> 16;
} else if (ph < 0xFFFFFFFF - halfwidth) {
n = 0x7FFFFFFF - (((ph - halfwidth) >> 16) * fall);
*bp++ = ((n >> 16) * magnitude) >> 16;
*bp++ = (((int32_t)n >> 16) * magnitude) >> 16;
} else {
n = ((ph + halfwidth) >> 16) * rise + 0x80000000;
*bp++ = ((n >> 16) * magnitude) >> 16;
*bp++ = (((int32_t)n >> 16) * magnitude) >> 16;
}
ph += inc;
}

Loading…
取消
儲存