소스 검색

Merge pull request #359 from MarkTillotson/tonesweep_improvement

Fix discontinuity in frequency stepping in tonesweep
dds
Paul Stoffregen 4 년 전
부모
커밋
8764e4ca1d
No account linked to committer's email address
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) {

Loading…
취소
저장