From ef24c7d35cafef62ad3481ffb0b660d7dc76c26b Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sat, 13 Jun 2015 03:46:19 +0000 Subject: [PATCH] building OK, but needs debugging for changes to freedv api git-svn-id: https://svn.code.sf.net/p/freetel/code@2186 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2-dev/README.txt | 13 ++++++++---- fdmdv2-dev/src/fdmdv2_defines.h | 4 ++-- fdmdv2-dev/src/fdmdv2_main.cpp | 35 ++++++++++++++++++++++----------- fdmdv2-dev/src/topFrame.cpp | 6 ++++-- fdmdv2-dev/src/topFrame.h | 1 + 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/fdmdv2-dev/README.txt b/fdmdv2-dev/README.txt index 4b24bccd..8a711dc8 100644 --- a/fdmdv2-dev/README.txt +++ b/fdmdv2-dev/README.txt @@ -138,25 +138,30 @@ TODO [ ] FreeDV 700 mode [ ] integrate freedv API - [ ] varicode, codec, modem states - [ ] tx and rx freq shifts - [ ] generic, mode indep, sync and snr? + [X] varicode, codec, modem states + [X] tx and rx freq shifts + [ ] generic, mode indep, sync, snr, scatter? [ ] add 700 to freedv API [ ] modem signal spectrum and stats consistent with fdmdv + [ ] clipper a check box, so we can see difference in spectrum [ ] how to handle Fs=7500 Hz? [ ] freedv api [ ] normalise output pwr across modes? + + or maybe peak output? + + option? [X] support for both varicodes [ ] test mode + get error patterns working again, both modes + how to plot error histogram [ ] Small fixes - [ ] win32 X-compile [X] Playfile bug [X] running again [X] bump ver number [X] long varicode default [X] option to _not_ require checksum, on by default + [X] default squelch 2dB + [ ] win32 X-compile + [ ] cmd line file decode [ ] Waterfall direction [ ] test mode on 1600 with freedv api + maybe calc stats, hist diff --git a/fdmdv2-dev/src/fdmdv2_defines.h b/fdmdv2-dev/src/fdmdv2_defines.h index 491c5bba..c247e61c 100644 --- a/fdmdv2-dev/src/fdmdv2_defines.h +++ b/fdmdv2-dev/src/fdmdv2_defines.h @@ -57,7 +57,7 @@ #define MAX_FPB 8096 // maximum value of portAudio framesPerBuffer #define PA_FPB 1024 // nominal value of portAudio framesPerBuffer #define SAMPLE_RATE 48000 // 48 kHz sampling rate rec. as we can trust accuracy of sound card -#define N8 FREEDV_NSAMPLES // processing buffer size at 8 kHz +#define N8 160 // processing buffer size at 8 kHz #define MEM8 (FDMDV_OS_TAPS/FDMDV_OS) #define N48 (N8*SAMPLE_RATE/FS) // processing buffer size at 48 kHz #define NUM_CHANNELS 2 // I think most sound cards prefer stereo we will convert to mono @@ -69,7 +69,7 @@ #define MAX_BITS_PER_FDMDV_FRAME 40 // 2000 bit/s mode // Squelch -#define SQ_DEFAULT_SNR 1.5 +#define SQ_DEFAULT_SNR 2.0 // Level Gauge #define FROM_RADIO_MAX 0.8 diff --git a/fdmdv2-dev/src/fdmdv2_main.cpp b/fdmdv2-dev/src/fdmdv2_main.cpp index 248537c1..af00361c 100644 --- a/fdmdv2-dev/src/fdmdv2_main.cpp +++ b/fdmdv2-dev/src/fdmdv2_main.cpp @@ -69,7 +69,6 @@ struct FIFO *g_txDataInFifo; struct FIFO *g_rxDataOutFifo; // tx/rx processing states -int g_nRxIn = FREEDV_NSAMPLES; int g_State; paCallBackData *g_rxUserdata; @@ -1935,6 +1934,7 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event) m_btnTogPTT->Enable(); m_rb1600->Disable(); + m_rb700->Disable(); #ifdef DISABLED_FEATURE m_rb1600Wide->Disable(); m_rb1400old->Disable(); @@ -2077,6 +2077,7 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event) m_btnTogPTT->Disable(); m_togBtnOnOff->SetLabel(wxT("Start")); m_rb1600->Enable(); + m_rb700->Enable(); #ifdef DISABLED_FEATURE m_rb1400old->Enable(); m_rb1600Wide->Enable(); @@ -2346,7 +2347,7 @@ void MainFrame::startRxStream() g_rxUserdata->outfifo2 = fifo_create(8*N48); g_rxUserdata->infifo2 = fifo_create(8*N48); - g_rxUserdata->rxinfifo = fifo_create(3 * FREEDV_NSAMPLES); + g_rxUserdata->rxinfifo = fifo_create(3 * g_pfreedv->n_speech_samples); g_rxUserdata->rxoutfifo = fifo_create(2 * codec2_samples_per_frame(g_pfreedv->codec2)); // Init Equaliser Filters ------------------------------------------------------ @@ -3007,11 +3008,19 @@ void txRxProcessing() out8k_short[i] = out; } } - else - freedv_tx(g_pfreedv, out8k_short, in8k_short); + else { + COMP tx_fdm[g_pfreedv->n_nom_modem_samples]; + COMP tx_fdm_offset[g_pfreedv->n_nom_modem_samples]; + int i; + + freedv_comptx(g_pfreedv, tx_fdm, in8k_short); + fdmdv_freq_shift(tx_fdm_offset, tx_fdm, g_TxFreqOffsetHz, &g_TxFreqOffsetPhaseRect, g_pfreedv->n_nom_modem_samples); + for(i=0; in_nom_modem_samples; i++) + out8k_short[i] = tx_fdm_offset[i].real; + } - // output 40ms of modem tone - nout = resample(cbData->outsrc1, out48k_short, out8k_short, g_soundCard1SampleRate, FS, N48, N8); + // output one frame of modem signal + nout = resample(cbData->outsrc1, out48k_short, out8k_short, g_soundCard1SampleRate, g_pfreedv->modem_sample_rate, N48, g_pfreedv->n_nom_modem_samples); g_mutexProtectingCallbackData.Lock(); fifo_write(cbData->outfifo1, out48k_short, nout); } @@ -3109,18 +3118,18 @@ void per_frame_rx_processing( FIFO *input_fifo ) { - short input_buf[FREEDV_NSAMPLES]; + short input_buf[g_pfreedv->n_max_modem_samples]; short output_buf[N8]; - COMP rx_fdm[2*FREEDV_NSAMPLES]; - COMP rx_fdm_offset[2*FREEDV_NSAMPLES]; + COMP rx_fdm[g_pfreedv->n_max_modem_samples]; + COMP rx_fdm_offset[g_pfreedv->n_max_modem_samples]; float rx_spec[FDMDV_NSPEC]; int i; - int nin, nin_prev; + int nin, nin_prev, nout; nin = freedv_nin(g_pfreedv); while (fifo_read(input_fifo, input_buf, nin) == 0) { - assert(nin <= 2*FREEDV_NSAMPLES); + assert(nin <= g_pfreedv->n_max_modem_samples); nin_prev = nin; @@ -3135,7 +3144,9 @@ void per_frame_rx_processing( fdmdv_simulate_channel(g_pfreedv->fdmdv, rx_fdm, nin, 2.0); } fdmdv_freq_shift(rx_fdm_offset, rx_fdm, g_RxFreqOffsetHz, &g_RxFreqOffsetPhaseRect, nin); - freedv_comprx(g_pfreedv, output_buf, rx_fdm_offset); + nout = freedv_comprx(g_pfreedv, output_buf, rx_fdm_offset); + fifo_write(output_fifo, output_buf, nout); + nin = freedv_nin(g_pfreedv); g_State = g_pfreedv->fdmdv_stats.sync; g_snr = g_pfreedv->fdmdv_stats.snr_est; diff --git a/fdmdv2-dev/src/topFrame.cpp b/fdmdv2-dev/src/topFrame.cpp index c383a8f7..13c26d57 100644 --- a/fdmdv2-dev/src/topFrame.cpp +++ b/fdmdv2-dev/src/topFrame.cpp @@ -300,18 +300,20 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxStaticBoxSizer* sbSizer_mode; sbSizer_mode = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Mode")), wxVERTICAL); +#ifdef DISABLED_FEATURE m_rb1400old = new wxRadioButton( this, wxID_ANY, wxT("1400 V0.91"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); sbSizer_mode->Add(m_rb1400old, 0, wxALIGN_LEFT|wxALL, 1); -#ifdef DISABLED_FEATURE m_rb1400 = new wxRadioButton( this, wxID_ANY, wxT("1400"), wxDefaultPosition, wxDefaultSize, 0); sbSizer_mode->Add(m_rb1400, 0, wxALIGN_LEFT|wxALL, 1); #endif + m_rb700 = new wxRadioButton( this, wxID_ANY, wxT("700"), wxDefaultPosition, wxDefaultSize, 0); + sbSizer_mode->Add(m_rb700, 0, wxALIGN_LEFT|wxALL, 1); m_rb1600 = new wxRadioButton( this, wxID_ANY, wxT("1600"), wxDefaultPosition, wxDefaultSize, 0); sbSizer_mode->Add(m_rb1600, 0, wxALIGN_LEFT|wxALL, 1); m_rb1600->SetValue(true); +#ifdef DISABLED_FEATURE m_rb1600Wide = new wxRadioButton( this, wxID_ANY, wxT("1600 Wide"), wxDefaultPosition, wxDefaultSize, 0); sbSizer_mode->Add(m_rb1600Wide, 0, wxALIGN_LEFT|wxALL, 1); -#ifdef DISABLED_FEATURE m_rb2000 = new wxRadioButton( this, wxID_ANY, wxT("2000"), wxDefaultPosition, wxDefaultSize, 0); sbSizer_mode->Add(m_rb2000, 0, wxALIGN_LEFT|wxALL, 1); #endif diff --git a/fdmdv2-dev/src/topFrame.h b/fdmdv2-dev/src/topFrame.h index 86ddb388..43413154 100644 --- a/fdmdv2-dev/src/topFrame.h +++ b/fdmdv2-dev/src/topFrame.h @@ -106,6 +106,7 @@ class TopFrame : public wxFrame wxRadioButton *m_rbSync; wxRadioButton *m_rb1400old; wxRadioButton *m_rb1400; + wxRadioButton *m_rb700; wxRadioButton *m_rb1600; wxRadioButton *m_rb2000; wxRadioButton *m_rb1600Wide; -- 2.25.1