SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SoDa::QuadratureOscillator Class Reference

sin/cos oscillator to drive TX signal chain More...

#include <QuadratureOscillator.hxx>

Public Member Functions

 QuadratureOscillator ()
 Constructor.
std::complex< double > stepOscCD ()
 step the oscillator and produce a complex double result
std::complex< double > stepOscCD_sincos ()
std::complex< double > stepOscCD_complex ()
std::complex< float > stepOscCF ()
 step the oscillator and produce a complex float result
double stepOscD ()
 step the oscillator and produce a real double result
void setPhaseIncr (double _pi)
 set the phase increment per step for the oscillator (1/freq)

Private Attributes

double phase_incr
double ang
std::complex< double > ejw
std::complex< double > last
int idx

Detailed Description

sin/cos oscillator to drive TX signal chain

Definition at line 38 of file QuadratureOscillator.hxx.

Constructor & Destructor Documentation

◆ QuadratureOscillator()

SoDa::QuadratureOscillator::QuadratureOscillator ( )

Constructor.

Member Function Documentation

◆ setPhaseIncr()

void SoDa::QuadratureOscillator::setPhaseIncr ( double _pi)

set the phase increment per step for the oscillator (1/freq)

Parameters
_pithe phase increment

◆ stepOscCD()

std::complex< double > SoDa::QuadratureOscillator::stepOscCD ( )

step the oscillator and produce a complex double result

Returns
cos(ang), -sin(ang)

Note the use of sincos if we're building for linux. This is a bit faster than separate sin and cos calls.

The original scheme also did some near-angle approximation stuff but it really didn't help that much with computation time, as the oscillators account for such a small part of the total run time.

(notes from March, 2018) Well, no, the oscillators account for about 30% of the run time when the compiler optimizations are turned on. Changing from sincos to a complex multiply based scheme eliminates the NCO from the list of "expensive" functions.

The code still retains the choice, if it is necessary for some reason to use the sincos scheme, but by default, the NCO will be based on a complex multiply.

◆ stepOscCD_complex()

std::complex< double > SoDa::QuadratureOscillator::stepOscCD_complex ( )

◆ stepOscCD_sincos()

std::complex< double > SoDa::QuadratureOscillator::stepOscCD_sincos ( )

◆ stepOscCF()

std::complex< float > SoDa::QuadratureOscillator::stepOscCF ( )

step the oscillator and produce a complex float result

Returns
cos(ang), -sin(ang)

This is a wrapper for stepOscCD

◆ stepOscD()

double SoDa::QuadratureOscillator::stepOscD ( )

step the oscillator and produce a real double result

Returns
cos(ang)

This is a wrapper for stepOscCD

Member Data Documentation

◆ ang

double SoDa::QuadratureOscillator::ang
private

Definition at line 97 of file QuadratureOscillator.hxx.

◆ ejw

std::complex<double> SoDa::QuadratureOscillator::ejw
private

Definition at line 98 of file QuadratureOscillator.hxx.

◆ idx

int SoDa::QuadratureOscillator::idx
private

Definition at line 99 of file QuadratureOscillator.hxx.

◆ last

std::complex<double> SoDa::QuadratureOscillator::last
private

Definition at line 98 of file QuadratureOscillator.hxx.

◆ phase_incr

double SoDa::QuadratureOscillator::phase_incr
private

Definition at line 96 of file QuadratureOscillator.hxx.


The documentation for this class was generated from the following file: