From: drowe67 Date: Fri, 4 May 2018 05:13:35 +0000 (+0000) Subject: moved FIFO and PortAudio under/overflow counters to Tools-Options Dialog X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=c8c43c4cf83e826ea22a25af65e281f40fce02e2;p=freetel-svn-tracking.git moved FIFO and PortAudio under/overflow counters to Tools-Options Dialog git-svn-id: https://svn.code.sf.net/p/freetel/code@3571 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-dev/src/dlg_options.cpp b/freedv-dev/src/dlg_options.cpp index eb59403b..f636971d 100644 --- a/freedv-dev/src/dlg_options.cpp +++ b/freedv-dev/src/dlg_options.cpp @@ -24,6 +24,15 @@ extern bool g_modal; extern struct freedv *g_pfreedv; +// PortAudio over/underflow counters + +extern int g_infifo1_full; +extern int g_outfifo1_empty; +extern int g_infifo2_full; +extern int g_outfifo2_empty; +extern int g_PAstatus1[4]; +extern int g_PAstatus2[4]; + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= // Class OptionsDlg //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= @@ -245,6 +254,27 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c bSizer30->Add(sbSizer_udp,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); #endif + //---------------------------------------------------------- + // FIFO and PortAudio under/overflow counters used for debug + //---------------------------------------------------------- + + wxStaticBoxSizer* sbSizer_fifo; + wxStaticBox* sb_fifo = new wxStaticBox(this, wxID_ANY, _("FIFO and PortAudio Debug Counters")); + sbSizer_fifo = new wxStaticBoxSizer(sb_fifo, wxVERTICAL); + + m_BtnFifoReset = new wxButton(this, wxID_ANY, _("Reset"), wxDefaultPosition, wxDefaultSize, 0); + sbSizer_fifo->Add(m_BtnFifoReset, 0, wxALIGN_LEFT, 5); + + m_textFifos = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + sbSizer_fifo->Add(m_textFifos, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); + + m_textPA1 = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + sbSizer_fifo->Add(m_textPA1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); + m_textPA2 = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + sbSizer_fifo->Add(m_textPA2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); + + bSizer30->Add(sbSizer_fifo,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); + //------------------------------ // OK - Cancel - Apply Buttons //------------------------------ @@ -292,6 +322,8 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c m_buttonChooseVoiceKeyerWaveFile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseVoiceKeyerWaveFile), NULL, this); + m_BtnFifoReset->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnFifoReset), NULL, this); + event_in_serial = 0; event_out_serial = 0; } @@ -318,6 +350,8 @@ OptionsDlg::~OptionsDlg() m_ckboxFreeDV700Combine->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700Combine), NULL, this); m_buttonChooseVoiceKeyerWaveFile->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseVoiceKeyerWaveFile), NULL, this); + m_BtnFifoReset->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnFifoReset), NULL, this); + #ifdef __WXMSW__ m_ckboxDebugConsole->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnDebugConsole), NULL, this); #endif @@ -615,3 +649,34 @@ void OptionsDlg::OnDebugConsole(wxScrollEvent& event) { } #endif } + + +void OptionsDlg::OnFifoReset(wxCommandEvent& event) +{ + g_infifo1_full = g_outfifo1_empty = g_infifo2_full = g_outfifo2_empty = 0; + for (int i=0; i<4; i++) { + g_PAstatus1[i] = g_PAstatus2[i] = 0; + } +} + + +void OptionsDlg::DisplayFifoPACounters() { + char fifo_counters[80]; + + sprintf(fifo_counters, "fifos: infull1: %d ooutempty1: %d infull2: %d outempty2: %d", g_infifo1_full, g_outfifo1_empty, g_infifo2_full, g_outfifo2_empty); + wxString fifo_counters_string(fifo_counters); + m_textFifos->SetLabel(fifo_counters_string); + + char pa_counters1[80]; + + // input: underflow overflow output: underflow overflow + sprintf(pa_counters1, "PA1: inUnderflow: %d inOverflow: %d outUnderflow %d outOverflow %d", g_PAstatus1[0], g_PAstatus1[1], g_PAstatus1[2], g_PAstatus1[3]); + wxString pa_counters1_string(pa_counters1); m_textPA1->SetLabel(pa_counters1_string); + + char pa_counters2[80]; + + // input: underflow overflow output: underflow overflow + sprintf(pa_counters2, "PA2: inUnderflow: %d inOverflow: %d outUnderflow %d outOverflow %d", g_PAstatus2[0], g_PAstatus2[1], g_PAstatus2[2], g_PAstatus2[3]); + wxString pa_counters2_string(pa_counters2); + m_textPA2->SetLabel(pa_counters2_string); +} diff --git a/freedv-dev/src/dlg_options.h b/freedv-dev/src/dlg_options.h index 081448cb..9c954513 100644 --- a/freedv-dev/src/dlg_options.h +++ b/freedv-dev/src/dlg_options.h @@ -48,6 +48,8 @@ class OptionsDlg : public wxDialog bool enableEventsChecked() {return m_ckbox_events->GetValue();} + void DisplayFifoPACounters(); + void SetSpamTimerLight(bool state) { // Colours don't work on Windows @@ -80,6 +82,8 @@ class OptionsDlg : public wxDialog void OnFreeDV700Combine(wxScrollEvent& event); void OnDebugConsole(wxScrollEvent& event); + void OnFifoReset(wxCommandEvent& event); + wxTextCtrl *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge wxCheckBox* m_ckHalfDuplex; @@ -121,6 +125,11 @@ class OptionsDlg : public wxDialog wxCheckBox *m_ckbox_udp_enable; wxTextCtrl *m_txt_udp_port; + wxButton* m_BtnFifoReset; + wxStaticText *m_textFifos; + wxStaticText *m_textPA1; + wxStaticText *m_textPA2; + wxButton* m_sdbSizer5OK; wxButton* m_sdbSizer5Cancel; wxButton* m_sdbSizer5Apply; diff --git a/freedv-dev/src/fdmdv2_main.cpp b/freedv-dev/src/fdmdv2_main.cpp index 263a7cdc..5dc4421b 100644 --- a/freedv-dev/src/fdmdv2_main.cpp +++ b/freedv-dev/src/fdmdv2_main.cpp @@ -1255,17 +1255,9 @@ void MainFrame::OnTimer(wxTimerEvent &evt) } } - /* FIFO under/overflow debug counters */ + /* FIFO and PortAudio under/overflow debug counters */ - char fifo_counters[80]; - sprintf(fifo_counters, "%d %d %d %d", g_infifo1_full, g_outfifo1_empty, g_infifo2_full, g_outfifo2_empty); - wxString fifo_counters_string(fifo_counters); m_textFifos->SetLabel(fifo_counters_string); - - char pa_counters1[80]; - - // input: underflow overflow output: underflow overflow - sprintf(pa_counters1, "iu%d io%d ou%d oo%d", g_PAstatus1[0], g_PAstatus1[1], g_PAstatus1[2], g_PAstatus1[3]); - wxString pa_counters1_string(pa_counters1); m_textPA1->SetLabel(pa_counters1_string); + optionsDlg->DisplayFifoPACounters(); } // command from UDP thread that is best processed in main thread to avoid seg faults @@ -1748,10 +1740,6 @@ void MainFrame::OnBerReset(wxCommandEvent& event) g_error_hist[i] = 0; g_error_histn[i] = 0; } - g_infifo1_full = g_outfifo1_empty = g_infifo2_full = g_outfifo2_empty = 0; - for (int i=0; i<4; i++) { - g_PAstatus1[i] = g_PAstatus2[i] = 0; - } } diff --git a/freedv-dev/src/topFrame.cpp b/freedv-dev/src/topFrame.cpp index 66dd7387..69bdfc7b 100644 --- a/freedv-dev/src/topFrame.cpp +++ b/freedv-dev/src/topFrame.cpp @@ -165,18 +165,9 @@ TopFrame::TopFrame(wxString plugInName, wxWindow* parent, wxWindowID id, const w sbSizer_ber->Add(m_textErrors, 0, wxALIGN_LEFT, 1); m_textBER = new wxStaticText(this, wxID_ANY, wxT("BER: 0.0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); sbSizer_ber->Add(m_textBER, 0, wxALIGN_LEFT, 1); - m_textResyncs = new wxStaticText(this, wxID_ANY, wxT("Resyncs: 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); sbSizer_ber->Add(m_textResyncs, 0, wxALIGN_LEFT, 1); - m_textFifos = new wxStaticText(this, wxID_ANY, wxT("0 0 0 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); - sbSizer_ber->Add(m_textFifos, 0, wxALIGN_LEFT, 1); - - m_textPA1 = new wxStaticText(this, wxID_ANY, wxT("0 0 0 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); - sbSizer_ber->Add(m_textPA1, 0, wxALIGN_LEFT, 1); - m_textPA2 = new wxStaticText(this, wxID_ANY, wxT("0 0 0 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); - sbSizer_ber->Add(m_textPA2, 0, wxALIGN_LEFT, 1); - leftSizer->Add(sbSizer_ber,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); //------------------------------ diff --git a/freedv-dev/src/topFrame.h b/freedv-dev/src/topFrame.h index ba515c6d..fe97b0cc 100644 --- a/freedv-dev/src/topFrame.h +++ b/freedv-dev/src/topFrame.h @@ -103,9 +103,6 @@ class TopFrame : public wxFrame wxStaticText *m_textErrors; wxStaticText *m_textBER; wxStaticText *m_textResyncs; - wxStaticText *m_textFifos; - wxStaticText *m_textPA1; - wxStaticText *m_textPA2; wxRadioButton *m_rbSync; wxRadioButton *m_rb1400old;