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

#include <CWGenerator.hxx>

Public Member Functions

void setCWSpeed (unsigned int wpm)
 set the speed of the cw stream in words per minute
unsigned int getCWSpeed ()
 tell us what the current CW speed is
bool readyForMore ()
 check envelope stream to see if we have less than 1 second's worth of stuff enqueued
bool sendChar (char c)
 encode a character into the envelope buffer

Static Public Member Functions

static CWGeneratorPtr make (FDatMBoxPtr cw_env_stream, double _samp_rate, unsigned int _env_buf_len)

Protected Member Functions

 CWGenerator (FDatMBoxPtr cw_env_stream, double _samp_rate, unsigned int _env_buf_len)
 Constructor.

Private Member Functions

void appendToOut (std::vector< float > &v)
 add a buffer of envelope pieces to the outgoing envelope buffer
void flushBuffer ()
 push the current buffer out to the transmitter, filling it with zeros
void clearBuffer ()
 empty the current envelope, don't send it along to the TX unit
void initMorseMap ()
 setup the mapping from ascii character to morse sequence

Private Attributes

FDatMBoxPtr env_stream
 this is the stream we send envelope buffers into.
double sample_rate
 we need to know how long a sample is (in time)
unsigned int env_buf_len
 the length of an envelope buffer
unsigned int words_per_minute
unsigned int edge_sample_count
 edges are 'pre-built' this is the length of an edge, in samples
unsigned int bufs_per_sec
 number of envelope buffers required per second.
std::vector< float > dit
 prototype dit buffer
std::vector< float > dah
 prototype dah buffer
std::vector< float > inter_char_space
 prototype space between characters
std::vector< float > inter_word_space
 prototype space between words
std::vector< float > rising_edge
 a gentle shape for the leading edge of a pulse
std::vector< float > falling_edge
 a gentle shape for the trailing edge of a pulse
SoDa::FBufPtr cur_buf
 the current envelope to be filled in
unsigned int cur_buf_idx
 where are we in the buffer?
bool in_digraph
 if true, we're sending a two-character (no inter-char space) sequence (like _AR)
bool last_was_space
 if true, next interword space should be a little short

Static Private Attributes

static std::map< char, std::string > morse_map
 map from ascii character to dits-and-dahs

Detailed Description

Definition at line 46 of file CWGenerator.hxx.

Constructor & Destructor Documentation

◆ CWGenerator()

SoDa::CWGenerator::CWGenerator ( FDatMBoxPtr cw_env_stream,
double _samp_rate,
unsigned int _env_buf_len )
protected

Constructor.

Parameters
cw_env_streamenvelope stream from text-to-CW converter
_samp_ratesample rate for outbound envelope
_env_buf_lenlength of outbound buffer

Referenced by make().

Member Function Documentation

◆ appendToOut()

void SoDa::CWGenerator::appendToOut ( std::vector< float > & v)
private

add a buffer of envelope pieces to the outgoing envelope buffer

Parameters
vvector of floating point envelope amplitudes

◆ clearBuffer()

void SoDa::CWGenerator::clearBuffer ( )
private

empty the current envelope, don't send it along to the TX unit

◆ flushBuffer()

void SoDa::CWGenerator::flushBuffer ( )
private

push the current buffer out to the transmitter, filling it with zeros

◆ getCWSpeed()

unsigned int SoDa::CWGenerator::getCWSpeed ( )
inline

tell us what the current CW speed is

Returns
words per minute

Definition at line 76 of file CWGenerator.hxx.

References words_per_minute.

◆ initMorseMap()

void SoDa::CWGenerator::initMorseMap ( )
private

setup the mapping from ascii character to morse sequence

◆ make()

CWGeneratorPtr SoDa::CWGenerator::make ( FDatMBoxPtr cw_env_stream,
double _samp_rate,
unsigned int _env_buf_len )
inlinestatic

Definition at line 57 of file CWGenerator.hxx.

References CWGenerator().

◆ readyForMore()

bool SoDa::CWGenerator::readyForMore ( )

check envelope stream to see if we have less than 1 second's worth of stuff enqueued

Returns
true if we need to encode more characters

◆ sendChar()

bool SoDa::CWGenerator::sendChar ( char c)

encode a character into the envelope buffer

Parameters
cthe character to be sent
Returns
true if c was a morse-encodable character

◆ setCWSpeed()

void SoDa::CWGenerator::setCWSpeed ( unsigned int wpm)

set the speed of the cw stream in words per minute

Parameters
wpmwords per minute

Member Data Documentation

◆ bufs_per_sec

unsigned int SoDa::CWGenerator::bufs_per_sec
private

number of envelope buffers required per second.

Definition at line 123 of file CWGenerator.hxx.

◆ cur_buf

SoDa::FBufPtr SoDa::CWGenerator::cur_buf
private

the current envelope to be filled in

Definition at line 138 of file CWGenerator.hxx.

◆ cur_buf_idx

unsigned int SoDa::CWGenerator::cur_buf_idx
private

where are we in the buffer?

Definition at line 139 of file CWGenerator.hxx.

◆ dah

std::vector<float> SoDa::CWGenerator::dah
private

prototype dah buffer

Definition at line 127 of file CWGenerator.hxx.

◆ dit

std::vector<float> SoDa::CWGenerator::dit
private

prototype dit buffer

Definition at line 126 of file CWGenerator.hxx.

◆ edge_sample_count

unsigned int SoDa::CWGenerator::edge_sample_count
private

edges are 'pre-built' this is the length of an edge, in samples

Definition at line 121 of file CWGenerator.hxx.

◆ env_buf_len

unsigned int SoDa::CWGenerator::env_buf_len
private

the length of an envelope buffer

Definition at line 117 of file CWGenerator.hxx.

◆ env_stream

FDatMBoxPtr SoDa::CWGenerator::env_stream
private

this is the stream we send envelope buffers into.

Definition at line 115 of file CWGenerator.hxx.

◆ falling_edge

std::vector<float> SoDa::CWGenerator::falling_edge
private

a gentle shape for the trailing edge of a pulse

Definition at line 133 of file CWGenerator.hxx.

◆ in_digraph

bool SoDa::CWGenerator::in_digraph
private

if true, we're sending a two-character (no inter-char space) sequence (like _AR)

Definition at line 142 of file CWGenerator.hxx.

◆ inter_char_space

std::vector<float> SoDa::CWGenerator::inter_char_space
private

prototype space between characters

Definition at line 128 of file CWGenerator.hxx.

◆ inter_word_space

std::vector<float> SoDa::CWGenerator::inter_word_space
private

prototype space between words

Definition at line 129 of file CWGenerator.hxx.

◆ last_was_space

bool SoDa::CWGenerator::last_was_space
private

if true, next interword space should be a little short

Definition at line 143 of file CWGenerator.hxx.

◆ morse_map

std::map<char, std::string> SoDa::CWGenerator::morse_map
staticprivate

map from ascii character to dits-and-dahs

Definition at line 135 of file CWGenerator.hxx.

◆ rising_edge

std::vector<float> SoDa::CWGenerator::rising_edge
private

a gentle shape for the leading edge of a pulse

Definition at line 132 of file CWGenerator.hxx.

◆ sample_rate

double SoDa::CWGenerator::sample_rate
private

we need to know how long a sample is (in time)

Definition at line 116 of file CWGenerator.hxx.

◆ words_per_minute

unsigned int SoDa::CWGenerator::words_per_minute
private

Definition at line 120 of file CWGenerator.hxx.

Referenced by getCWSpeed().


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