SoDaRadio-5.0.3-master:8901fb5
|
#include <BaseBandTX.hxx>
Public Member Functions | |
BaseBandTX (Params *params, DatMBox *tx_stream, CmdMBox *cmd_stream, AudioIfc *audio_ifc) | |
constructor More... | |
void | run () |
the run method – does the work of the audio transmitter process More... | |
Public Member Functions inherited from SoDa::SoDaThread | |
SoDaThread (const std::string &oname) | |
void | start () |
Execute the threads run loop. More... | |
void | join () |
more properly "Wait for this thread to exit its run loop". More... | |
bool | waitForJoin (unsigned int m) |
wait for the thread to stop running, or the specified time to pass. More... | |
void | execCommand (Command *cmd) |
Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions. More... | |
Public Member Functions inherited from SoDa::SoDaBase | |
SoDaBase (const std::string &oname) | |
The constructor – pass a name for the object. More... | |
std::string & | getObjName () |
get the name of this object More... | |
SoDaBase * | findSoDaObject (const std::string &oname) |
find a SoDa Object by name. More... | |
double | getTime () |
Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS). More... | |
Public Member Functions inherited from SoDa::Debug | |
Debug (std::string _unit_name=std::string("UNKNOWN")) | |
Debug (const char *_unit_name_cstr) | |
Debug (unsigned int _debug_level, std::string _unit_name=std::string("UNKNOWN")) | |
Debug (unsigned int _debug_level, const char *_unit_name_cstr) | |
void | debugMsg (const std::string &msg, unsigned int threshold=1) |
void | debugMsg (const boost::format &fmt, unsigned int threshold=1) |
void | debugMsg (const char *msg, unsigned int threshold=1) |
void | setDebugLevel (unsigned int v) |
unsigned int | getDebugLevel () |
Private Member Functions | |
void | execGetCommand (Command *cmd) |
execute GET commands from the command channel More... | |
void | execSetCommand (Command *cmd) |
handle SET commands from the command channel More... | |
void | execRepCommand (Command *cmd) |
handle Report commands from the command channel More... | |
SoDa::SoDaBuf * | modulateAM (float *audio_buf, unsigned int len, bool is_usb, bool is_lsb) |
create an AM/SSB modulation envelope More... | |
SoDa::SoDaBuf * | modulateFM (float *audio_buf, unsigned int len, double deviation) |
create a narrowband/wideband FM modulation envelope More... | |
Private Attributes | |
double | fm_phase |
double | nbfm_deviation |
phase advance for 2.5kHz deviation. More... | |
double | wbfm_deviation |
phase advance for 75kHz deviation More... | |
double | fm_mic_gain |
separate gain control for FM deviation.... More... | |
DatMBox * | tx_stream |
outbound RF stream to USRPTX transmit chain More... | |
CmdMBox * | cmd_stream |
command stream from UI and other units More... | |
unsigned int | cmd_subs |
subscription ID for command stream More... | |
SoDa::ReSample48to625 * | interpolator |
Upsample from 48KHz to 625KHz. More... | |
unsigned int | audio_buffer_size |
length (in samples) of an input audio buffer More... | |
double | audio_sample_rate |
wired in lots of places as 48KHz More... | |
unsigned int | tx_buffer_size |
how long is the outbound RF buffer More... | |
SoDa::Command::ModulationType | tx_mode |
what modulation scheme? USB? LSB? CW_U?... More... | |
bool | cw_tx_mode |
if true, tx_mode is CW_L or CW_U More... | |
bool | tx_on |
set by Command::TX_STATE to on or off More... | |
float | af_gain |
local microphone gain. More... | |
AudioIfc * | audio_ifc |
pointer to an AudioIfc object for the microphone input More... | |
bool | tx_stream_on |
if true, we are transmitting. More... | |
std::complex< float > * | audio_IQ_buf |
temporary storage for outbound modulation envelope More... | |
float * | ssb_af_upsample |
SSB modulation requires that we upsample before doing the quadrature generation. More... | |
float * | noise_buffer |
This is a buffer that holds a set of "noise" samples (uniform random) for testing the TX audio chain. More... | |
bool | tx_noise_source_ena |
When this is TRUE, audio modes (USB,LSB,AM,NBFM,WBFM) use a noise source for input. More... | |
bool | tx_audio_filter_ena |
There is an audio filter in the chain, by default. More... | |
SoDa::OSFilter * | tx_audio_filter |
TX audio filter. More... | |
SoDa::HilbertTransformer * | hilbert |
The hilbert transformer to create an analytic (I/Q) signal. More... | |
float | mic_gain |
mic gain is adjustable, to make sure we aren't noxious. More... | |
bool | debug_mode |
if true, print extra debug info More... | |
int | debug_ctr |
Additional Inherited Members | |
Static Public Member Functions inherited from SoDa::Debug | |
static void | setDefaultLevel (unsigned int v) |
static unsigned int | getDefaultLevel () |
static void | setGlobalLevel (unsigned int v) |
static unsigned int | getGlobalLevel () |
Static Public Attributes inherited from SoDa::Debug | |
static boost::mutex | debug_msg_mutex |
Protected Member Functions inherited from SoDa::Debug | |
std::string | curDateTime () |
Protected Attributes inherited from SoDa::Debug | |
std::string | unit_name |
the name of the unit reporting status More... | |
unsigned int | debug_level |
the debug level (threshold) for messages More... | |
Static Protected Attributes inherited from SoDa::Debug | |
static unsigned int | default_debug_level = 0 |
static unsigned int | global_debug_level = 0 |
Definition at line 53 of file BaseBandTX.hxx.
SoDa::BaseBandTX::BaseBandTX | ( | Params * | params, |
DatMBox * | tx_stream, | ||
CmdMBox * | cmd_stream, | ||
AudioIfc * | audio_ifc | ||
) |
constructor
params | command line parameter object |
tx_stream | pointer to mailbox holding USRP RX bitstream |
cmd_stream | pointer to mailbox holding control/report commands |
audio_ifc | pointer to the audio output handler |
Definition at line 45 of file BaseBandTX.cxx.
References audio_buffer_size, audio_ifc, audio_IQ_buf, cmd_stream, cmd_subs, debug_ctr, debug_mode, fm_mic_gain, fm_phase, SoDa::Params::getAFBufferSize(), SoDa::Params::getAudioSampleRate(), SoDa::Params::getRFBufferSize(), hilbert, interpolator, mic_gain, nbfm_deviation, noise_buffer, SoDa::MultiMBox< T >::subscribe(), tx_audio_filter, tx_audio_filter_ena, tx_buffer_size, tx_noise_source_ena, tx_stream, tx_stream_on, and wbfm_deviation.
|
privatevirtual |
execute GET commands from the command channel
cmd | the incoming command |
Reimplemented from SoDa::SoDaThread.
Definition at line 357 of file BaseBandTX.cxx.
|
privatevirtual |
handle Report commands from the command channel
cmd | the incoming command |
Reimplemented from SoDa::SoDaThread.
Definition at line 362 of file BaseBandTX.cxx.
|
privatevirtual |
handle SET commands from the command channel
cmd | the incoming command |
Reimplemented from SoDa::SoDaThread.
Definition at line 285 of file BaseBandTX.cxx.
References af_gain, cmd_stream, SoDa::Command::CW_L, cw_tx_mode, SoDa::Command::CW_U, SoDa::Debug::debugMsg(), SoDa::Command::dparms, SoDa::Command::iparms, SoDa::Command::NOISE, SoDa::MultiMBox< T >::put(), SoDa::Command::REP, SoDa::Command::target, SoDa::Command::TX_AF_GAIN, SoDa::Command::TX_AUDIO_FILT_ENA, tx_audio_filter_ena, SoDa::Command::TX_AUDIO_IN, tx_mode, SoDa::Command::TX_MODE, tx_noise_source_ena, tx_on, SoDa::Command::TX_STATE, and tx_stream_on.
|
private |
create an AM/SSB modulation envelope
audio_buf | the buffer of modulating audio info |
len | the length of the audio buffer |
is_usb | if true, generate upper sideband |
is_lsb | if true, generate lower sideband if both is_usb and is_lsb are false, the modulator creates an IQ stream that is amplitude modulated |
If the modulation scheme is USB or SSB, we need to make an analytic signal from the scalar real audio_buf.
If we're looking at USB, then for I = sin(w), Q => cos(w) for LSB I = sin(w), Q => -cos(w)
if neither is_usb is_lsb is true, then we want to produce an AM envelope. Put the same signal in both I and Q.
Now that the I/Q channels have been populated, get a transmit buffer. and upsample the I/Q audio up to the RF rate.
Upsample the IQ audio (at 48KS/s) to the RF sample rate of 625 KS/s
pass the newly created and filled buffer back to the caller
Definition at line 200 of file BaseBandTX.cxx.
References SoDa::MultiMBox< T >::alloc(), SoDa::ReSample48to625::apply(), SoDa::HilbertTransformer::apply(), audio_buffer_size, audio_IQ_buf, SoDa::SoDaBuf::getComplexBuf(), SoDa::SoDaBuf::getComplexLen(), hilbert, interpolator, mic_gain, tx_buffer_size, and tx_stream.
Referenced by run().
|
private |
create a narrowband/wideband FM modulation envelope
audio_buf | the buffer of modulating audio info |
len | the length of the audio buffer |
deviation | the phase shift per audio sample for a maximum amplitude (1.0) input. |
Note that this modulator varies the mic gain to prevent over-deviation.
Definition at line 243 of file BaseBandTX.cxx.
References SoDa::MultiMBox< T >::alloc(), SoDa::ReSample48to625::apply(), audio_buffer_size, audio_IQ_buf, fm_mic_gain, fm_phase, interpolator, tx_buffer_size, and tx_stream.
Referenced by run().
|
virtual |
the run method – does the work of the audio transmitter process
This is the BaseBandTX run loop.
Implements SoDa::SoDaThread.
Definition at line 111 of file BaseBandTX.cxx.
References SoDa::Command::AM, SoDa::OSFilter::apply(), audio_buffer_size, audio_ifc, cmd_stream, cmd_subs, cw_tx_mode, SoDa::SoDaThread::execCommand(), SoDa::MultiMBox< T >::free(), SoDa::MultiMBox< T >::get(), SoDa::Command::LSB, modulateAM(), modulateFM(), SoDa::Command::NBFM, nbfm_deviation, noise_buffer, SoDa::MultiMBox< T >::put(), SoDa::AudioIfc::recv(), SoDa::AudioIfc::recvBufferReady(), SoDa::Command::STOP, SoDa::Command::target, tx_audio_filter, tx_audio_filter_ena, tx_mode, tx_noise_source_ena, tx_stream, tx_stream_on, SoDa::Command::USB, SoDa::AudioIfc::wakeIn(), SoDa::Command::WBFM, and wbfm_deviation.
|
private |
local microphone gain.
Definition at line 134 of file BaseBandTX.hxx.
Referenced by execSetCommand().
|
private |
length (in samples) of an input audio buffer
Definition at line 125 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), modulateAM(), modulateFM(), and run().
|
private |
pointer to an AudioIfc object for the microphone input
Definition at line 137 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and run().
|
private |
temporary storage for outbound modulation envelope
Definition at line 143 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), modulateAM(), and modulateFM().
|
private |
wired in lots of places as 48KHz
Definition at line 126 of file BaseBandTX.hxx.
|
private |
command stream from UI and other units
Definition at line 118 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), execSetCommand(), and run().
|
private |
subscription ID for command stream
Definition at line 119 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and run().
|
private |
if true, tx_mode is CW_L or CW_U
Definition at line 130 of file BaseBandTX.hxx.
Referenced by execSetCommand(), and run().
|
private |
Definition at line 184 of file BaseBandTX.hxx.
Referenced by BaseBandTX().
|
private |
if true, print extra debug info
Definition at line 183 of file BaseBandTX.hxx.
Referenced by BaseBandTX().
|
private |
separate gain control for FM deviation....
Definition at line 114 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and modulateFM().
|
private |
Definition at line 111 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and modulateFM().
|
private |
The hilbert transformer to create an analytic (I/Q) signal.
Definition at line 176 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and modulateAM().
|
private |
Upsample from 48KHz to 625KHz.
Definition at line 122 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), modulateAM(), and modulateFM().
|
private |
mic gain is adjustable, to make sure we aren't noxious.
Definition at line 181 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and modulateAM().
|
private |
phase advance for 2.5kHz deviation.
Definition at line 112 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and run().
|
private |
This is a buffer that holds a set of "noise" samples (uniform random) for testing the TX audio chain.
Definition at line 155 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and run().
|
private |
SSB modulation requires that we upsample before doing the quadrature generation.
Definition at line 149 of file BaseBandTX.hxx.
|
private |
TX audio filter.
Definition at line 171 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and run().
|
private |
There is an audio filter in the chain, by default.
This is the enable.
Definition at line 166 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), execSetCommand(), and run().
|
private |
how long is the outbound RF buffer
Definition at line 127 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), modulateAM(), and modulateFM().
|
private |
what modulation scheme? USB? LSB? CW_U?...
Definition at line 129 of file BaseBandTX.hxx.
Referenced by execSetCommand(), and run().
|
private |
When this is TRUE, audio modes (USB,LSB,AM,NBFM,WBFM) use a noise source for input.
Definition at line 161 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), execSetCommand(), and run().
|
private |
set by Command::TX_STATE to on or off
Definition at line 131 of file BaseBandTX.hxx.
Referenced by execSetCommand().
|
private |
outbound RF stream to USRPTX transmit chain
Definition at line 117 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), modulateAM(), modulateFM(), and run().
|
private |
if true, we are transmitting.
Definition at line 139 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), execSetCommand(), and run().
|
private |
phase advance for 75kHz deviation
Definition at line 113 of file BaseBandTX.hxx.
Referenced by BaseBandTX(), and run().