浏览代码

Fix discontinuity in frequency stepping in tonesweep, remove unnecessary/incorrect masking of phase

dds
user 4 年前
父节点
当前提交
2416c39b74
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. +3
    -2
      synth_tonesweep.cpp

+ 3
- 2
synth_tonesweep.cpp 查看文件

@@ -97,13 +97,14 @@ void AudioSynthToneSweep::update(void)
if(block) {
bp = block->data;
uint32_t tmp = tone_freq >> 32;
uint64_t tone_tmp = (0x400000000000LL * (int)(tmp&0x7fffffff)) / (int) AUDIO_SAMPLE_RATE_EXACT;
uint64_t tone_tmp = (tone_freq << 14) / (int) AUDIO_SAMPLE_RATE_EXACT;
uint64_t incr = (tone_incr << 14) / (int) AUDIO_SAMPLE_RATE_EXACT;
// Generate the sweep
for(i = 0;i < AUDIO_BLOCK_SAMPLES;i++) {
*bp++ = (short)(( (short)(arm_sin_q31((uint32_t)((tone_phase >> 15)&0x7fffffff))>>16) *tone_amp) >> 15);

tone_phase += tone_tmp;
if(tone_phase & 0x800000000000LL)tone_phase &= 0x7fffffffffffLL;
tone_tmp += incr ;

if(tone_sign > 0) {
if(tmp > tone_hi) {

正在加载...
取消
保存