HARDT - The Ham Radio DSP Toolkit
Public Member Functions | List of all members
HMultiplier< T > Class Template Reference

#include <hmultiplier.h>

Inheritance diagram for HMultiplier< T >:
Inheritance graph
[legend]
Collaboration diagram for HMultiplier< T >:
Collaboration graph
[legend]

Public Member Functions

 HMultiplier (HReader< T > *reader, H_SAMPLE_RATE rate, int frequency, int oscillatorAmplitude, size_t blocksize, HProbe< T > *probe=NULL)
 
 HMultiplier (HWriter< T > *writer, H_SAMPLE_RATE rate, int frequency, int oscillatorAmplitude, size_t blocksize, HProbe< T > *probe=NULL)
 
 HMultiplier (HWriterConsumer< T > *consumer, H_SAMPLE_RATE rate, int frequency, int oscillatorAmplitude, size_t blocksize, HProbe< T > *probe=NULL)
 
 ~HMultiplier ()
 
void Init (H_SAMPLE_RATE rate, int frequency, int oscillatorAmplitude, size_t blocksize)
 
int Read (T *dest, size_t blocksize)
 
int Write (T *src, size_t blocksize)
 
void SetWriter (HWriter< T > *writer)
 
bool Start ()
 
bool Stop ()
 
void SetFrequency (int frequency)
 
void Mix (T *src, T *dest, size_t blocksize)
 
bool Command (HCommand *command)
 
- Public Member Functions inherited from HReader< T >
virtual ~HReader ()=default
 
HReader< T > * Reader ()
 
- Public Member Functions inherited from HObject
 HObject ()
 
- Public Member Functions inherited from HWriter< T >
virtual ~HWriter ()=default
 
HWriter< T > * Writer ()
 
- Public Member Functions inherited from HWriterConsumer< T >
HWriterConsumer< T > * Consumer ()
 

Detailed Description

template<class T>
class HMultiplier< T >

Multiplier (unlinear mixer).

Will mix the input signal with a localoscillator signal thus producing (Tin + Tlo) and (Tin - Tlo)

The localoscillator frequency can be changed by calling SetFrequency(). behaviour while the frequency is transitioning is undefined, if you make large adjustments you may want to reduce the input level while setting the new frequency to avoid clicks or noise (check if it is a problem in your actual case)

The multiplier can be created with any amplitude of the local oscillator, but the output level is scaled down, so that the gain factor of the multiplier is always 1. So select a local oscillator amplitude that matches the input signal, and prevents internal overruns (AMPL_in * AMPL_lo <= max(T)/2)

Examples
readers_and_consumers.cpp, readers_and_writers.cpp, and saq.cpp.

Constructor & Destructor Documentation

◆ HMultiplier() [1/3]

template<class T >
HMultiplier< T >::HMultiplier ( HReader< T > *  reader,
H_SAMPLE_RATE  rate,
int  frequency,
int  oscillatorAmplitude,
size_t  blocksize,
HProbe< T > *  probe = NULL 
)

Construct a new HMultiplier (frequency mixer)

◆ HMultiplier() [2/3]

template<class T >
HMultiplier< T >::HMultiplier ( HWriter< T > *  writer,
H_SAMPLE_RATE  rate,
int  frequency,
int  oscillatorAmplitude,
size_t  blocksize,
HProbe< T > *  probe = NULL 
)

Construct a new HMultiplier (frequency mixer)

◆ HMultiplier() [3/3]

template<class T >
HMultiplier< T >::HMultiplier ( HWriterConsumer< T > *  consumer,
H_SAMPLE_RATE  rate,
int  frequency,
int  oscillatorAmplitude,
size_t  blocksize,
HProbe< T > *  probe = NULL 
)

Construct a new HMultiplier (frequency mixer)

◆ ~HMultiplier()

template<class T >
HMultiplier< T >::~HMultiplier

Default destructor

Member Function Documentation

◆ Command()

template<class T >
bool HMultiplier< T >::Command ( HCommand command)
inlinevirtual

Execute or carry through a command

Implements HReader< T >.

◆ Init()

template<class T >
void HMultiplier< T >::Init ( H_SAMPLE_RATE  rate,
int  frequency,
int  oscillatorAmplitude,
size_t  blocksize 
)

Common initialization tasks

◆ Mix()

template<class T >
void HMultiplier< T >::Mix ( T *  src,
T *  dest,
size_t  blocksize 
)

Mix two signals

◆ Read()

template<class T >
int HMultiplier< T >::Read ( T *  dest,
size_t  blocksize 
)
virtual

Read a block of samples

Implements HReader< T >.

◆ SetFrequency()

template<class T >
void HMultiplier< T >::SetFrequency ( int  frequency)

Set the frequency of the local oscillator that feeds one of the inputs of the mixer

◆ SetWriter()

template<class T >
void HMultiplier< T >::SetWriter ( HWriter< T > *  writer)
inlinevirtual

Set writer

Implements HWriterConsumer< T >.

◆ Start()

template<class T >
bool HMultiplier< T >::Start
virtual

Initialize before first read

Reimplemented from HReader< T >.

◆ Stop()

template<class T >
bool HMultiplier< T >::Stop
virtual

Cleanup after last read

Reimplemented from HReader< T >.

◆ Write()

template<class T >
int HMultiplier< T >::Write ( T *  src,
size_t  blocksize 
)
virtual

Write a block of samples

Implements HWriter< T >.


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