| #include "utility/dspinst.h" | #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) | void AudioSynthWaveform::update(void) | ||||
| { | { | ||||
| audio_block_t *block; | audio_block_t *block; | ||||
| for (i=0; i < AUDIO_BLOCK_SAMPLES; i++) { | for (i=0; i < AUDIO_BLOCK_SAMPLES; i++) { | ||||
| uint32_t phtop = ph >> 30; | uint32_t phtop = ph >> 30; | ||||
| if (phtop == 1 || phtop == 2) { | if (phtop == 1 || phtop == 2) { | ||||
| *bp++ = ((0x10000 - (ph >> 15)) * magnitude) >> 16; | |||||
| *bp++ = ((0xFFFF - (ph >> 15)) * magnitude) >> 16; | |||||
| } else { | } else { | ||||
| *bp++ = ((ph >> 15) * magnitude) >> 16; | *bp++ = ((ph >> 15) * magnitude) >> 16; | ||||
| } | } |