bSizer30->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+ //------------------------------
+ // Interfering tone
+ //------------------------------
+
+ wxStaticBoxSizer* sbSizer_tone;
+ wxStaticBox *sb_tone = new wxStaticBox(this, wxID_ANY, _("Simulated Interference Tone"));
+ sbSizer_tone = new wxStaticBoxSizer(sb_tone, wxHORIZONTAL);
+
+ m_ckboxTone = new wxCheckBox(this, wxID_ANY, _("Tone Freq (Hz):"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+ sbSizer_tone->Add(m_ckboxTone, 0, wxALIGN_LEFT, 0);
+ m_txtToneFreqHz = new wxTextCtrl(this, wxID_ANY, "1000", wxDefaultPosition, wxSize(60,-1), 0, wxTextValidator(wxFILTER_DIGITS));
+ sbSizer_tone->Add(m_txtToneFreqHz, 0, wxALIGN_LEFT, 0);
+ wxStaticText *m_staticTextta = new wxStaticText(this, wxID_ANY, _(" Amplitude (pk): "), wxDefaultPosition, wxDefaultSize, 0);
+ sbSizer_tone->Add(m_staticTextta, 0, wxALIGN_CENTER_VERTICAL, 5);
+ m_txtToneAmplitude = new wxTextCtrl(this, wxID_ANY, "1000", wxDefaultPosition, wxSize(60,-1), 0, wxTextValidator(wxFILTER_DIGITS));
+ sbSizer_tone->Add(m_txtToneAmplitude, 0, wxALIGN_LEFT, 0);
+
+ bSizer30->Add(sbSizer_tone,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
//------------------------------
// FreeDV 700 Options
//------------------------------
m_ckboxChannelNoise->SetValue(wxGetApp().m_channel_noise);
m_txtNoiseSNR->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_noise_snr));
+ m_ckboxTone->SetValue(wxGetApp().m_tone);
+ m_txtToneFreqHz->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_tone_freq_hz));
+ m_txtToneAmplitude->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_tone_amplitude));
+
m_ckboxAttnCarrierEn->SetValue(wxGetApp().m_attn_carrier_en);
m_txtAttnCarrier->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_attn_carrier));
m_txtNoiseSNR->GetValue().ToLong(&noise_snr);
wxGetApp().m_noise_snr = (int)noise_snr;
+ wxGetApp().m_tone = m_ckboxTone->GetValue();
+ long tone_freq_hz, tone_amplitude;
+ m_txtToneFreqHz->GetValue().ToLong(&tone_freq_hz);
+ wxGetApp().m_tone_freq_hz = (int)tone_freq_hz;
+ m_txtToneAmplitude->GetValue().ToLong(&tone_amplitude);
+ wxGetApp().m_tone_amplitude = (int)tone_amplitude;
+
+
wxGetApp().m_attn_carrier_en = m_ckboxAttnCarrierEn->GetValue();
long attn_carrier;
m_txtAttnCarrier->GetValue().ToLong(&attn_carrier);
public:
OptionsDlg( wxWindow* parent,
wxWindowID id = wxID_ANY, const wxString& title = _("Options"),
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,630),
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,660),
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~OptionsDlg();
wxCheckBox *m_ckboxAttnCarrierEn;
wxTextCtrl *m_txtAttnCarrier;
+ wxCheckBox *m_ckboxTone;
+ wxTextCtrl *m_txtToneFreqHz;
+ wxTextCtrl *m_txtToneAmplitude;
+
wxCheckBox *m_ckboxFreeDV700txClip;
wxCheckBox *m_ckboxFreeDV700Combine;
float g_sig_pwr_av = 0.0;
struct FIFO *g_error_pattern_fifo;
short *g_error_hist, *g_error_histn;
-
+float g_tone_phase;
+
// time averaged magnitude spectrum used for waterfall and spectrum display
float g_avmag[MODEM_STATS_NSPEC];
wxGetApp().m_attn_carrier_en = 0;
wxGetApp().m_attn_carrier = 0;
+ wxGetApp().m_tone = 0;
+ wxGetApp().m_tone_freq_hz = 1000;
+ wxGetApp().m_tone_amplitude = 500;
+
int mode = pConfig->Read(wxT("/Audio/mode"), (long)0);
if (mode == 0)
m_rb1600->SetValue(1);
g_test_frame_sync_state = 0;
g_resyncs = 0;
wxGetApp().m_testFrames = false;
+ g_tone_phase = 0.0;
g_modal = false;
freedv_set_snr_squelch_thresh(g_pfreedv, g_SquelchLevel);
}
+ // Optional tone interferer
+
+ if (wxGetApp().m_tone) {
+ float w = 2.0*M_PI*wxGetApp().m_tone_freq_hz/freedv_get_modem_sample_rate(g_pfreedv);
+ float s;
+ unsigned int i;
+ for(i=0; i<n8k; i++) {
+ s = (float)wxGetApp().m_tone_amplitude*cos(g_tone_phase);
+ in8k_short[i] += (int)s;
+ g_tone_phase += w;
+ //fprintf(stderr, "%f\n", s);
+ }
+ g_tone_phase -= 2.0*M_PI*floor(g_tone_phase/(2.0*M_PI));
+ }
+
//fprintf(g_logfile, "snr_squelch_thresh: %f\n", g_pfreedv->snr_squelch_thresh);
// compute rx spectrum - do here so update rate in constant
//fwrite(input_buf, sizeof(short), nin, ftest);
// demod per frame processing
+
for(i=0; i<nin; i++) {
rx_fdm[i].real = (float)input_buf[i];
rx_fdm[i].imag = 0.0;
}
+ // Optional channel noise
+
if (g_channel_noise) {
fdmdv_simulate_channel(&g_sig_pwr_av, rx_fdm, nin, wxGetApp().m_noise_snr);
}
+
freq_shift_coh(rx_fdm_offset, rx_fdm, g_RxFreqOffsetHz, freedv_get_modem_sample_rate(g_pfreedv), &g_RxFreqOffsetPhaseRect, nin);
nout = freedv_comprx(g_pfreedv, output_buf, rx_fdm_offset);
//kprintf("nout %d outbuf_buf[0]: %d\n", nout, output_buf[0]);