Corrected setSampleRate_Hz() to do so

pull/16/merge
boblark 2 years ago
parent 88126e2b21
commit d01dc8ebd4
  1. 4
      RadioIQMixer_F32.h

@ -42,6 +42,7 @@
* T4.0 For an update of a 128 sample block, doSimple=1, 20 microseconds * T4.0 For an update of a 128 sample block, doSimple=1, 20 microseconds
* *
* Rev Apr2021 Allowed for 2-channel I-Q input. Defaults to 1 Channel. "real." * Rev Apr2021 Allowed for 2-channel I-Q input. Defaults to 1 Channel. "real."
* Rev 30Jan23 Corrected setSampleRate_Hz(sr) to do so! RSL
*/ */
#ifndef _radioIQMixer_f32_h #ifndef _radioIQMixer_f32_h
@ -123,10 +124,11 @@ public:
} }
void setSampleRate_Hz(float32_t fs_Hz) { void setSampleRate_Hz(float32_t fs_Hz) {
sample_rate_Hz = fs_Hz; // Added 30Jan23 RSL
// Check freq range // Check freq range
if (freq > sample_rate_Hz/2.0f) freq = sample_rate_Hz/2.f; if (freq > sample_rate_Hz/2.0f) freq = sample_rate_Hz/2.f;
// update phase increment for new frequency // update phase increment for new frequency
phaseIncrement = 512.0f * freq / fs_Hz; phaseIncrement = 512.0f * freq / sample_rate_Hz;
} }
void showError(uint16_t e) { // Serial.print errors in update() void showError(uint16_t e) { // Serial.print errors in update()

Loading…
Cancel
Save