Quellcode durchsuchen

Merge pull request #359 from MarkTillotson/tonesweep_improvement

Fix discontinuity in frequency stepping in tonesweep
dds
Paul Stoffregen vor 4 Jahren
Ursprung
Commit
8764e4ca1d
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. +3
    -2
      synth_tonesweep.cpp

+ 3
- 2
synth_tonesweep.cpp Datei anzeigen

@@ -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) {

Laden…
Abbrechen
Speichern