Pārlūkot izejas kodu

Fix numerical overflow at top of triangle waveform

dds
PaulStoffregen pirms 6 gadiem
vecāks
revīzija
eef399ef8d
1 mainītis faili ar 1 papildinājumiem un 8 dzēšanām
  1. +1
    -8
      synth_waveform.cpp

+ 1
- 8
synth_waveform.cpp Parādīt failu

@@ -30,13 +30,6 @@
#include "utility/dspinst.h"


/******************************************************************/
// PAH 140415 - change sin to use Paul's interpolation which is much
// faster than arm's sin function
// PAH 140316 - fix calculation of sample (amplitude error)
// PAH 140314 - change t_hi from int to float


void AudioSynthWaveform::update(void)
{
audio_block_t *block;
@@ -123,7 +116,7 @@ void AudioSynthWaveform::update(void)
for (i=0; i < AUDIO_BLOCK_SAMPLES; i++) {
uint32_t phtop = ph >> 30;
if (phtop == 1 || phtop == 2) {
*bp++ = ((0x10000 - (ph >> 15)) * magnitude) >> 16;
*bp++ = ((0xFFFF - (ph >> 15)) * magnitude) >> 16;
} else {
*bp++ = ((ph >> 15) * magnitude) >> 16;
}

Notiek ielāde…
Atcelt
Saglabāt