SoDaRadio-5.0.3-master:8901fb5
BaseBandTX.hxx
Go to the documentation of this file.
1 /*
2 Copyright (c) 2012,2013,2014 Matthew H. Reilly (kb1vc)
3 All rights reserved.
4 
5  FM modulator features based on code contributed by and
6  Copyright (c) 2014, Aaron Yankey Antwi (aaronyan2001@gmail.com)
7 
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are
10 met:
11 
12  Redistributions of source code must retain the above copyright
13  notice, this list of conditions and the following disclaimer.
14  Redistributions in binary form must reproduce the above copyright
15  notice, this list of conditions and the following disclaimer in
16  the documentation and/or other materials provided with the
17  distribution.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31 
32 #ifndef BASEBANDTX_HDR
33 #define BASEBANDTX_HDR
34 #include "SoDaBase.hxx"
35 #include "MultiMBox.hxx"
36 #include "Params.hxx"
37 #include "Command.hxx"
38 #include "ReSamplers625x48.hxx"
39 #include "HilbertTransformer.hxx"
40 #include "AudioIfc.hxx"
41 
42 namespace SoDa {
52  class BaseBandRX;
53  class BaseBandTX : public SoDaThread {
54  public:
63  BaseBandTX(Params * params,
67  );
71  void run();
72  private:
77  void execGetCommand(Command * cmd);
82  void execSetCommand(Command * cmd);
87  void execRepCommand(Command * cmd);
88 
99  SoDa::SoDaBuf * modulateAM(float * audio_buf, unsigned int len, bool is_usb, bool is_lsb);
100 
110  SoDa::SoDaBuf * modulateFM(float * audio_buf, unsigned int len, double deviation);
111  double fm_phase;
112  double nbfm_deviation;
113  double wbfm_deviation;
114  double fm_mic_gain;
115 
116 
119  unsigned int cmd_subs;
120 
121  // The interpolator
123 
124  // parameters
125  unsigned int audio_buffer_size;
127  unsigned int tx_buffer_size;
128 
130  bool cw_tx_mode;
131  bool tx_on;
132 
133 
134  float af_gain;
135 
136  // audio server state
138 
140 
141  // we need some intermediate storage for things like
142  // the IQ buffer
143  std::complex<float> * audio_IQ_buf;
144 
149  float * ssb_af_upsample;
150 
155  float * noise_buffer;
156 
162 
167 
172 
177 
181  float mic_gain;
182 
183  bool debug_mode;
184  int debug_ctr;
185  };
186 }
187 
188 
189 #endif
The Baseclass for all SoDa objects, and useful commonly used classes.
double wbfm_deviation
phase advance for 75kHz deviation
Definition: BaseBandTX.hxx:113
bool debug_mode
if true, print extra debug info
Definition: BaseBandTX.hxx:183
SoDa::SoDaBuf * modulateAM(float *audio_buf, unsigned int len, bool is_usb, bool is_lsb)
create an AM/SSB modulation envelope
Definition: BaseBandTX.cxx:200
The Thread baseclass for all SoDa thread objects.
Definition: SoDaBase.hxx:284
bool cw_tx_mode
if true, tx_mode is CW_L or CW_U
Definition: BaseBandTX.hxx:130
bool tx_noise_source_ena
When this is TRUE, audio modes (USB,LSB,AM,NBFM,WBFM) use a noise source for input.
Definition: BaseBandTX.hxx:161
double audio_sample_rate
wired in lots of places as 48KHz
Definition: BaseBandTX.hxx:126
double fm_mic_gain
separate gain control for FM deviation....
Definition: BaseBandTX.hxx:114
float af_gain
local microphone gain.
Definition: BaseBandTX.hxx:134
This class handles command line parameters and built-ins.
Definition: Params.hxx:42
In several places we have a real valued signal x(t) that needs to be converted to an analytic signal ...
BaseBandTX(Params *params, DatMBox *tx_stream, CmdMBox *cmd_stream, AudioIfc *audio_ifc)
constructor
Definition: BaseBandTX.cxx:45
AudioIfc * audio_ifc
pointer to an AudioIfc object for the microphone input
Definition: BaseBandTX.hxx:137
The Buffer Class.
Definition: SoDaBase.hxx:72
void execSetCommand(Command *cmd)
handle SET commands from the command channel
Definition: BaseBandTX.cxx:285
unsigned int tx_buffer_size
how long is the outbound RF buffer
Definition: BaseBandTX.hxx:127
Resampler for 48KHz to 625KHz data stream, built on rational ReSampler class.
This is a list of all the commands that can "do something" to one or more components in the SoDa radi...
Definition: Command.hxx:47
float * ssb_af_upsample
SSB modulation requires that we upsample before doing the quadrature generation.
Definition: BaseBandTX.hxx:149
SoDa::OSFilter * tx_audio_filter
TX audio filter.
Definition: BaseBandTX.hxx:171
ModulationType
modulation selector targets take one of these values
Definition: Command.hxx:478
bool tx_stream_on
if true, we are transmitting.
Definition: BaseBandTX.hxx:139
DatMBox * tx_stream
outbound RF stream to USRPTX transmit chain
Definition: BaseBandTX.hxx:117
SoDa::ReSample48to625 * interpolator
Upsample from 48KHz to 625KHz.
Definition: BaseBandTX.hxx:122
SoDa::SoDaBuf * modulateFM(float *audio_buf, unsigned int len, double deviation)
create a narrowband/wideband FM modulation envelope
Definition: BaseBandTX.cxx:243
void run()
the run method – does the work of the audio transmitter process
Definition: BaseBandTX.cxx:111
std::complex< float > * audio_IQ_buf
temporary storage for outbound modulation envelope
Definition: BaseBandTX.hxx:143
unsigned int audio_buffer_size
length (in samples) of an input audio buffer
Definition: BaseBandTX.hxx:125
Overlap-and-save filter class.
Definition: OSFilter.hxx:50
void execGetCommand(Command *cmd)
execute GET commands from the command channel
Definition: BaseBandTX.cxx:357
double nbfm_deviation
phase advance for 2.5kHz deviation.
Definition: BaseBandTX.hxx:112
Generic Audio Interface Class.
Definition: AudioIfc.hxx:44
CmdMBox * cmd_stream
command stream from UI and other units
Definition: BaseBandTX.hxx:118
float mic_gain
mic gain is adjustable, to make sure we aren&#39;t noxious.
Definition: BaseBandTX.hxx:181
SoDa::Command::ModulationType tx_mode
what modulation scheme? USB? LSB? CW_U?...
Definition: BaseBandTX.hxx:129
unsigned int cmd_subs
subscription ID for command stream
Definition: BaseBandTX.hxx:119
SoDa::HilbertTransformer * hilbert
The hilbert transformer to create an analytic (I/Q) signal.
Definition: BaseBandTX.hxx:176
bool tx_on
set by Command::TX_STATE to on or off
Definition: BaseBandTX.hxx:131
void execRepCommand(Command *cmd)
handle Report commands from the command channel
Definition: BaseBandTX.cxx:362
bool tx_audio_filter_ena
There is an audio filter in the chain, by default.
Definition: BaseBandTX.hxx:166
float * noise_buffer
This is a buffer that holds a set of "noise" samples (uniform random) for testing the TX audio chain...
Definition: BaseBandTX.hxx:155