59 unsigned int _env_buf_len) {
60 auto ret = std::shared_ptr<CWGenerator>(
new CWGenerator(cw_env_stream,
The Baseclass for all SoDa objects, and useful commonly used classes.
unsigned int edge_sample_count
edges are 'pre-built' this is the length of an edge, in samples
std::vector< float > falling_edge
a gentle shape for the trailing edge of a pulse
FDatMBoxPtr env_stream
this is the stream we send envelope buffers into.
void flushBuffer()
push the current buffer out to the transmitter, filling it with zeros
bool sendChar(char c)
encode a character into the envelope buffer
void clearBuffer()
empty the current envelope, don't send it along to the TX unit
void setCWSpeed(unsigned int wpm)
set the speed of the cw stream in words per minute
void initMorseMap()
setup the mapping from ascii character to morse sequence
unsigned int cur_buf_idx
where are we in the buffer?
std::vector< float > inter_char_space
prototype space between characters
std::vector< float > dit
prototype dit buffer
unsigned int getCWSpeed()
tell us what the current CW speed is
bool in_digraph
if true, we're sending a two-character (no inter-char space) sequence (like _AR)
unsigned int env_buf_len
the length of an envelope buffer
bool readyForMore()
check envelope stream to see if we have less than 1 second's worth of stuff enqueued
unsigned int words_per_minute
unsigned int bufs_per_sec
number of envelope buffers required per second.
SoDa::FBufPtr cur_buf
the current envelope to be filled in
CWGenerator(FDatMBoxPtr cw_env_stream, double _samp_rate, unsigned int _env_buf_len)
Constructor.
std::vector< float > inter_word_space
prototype space between words
void appendToOut(std::vector< float > &v)
add a buffer of envelope pieces to the outgoing envelope buffer
static std::map< char, std::string > morse_map
map from ascii character to dits-and-dahs
std::vector< float > dah
prototype dah buffer
double sample_rate
we need to know how long a sample is (in time)
static CWGeneratorPtr make(FDatMBoxPtr cw_env_stream, double _samp_rate, unsigned int _env_buf_len)
std::vector< float > rising_edge
a gentle shape for the leading edge of a pulse
bool last_was_space
if true, next interword space should be a little short
std::shared_ptr< FBuf > FBufPtr
std::shared_ptr< CWGenerator > CWGeneratorPtr
std::shared_ptr< FDatMBox > FDatMBoxPtr