aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputUHD.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/OutputUHD.h')
-rw-r--r--src/OutputUHD.h44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index a2ffb7d..aed80f6 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -83,9 +83,20 @@ struct UHDWorkerFrameData {
struct frame_timestamp ts;
};
+struct fct_discontinuity_error : public std::exception
+{
+ const char* what () const throw ()
+ {
+ return "FCT discontinuity detected";
+ }
+};
+
enum refclk_lock_loss_behaviour_t { CRASH, IGNORE };
struct UHDWorkerData {
+ bool running;
+ bool failed_due_to_fct;
+
#if FAKE_UHD == 0
uhd::usrp::multi_usrp::sptr myUsrp;
#endif
@@ -130,28 +141,26 @@ struct UHDWorkerData {
class UHDWorker {
public:
- UHDWorker () {
- running = false;
- }
-
void start(struct UHDWorkerData *uhdworkerdata) {
- running = true;
uwd = uhdworkerdata;
- uhd_thread = boost::thread(&UHDWorker::process, this);
+
+ uwd->running = true;
+ uwd->failed_due_to_fct = false;
+ uhd_thread = boost::thread(&UHDWorker::process_errhandler, this);
}
void stop() {
- running = false;
+ uwd->running = false;
uhd_thread.interrupt();
uhd_thread.join();
}
+ private:
void process();
+ void process_errhandler();
- private:
struct UHDWorkerData *uwd;
- bool running;
boost::thread uhd_thread;
uhd::tx_streamer::sptr myTxStream;
@@ -171,6 +180,7 @@ struct OutputUHDConfig {
double txgain;
bool enableSync;
bool muteNoTimestamps;
+ unsigned dabMode;
/* allowed values : auto, int, sma, mimo */
std::string refclk_src;
@@ -188,9 +198,10 @@ struct OutputUHDConfig {
class OutputUHD: public ModOutput, public RemoteControllable {
public:
+
OutputUHD(
- OutputUHDConfig& config,
- Logger& logger);
+ const OutputUHDConfig& config,
+ Logger *logger);
~OutputUHD();
int process(Buffer* dataIn, Buffer* dataOut);
@@ -216,7 +227,7 @@ class OutputUHD: public ModOutput, public RemoteControllable {
protected:
- Logger& myLogger;
+ Logger *myLogger;
EtiReader *myEtiReader;
OutputUHDConfig myConf;
uhd::usrp::multi_usrp::sptr myUsrp;
@@ -229,6 +240,15 @@ class OutputUHD: public ModOutput, public RemoteControllable {
// muting can only be changed using the remote control
bool myMuting;
+ private:
+ // Resize the internal delay buffer according to the dabMode and
+ // the sample rate.
+ void SetDelayBuffer(unsigned int dabMode);
+
+ // data
+ int myStaticDelayUs; // static delay in microseconds
+ int myTFDurationMs; // TF duration in milliseconds
+ std::vector<complexf> myDelayBuf;
size_t lastLen;
};