From: wittend99 Date: Fri, 19 Oct 2012 12:54:57 +0000 (+0000) Subject: git-svn-id: https://svn.code.sf.net/p/freetel/code@778 01035d8c-6547-0410-b346-abe4f9... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=c5dc75040a45246f6d21dd3428fac3b0ad2e3352;p=freetel-svn-tracking.git git-svn-id: https://svn.code.sf.net/p/freetel/code@778 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2/build/Debug/.gitignore b/fdmdv2/build/Debug/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/fdmdv2/build/Debug/libsndfile-1.dll b/fdmdv2/build/Debug/libsndfile-1.dll new file mode 100644 index 00000000..545ffb50 Binary files /dev/null and b/fdmdv2/build/Debug/libsndfile-1.dll differ diff --git a/fdmdv2/build/Release/.gitignore b/fdmdv2/build/Release/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/fdmdv2/build/Release/libsndfile-1.dll b/fdmdv2/build/Release/libsndfile-1.dll new file mode 100644 index 00000000..545ffb50 Binary files /dev/null and b/fdmdv2/build/Release/libsndfile-1.dll differ diff --git a/fdmdv2/build/fdmdv2.mk b/fdmdv2/build/fdmdv2.mk index ffafb5c5..0f717de6 100644 --- a/fdmdv2/build/fdmdv2.mk +++ b/fdmdv2/build/fdmdv2.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=OFA-Staff -Date :=10/16/2012 +Date :=10/18/2012 CodeLitePath :="C:\bin\CodeLite" LinkerName :=g++ SharedObjectLinkerName :=g++ -shared -fPIC @@ -36,12 +36,12 @@ ObjectsFileList :="C:\bin\Projects\Radio\fdmdv2\build\fdmdv2.txt" PCHCompileFlags := MakeDirCommand :=makedir LinkOptions := -mwindows -s $(shell wx-config --debug=no --libs --unicode=yes) -IncludePath := $(IncludeSwitch). $(IncludeSwitch)/bin/MinGW-4.6.1/msys/1.0/local/include $(IncludeSwitch)../../codec2-dev/src +IncludePath := $(IncludeSwitch). $(IncludeSwitch)/bin/MinGW-4.6.1/msys/1.0/local/include $(IncludeSwitch)../../codec2-dev/src $(IncludeSwitch)/bin/Projects/Audio/libsndfile/ IncludePCH := RcIncludePath := Libs := $(LibrarySwitch)sndfile-1 $(LibrarySwitch)codec2 $(LibrarySwitch)portaudio $(LibrarySwitch)portaudiocpp ArLibs := "libsndfile-1.dll" "codec2" "libportaudio.a" "libportaudiocpp.a" -LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/bin/Projects/Radio/codec2-dev/src/.libs $(LibraryPathSwitch)/bin/MinGW-4.6.1/msys/1.0/local/lib +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/bin/Projects/Radio/codec2-dev/src/.libs $(LibraryPathSwitch)/bin/MinGW-4.6.1/msys/1.0/local/lib $(LibraryPathSwitch)/bin/Projects/Audio/libsndfile/lib ## ## Common variables diff --git a/fdmdv2/build/fdmdv2.project b/fdmdv2/build/fdmdv2.project index 13082e86..62371813 100644 --- a/fdmdv2/build/fdmdv2.project +++ b/fdmdv2/build/fdmdv2.project @@ -67,6 +67,7 @@ + @@ -85,16 +86,17 @@ - + - - - + - - + + + + + @@ -134,11 +136,13 @@ + + diff --git a/fdmdv2/src/fdmdv2_main.cpp b/fdmdv2/src/fdmdv2_main.cpp index be785496..b46c4b9b 100644 --- a/fdmdv2/src/fdmdv2_main.cpp +++ b/fdmdv2/src/fdmdv2_main.cpp @@ -1,4 +1,4 @@ -//========================================================================== + //========================================================================== // Name: fdmdv2_main.cpp // // Purpose: Implements simple wxWidgets application with GUI. @@ -88,9 +88,11 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent) // @brief */ // m_radioRunning = false; - m_sound = NULL; +// m_sound = NULL; + m_sfFile = NULL; m_zoom = 1.; m_SquelchActive = false; + if(Pa_Initialize()) { wxMessageBox(wxT("Port Audio failed to initialize"), wxT("Pa_Initialize"), wxOK); @@ -117,10 +119,6 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent) // m_panelScalar = new PlotScalar((wxFrame*) m_auiNbookCtrl, 500, 500); // m_auiNbookCtrl->AddPage(m_panelWaterfall, _("Scalar"), true, wxNullBitmap); - // Add generic plot window -// m_panelDefaultA = new PlotPanel((wxFrame*) m_auiNbookCtrl); -// m_auiNbookCtrl->AddPage(m_panelDefaultA, _("Test A"), true, wxNullBitmap); - wxConfigBase *pConfig = wxConfigBase::Get(); // restore frame position and size @@ -136,8 +134,6 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent) wxGetApp().m_textVoiceInput = pConfig->Read(wxT("/Audio/TxIn"), wxT("")); wxGetApp().m_textVoiceOutput = pConfig->Read(wxT("/Audio/TxOut"), wxT("")); wxGetApp().m_strSampleRate = pConfig->Read(wxT("/Audio/SampleRate"), wxT("48000")); -// wxGetApp().m_strSampleRate = pConfig->Read(wxT("/Audio/SampleRate"), wxT("48000")); -// wxGetApp().m_strSampleRate = pConfig->Read(wxT("/Audio/SampleRate"), wxT("48000")); wxGetApp().m_strRigCtrlPort = pConfig->Read("/Rig/Port", wxT("\\\\.\\com1")); wxGetApp().m_strRigCtrlBaud = pConfig->Read("/Rig/Baud", wxT("9600")); @@ -162,15 +158,22 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent) m_togBtnAnalog->Disable(); m_togBtnALC->Disable(); m_btnTogTX->Disable(); + m_togBtnLoopRx->Disable(); + m_togBtnLoopTx->Disable(); + +// m_menuItemPlayAudioFile->Enable(false); + #ifdef _USE_TIMER Bind(wxEVT_TIMER, &MainFrame::OnTimer, this); // ID_MY_WINDOW); m_plotTimer.SetOwner(this, ID_TIMER_WATERFALL); // m_rxPa = new PortAudioWrap(); -// m_plotTimer.Start(500, wxTIMER_CONTINUOUS); +// m_plotTimer.Start(_REFRESH_TIMER_PERIOD, wxTIMER_CONTINUOUS); // m_panelWaterfall->m_newdata = true; m_panelWaterfall->Refresh(); -#else +#endif + +#ifdef _USE_ONIDLE Connect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this); #endif //_USE_TIMER } @@ -214,22 +217,27 @@ MainFrame::~MainFrame() m_togBtnAnalog->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnAnalogClickUI), NULL, this); m_togBtnALC->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnALCClickUI), NULL, this); m_btnTogTX->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTXClickUI), NULL, this); - + if(m_sfFile != NULL) + { + sf_close(m_sfFile); + m_sfFile = NULL; + } #ifdef _USE_TIMER if(m_plotTimer.IsRunning()) { m_plotTimer.Stop(); Unbind(wxEVT_TIMER, &MainFrame::OnTimer, this); } -#else - Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this); #endif //_USE_TIMER +#ifdef _USE_ONIDLE + Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this); +#endif // _USE_ONIDLE + delete wxConfigBase::Set((wxConfigBase *) NULL); } #ifdef _USE_TIMER - //---------------------------------------------------------------- // OnTimer() //---------------------------------------------------------------- @@ -239,12 +247,10 @@ void MainFrame::OnTimer(wxTimerEvent &evt) m_panelWaterfall->Refresh(); m_panelSpectrum->m_newdata = true; m_panelSpectrum->Refresh(); -// m_panelDefaultA->m_newdata = true; -// m_panelDefaultA->Refresh(); } +#endif -#else - +#ifdef _USE_ONIDLE //---------------------------------------------------------------- // OnIdle() //---------------------------------------------------------------- @@ -259,7 +265,6 @@ void MainFrame::OnIdle(wxIdleEvent& event) m_panelSpectrum->Refresh(); } } - #endif // _USE_TIMER //------------------------------------------------------------------------- @@ -342,7 +347,6 @@ void MainFrame::OnSliderScrollTop(wxScrollEvent& event) //------------------------------------------------------------------------- void MainFrame::OnSliderScrollBottom(wxScrollEvent& event) { -// wxMessageBox(wxT("Got Click!"), wxT("OnSliderScrollBottom"), wxOK); event.Skip(); } @@ -366,9 +370,9 @@ void MainFrame::OnCheckSQClick(wxCommandEvent& event) //------------------------------------------------------------------------- void MainFrame::OnTogBtnTXClick(wxCommandEvent& event) { - m_soundFile = wxT("./hts1a.wav"); - m_sound = new wxSound(m_soundFile, false); - m_sound->Play(); +// m_soundFile = wxT("./hts1a.wav"); +// m_sound = new wxSound(m_soundFile, false); +// m_sound->Play(); } //------------------------------------------------------------------------- @@ -413,210 +417,318 @@ void MainFrame::OnTogBtnALCClick(wxCommandEvent& event) } //------------------------------------------------------------------------- -// OnTogBtnSplitClickUI() +// OnOpen() //------------------------------------------------------------------------- -void MainFrame::OnTogBtnSplitClickUI(wxUpdateUIEvent& event) +void MainFrame::OnOpen(wxCommandEvent& event) { wxUnusedVar(event); -// event.Enable(false); + wxFileDialog openFileDialog( + this, + wxT("Open Sound File"), + wxEmptyString, + wxEmptyString, +// (const wxChar *)NULL, + wxT("RAW files (*.raw)|*.raw|") + wxT("WAV files (*.wav)|*.wav|") + wxT("Octave 2.0 files (*.mat4)|*.mat4|") + wxT("Octave 2.1 files (*.mat5)|*.mat5|") + wxT("FLAC files (*.flc)|*.flc|") + wxT("All files (*.*)|*.*"), + wxFD_OPEN | wxFD_FILE_MUST_EXIST + ); + if(openFileDialog.ShowModal() == wxID_CANCEL) + { + return; // the user changed their mind... + } + wxString extension; + m_soundFile = openFileDialog.GetPath(); + wxFileName::SplitPath(m_soundFile, NULL, NULL, &extension); + //wxLogError("Cannot open file '%s'.", openFileDialog.GetPath()); +#ifdef _READ_WITH_SNDFILE + m_sfInfo.format = 0; + if(!extension.IsEmpty()) + { + extension.LowerCase(); + if(extension == wxT("raw")) + { + m_sfInfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_U8; + m_sfInfo.channels = 2; + m_sfInfo.samplerate = 8000; + } + } + m_sfFile = sf_open(m_soundFile, SFM_READ, &m_sfInfo); + if(m_sfFile == NULL) + { + wxString strErr = sf_strerror(NULL); + wxMessageBox(strErr, wxT("File Error"), wxOK); + return; + } +#endif // _READ_WITH_SNDFILE + SetStatusText(wxT("File: ") + m_soundFile, 0); +// bool saved = false; } //------------------------------------------------------------------------- -// OnTogBtnAnalogClickUI() +// OnPlayAudioFile() //------------------------------------------------------------------------- -void MainFrame::OnTogBtnAnalogClickUI(wxUpdateUIEvent& event) +void MainFrame::OnPlayAudioFile(wxCommandEvent& event) { wxUnusedVar(event); +/* + // proceed loading the file chosen by the user; + m_sound->Play(openFileDialog.GetPath()); +*/ } //------------------------------------------------------------------------- -// OnTogBtnALCClickUI() +// OnSave() //------------------------------------------------------------------------- -void MainFrame::OnTogBtnALCClickUI(wxUpdateUIEvent& event) +void MainFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { - wxUnusedVar(event); +/* + wxString savefilename = wxFileSelector( + wxT("Save Sound File"), + wxEmptyString, + wxEmptyString, + (const wxChar *)NULL, + wxT("WAV files (*.wav)|*.wav|") + wxT("RAW files (*.raw)|*.raw|") + wxT("SPEEX files (*.spx)|*.spx|") + wxT("FLAC files (*.flc)|*.flc|"), + wxFD_SAVE, + this + ); + if(savefilename.empty()) + { + return; + } + wxString extension; + wxFileName::SplitPath(savefilename, NULL, NULL, &extension); + bool saved = false; + if(!saved) + { + // This one guesses image format from filename extension + // (it may fail if the extension is not recognized): + //image.SaveFile(savefilename); + } +*/ } //------------------------------------------------------------------------- -// OnTogBtnRxIDUI() +// OnClose() //------------------------------------------------------------------------- -void MainFrame::OnTogBtnRxIDUI(wxUpdateUIEvent& event) +void MainFrame::OnClose(wxCommandEvent& event) { wxUnusedVar(event); + +#ifdef _USE_TIMER + //DMW Reenable for the nonce... + m_plotTimer.Stop(); +#endif // _USE_TIMER + if(m_sfFile != NULL) + { + sf_close(m_sfFile); + m_sfFile = NULL; + } + if(m_RxRunning) + { + stopRxStream(); + } + if(m_TxRunning) + { + stopTxStream(); + } + m_togBtnSplit->Disable(); + m_togRxID->Disable(); + m_togTxID->Disable(); + m_togBtnAnalog->Disable(); + m_togBtnALC->Disable(); + m_btnTogTX->Disable(); + m_togBtnLoopRx->Disable(); + m_togBtnLoopTx->Disable(); +/* + This is an artifact of my early use of the default wxWidgets + sound facility. the wxSound interface is simplistic and and + unsuitable for this project's purposes. + + if(m_sound != NULL) + { + if(m_sound->IsOk()) + { + m_sound->Stop(); + m_sound = NULL; + } + } +*/ } //------------------------------------------------------------------------- -// OnTogBtnTxIDUI() +// OnExit() //------------------------------------------------------------------------- -void MainFrame::OnTogBtnTxIDUI(wxUpdateUIEvent& event) +void MainFrame::OnExit(wxCommandEvent& event) { - wxUnusedVar(event); +// OnClose(event); + if(m_RxRunning) + { + stopRxStream(); + } + if(m_TxRunning) + { + stopTxStream(); + } + Close(); } //------------------------------------------------------------------------- -// OnTogBtnTXClickUI() +// OnCopy() //------------------------------------------------------------------------- -void MainFrame::OnTogBtnTXClickUI(wxUpdateUIEvent& event) +void MainFrame::OnCopy(wxCommandEvent& event) { - wxUnusedVar(event); + event.Skip(); } //------------------------------------------------------------------------- -// OnOpenUpdateUI() +// OnCut() //------------------------------------------------------------------------- -void MainFrame::OnOpenUpdateUI(wxUpdateUIEvent& event) +void MainFrame::OnCut(wxCommandEvent& event) { - wxUnusedVar(event); + event.Skip(); } //------------------------------------------------------------------------- -// OnSaveUpdateUI() +// OnPaste() //------------------------------------------------------------------------- -void MainFrame::OnSaveUpdateUI(wxUpdateUIEvent& event) +void MainFrame::OnPaste(wxCommandEvent& event) { -// wxUnusedVar(event); - event.Enable(false); + event.Skip(); } //------------------------------------------------------------------------- -// OnClose() +// OnCaptureRxStream() //------------------------------------------------------------------------- -void MainFrame::OnClose(wxCommandEvent& event) +void MainFrame::OnCaptureRxStream(wxCommandEvent& event) { wxUnusedVar(event); +} - if(m_RxRunning) - { - stopRxStream(); - } - if(m_TxRunning) - { - stopTxStream(); - } +//------------------------------------------------------------------------- +// OnCaptureTxStream() +//------------------------------------------------------------------------- +void MainFrame::OnCaptureTxStream(wxCommandEvent& event) +{ + wxUnusedVar(event); +} - if(m_sound != NULL) - { - if(m_sound->IsOk()) - { - m_sound->Stop(); - m_sound = NULL; - } - } - Close(); +/* +//------------------------------------------------------------------------- +// OnTogBtnSplitClickUI() +//------------------------------------------------------------------------- +void MainFrame::OnTogBtnSplitClickUI(wxUpdateUIEvent& event) +{ + wxUnusedVar(event); +// event.Enable(false); } //------------------------------------------------------------------------- -// OnCloseUpdateUI() +// OnTogBtnAnalogClickUI() //------------------------------------------------------------------------- -void MainFrame::OnCloseUpdateUI(wxUpdateUIEvent& event) +void MainFrame::OnTogBtnAnalogClickUI(wxUpdateUIEvent& event) { - event.Enable(false); + wxUnusedVar(event); } //------------------------------------------------------------------------- -// OnExit() +// OnTogBtnALCClickUI() //------------------------------------------------------------------------- -void MainFrame::OnExit(wxCommandEvent& event) +void MainFrame::OnTogBtnALCClickUI(wxUpdateUIEvent& event) { - OnClose(event); + wxUnusedVar(event); } //------------------------------------------------------------------------- -// OnCopy() +// OnTogBtnRxIDUI() //------------------------------------------------------------------------- -void MainFrame::OnCopy(wxCommandEvent& event) +void MainFrame::OnTogBtnRxIDUI(wxUpdateUIEvent& event) { - event.Skip(); + wxUnusedVar(event); } //------------------------------------------------------------------------- -// OnCopyUpdateUI() +// OnTogBtnTxIDUI() //------------------------------------------------------------------------- -void MainFrame::OnCopyUpdateUI(wxUpdateUIEvent& event) +void MainFrame::OnTogBtnTxIDUI(wxUpdateUIEvent& event) { - event.Enable(false); + wxUnusedVar(event); } //------------------------------------------------------------------------- -// OnCut() +// OnTogBtnTXClickUI() //------------------------------------------------------------------------- -void MainFrame::OnCut(wxCommandEvent& event) +void MainFrame::OnTogBtnTXClickUI(wxUpdateUIEvent& event) { - event.Skip(); + wxUnusedVar(event); } //------------------------------------------------------------------------- -// OnCutUpdateUI() +// OnOpenUpdateUI() //------------------------------------------------------------------------- -void MainFrame::OnCutUpdateUI(wxUpdateUIEvent& event) +void MainFrame::OnOpenUpdateUI(wxUpdateUIEvent& event) +{ + wxUnusedVar(event); +} + +//------------------------------------------------------------------------- +// OnSaveUpdateUI() +//------------------------------------------------------------------------- +void MainFrame::OnSaveUpdateUI(wxUpdateUIEvent& event) { // wxUnusedVar(event); event.Enable(false); } //------------------------------------------------------------------------- -// OnPaste() +// OnCloseUpdateUI() //------------------------------------------------------------------------- -void MainFrame::OnPaste(wxCommandEvent& event) +void MainFrame::OnCloseUpdateUI(wxUpdateUIEvent& event) { - event.Skip(); +// event.Enable(false); } //------------------------------------------------------------------------- -// OnPasteUpdateUI() +// OnCutUpdateUI() //------------------------------------------------------------------------- -void MainFrame::OnPasteUpdateUI(wxUpdateUIEvent& event) +void MainFrame::OnCutUpdateUI(wxUpdateUIEvent& event) { +// wxUnusedVar(event); event.Enable(false); } //------------------------------------------------------------------------- -// OnCaptureRxStream() +// OnCopyUpdateUI() //------------------------------------------------------------------------- -void MainFrame::OnCaptureRxStream(wxCommandEvent& event) +void MainFrame::OnCopyUpdateUI(wxUpdateUIEvent& event) { - wxUnusedVar(event); + event.Enable(false); } //------------------------------------------------------------------------- -// OnCaptureTxStream() +// OnPasteUpdateUI() //------------------------------------------------------------------------- -void MainFrame::OnCaptureTxStream(wxCommandEvent& event) +void MainFrame::OnPasteUpdateUI(wxUpdateUIEvent& event) { - wxUnusedVar(event); + event.Enable(false); } //------------------------------------------------------------------------- -// OnPlayAudioFile() +// OnTogBtnOnOffUI() //------------------------------------------------------------------------- -void MainFrame::OnPlayAudioFile(wxCommandEvent& event) +void MainFrame::OnTogBtnOnOffUI(wxUpdateUIEvent& event) { wxUnusedVar(event); - if(m_sound != NULL) - { - if (wxMessageBox(wxT("Current content has not been saved! Proceed?"),wxT("Please confirm"), wxICON_QUESTION | wxYES_NO, this) == wxNO) - { - return; - } - } - wxFileDialog openFileDialog(this, - wxT("Open Sound file"), - wxEmptyString, - wxEmptyString, - wxT("WAV files (*.wav)|*.wav|") - wxT("RAW files (*.raw)|*.raw|") - wxT("SPEEX files (*.spx)|*.spx|") - wxT("FLAC files (*.flc)|*.flc|") - wxT("All files (*.*)|*.*|"), - wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (openFileDialog.ShowModal() == wxID_CANCEL) - { - return; // the user changed their mind... - } - // proceed loading the file chosen by the user; - m_sound->Play(openFileDialog.GetPath()); } +*/ + //------------------------------------------------------------------------- // OnToolsAudio() //------------------------------------------------------------------------- @@ -723,6 +835,7 @@ void MainFrame::OnHelpAbout(wxCommandEvent& event) // delete dlg; } +/* //------------------------------------------------------------------------- // LoadUserImage() //------------------------------------------------------------------------- @@ -741,14 +854,7 @@ wxString MainFrame::LoadUserImage(wxImage& image) } return filename; } - -//------------------------------------------------------------------------- -// OnTogBtnOnOffUI() -//------------------------------------------------------------------------- -void MainFrame::OnTogBtnOnOffUI(wxUpdateUIEvent& event) -{ - wxUnusedVar(event); -} +*/ //---------------------------------------------------------- // Global Codec2 thingys - just one reqd for tx & rx @@ -763,6 +869,8 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event) { if((!m_RxRunning)) { + m_RxRunning = true; + printf("starting ...\n"); m_togBtnSplit->Enable(); @@ -771,13 +879,15 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event) m_togBtnAnalog->Enable(); m_togBtnALC->Enable(); m_btnTogTX->Enable(); + m_togBtnLoopRx->Enable(); + m_togBtnLoopTx->Enable(); g_pFDMDV = fdmdv_create(); g_pCodec2 = codec2_create(CODEC2_MODE_1400); #ifdef _USE_TIMER - // DR: disable this puppy for now as it's causing a lot of error messages - //m_plotTimer.Start(500, wxTIMER_CONTINUOUS); + //DMW Reenable for the nonce... // DR: disable this puppy for now as it's causing a lot of error messages + m_plotTimer.Start(_REFRESH_TIMER_PERIOD, wxTIMER_CONTINUOUS); #endif // _USE_TIMER startRxStream(); // startTxStream(); @@ -788,6 +898,7 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event) } else { + m_RxRunning = false; printf("stopping ...\n"); m_togBtnSplit->Disable(); @@ -796,8 +907,11 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event) m_togBtnAnalog->Disable(); m_togBtnALC->Disable(); m_btnTogTX->Disable(); + m_togBtnLoopRx->Disable(); + m_togBtnLoopTx->Disable(); #ifdef _USE_TIMER - //m_plotTimer.Stop(); + //DMW Reenable for the nonce... + m_plotTimer.Stop(); #endif // _USE_TIMER stopRxStream(); // stopTxStream(); @@ -824,17 +938,6 @@ void MainFrame::OnTogBtnLoopTx( wxCommandEvent& event ) //---------------------------------------------------------- // Audio stream processing loop states (globals). //---------------------------------------------------------- -/* -float Ts = 0.0; -short input_buf[2*FDMDV_NOM_SAMPLES_PER_FRAME]; -short *output_buf; -int n_input_buf = 0; -int nin = FDMDV_NOM_SAMPLES_PER_FRAME; -int n_output_buf = 0; -int codec_bits[2*FDMDV_BITS_PER_FRAME]; -int state = 0; -*/ - int g_nRxIn = FDMDV_NOM_SAMPLES_PER_FRAME; float g_Ts = 0.0; @@ -966,8 +1069,8 @@ void MainFrame::stopRxStream() fdmdv_destroy(g_pFDMDV); codec2_destroy(g_pCodec2); // delete g_RxInBuf; - fifo_destroy(m_rxUserdata->infifo); - fifo_destroy(m_rxUserdata->outfifo); + fifo_destroy(m_rxUserdata->infifo); + fifo_destroy(m_rxUserdata->outfifo); delete m_rxUserdata; } /* @@ -1090,14 +1193,6 @@ void MainFrame::abortTxStream() } } -//------------------------------------------------------------------------- -// OnOpen() -//------------------------------------------------------------------------- -void MainFrame::OnOpen(wxCommandEvent& event) -{ - wxUnusedVar(event); -} - //---------------------------------------------------------------- // update average of each spectrum point //---------------------------------------------------------------- @@ -1156,8 +1251,7 @@ int MainFrame::rxCallback( we do a little FIFO buffering. */ - /* assemble a mono buffer (just use left channel) and write to FIFO */ - + // assemble a mono buffer (just use left channel) and write to FIFO assert(framesPerBuffer < MAX_FPB); for(i = 0; i < framesPerBuffer; i++, rptr += 2) { @@ -1165,14 +1259,14 @@ int MainFrame::rxCallback( } fifo_write(cbData->infifo, indata, framesPerBuffer); - /* while we have enough samples available ... */ + // while we have enough samples available ... while (fifo_read(cbData->infifo, in48k_short, N48) == 0) { - /* convert to float */ - - for(i=0; i= 0); + // shift speech samples in output buffer for(i = 0; i < (unsigned int)g_nOutputBuf; i++) { g_pRxOutBuf[i] = g_pRxOutBuf[i + N8]; } - /* test: echo input to output, make this loopback option */ - for(i=0; ioutfifo, out48k_short, N48); } - /* OK now set up output samples */ + // OK now set up output samples if (fifo_read(cbData->outfifo, outdata, framesPerBuffer) == 0) { - /* write signal to both channels */ - for(i=0; i