Added setFMScale to radioModulatedGenerator_F32

pull/13/head
boblark 3 years ago
parent ecf5cae865
commit 04621cb54e
  1. 2
      radioModulatedGenerator_F32.cpp
  2. 10
      radioModulatedGenerator_F32.h

@ -69,7 +69,7 @@ void radioModulatedGenerator_F32::update(void) {
if(doPM) // Phase in inPhaseFreq->data[i] is scaled for (0.0, 2*PI)
phaseS += (phaseIncrement0 + K512ON2PI*inPhaseFreq->data[i]);
else if(doFM)
phaseS += kp*(freq + inPhaseFreq->data[i]); // kp=512.0/sample_rate_Hz
phaseS += kp*(freq + deviationFMScale*inPhaseFreq->data[i]); // kp=512.0/sample_rate_Hz
else
phaseS += phaseIncrement0; // No PM or FM alteration to carrier phase

@ -12,7 +12,7 @@
*
* For PM or FM (only one at a time) the input goes to the 1 channel. For PM,
* the input level corresponds to radians of phase change, + or -. For FM,
* the input correspondss to Hz of deviation.
* the input correspondss to Hz of deviation (or as modified by deviationFMMultiplier).
*
* For digital modulation, such as QAM, there can be both phase and amplitude
* modulation. This would be set by
@ -104,6 +104,13 @@ public:
return;
}
// A deviationFMScale of 1000.0 causes the deviation in FM to
// * be 1000 Hz/unit instead of 1 Hz/unit.
// */
void setFMScale(float mult) {
deviationFMScale = mult;
}
// phaseQ_I is the number of radians that the cosine output leads the
// sine output. The default is M_PI_2 = pi/2 = 1.57079633 radians,
// corresponding to 90.00 degrees cosine leading sine.
@ -159,6 +166,7 @@ public:
private:
audio_block_f32_t *inputQueueArray_f32[2];
float32_t freq = 10000.0f; // Center frequecy, Hz
float32_t deviationFMScale = 1.0f; // Hz is default, 1000.0 is kHz, not Hz
float32_t phaseS = 0.0f;
float32_t phaseQ_I = 128.00;
float32_t amplitudeQ_I = 1.0f;

Loading…
Cancel
Save