moved FIFO and PortAudio under/overflow counters to Tools-Options Dialog
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 4 May 2018 05:13:35 +0000 (05:13 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 4 May 2018 05:13:35 +0000 (05:13 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3571 01035d8c-6547-0410-b346-abe4f91aad63

freedv-dev/src/dlg_options.cpp
freedv-dev/src/dlg_options.h
freedv-dev/src/fdmdv2_main.cpp
freedv-dev/src/topFrame.cpp
freedv-dev/src/topFrame.h

index eb59403b1791f1bb1528f8fcc2481352b8a36c75..f636971deefe69c7d3a0da83f1be346fbe07b222 100644 (file)
 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);
+}
index 081448cbba39ff079d5cfbf8284ff15ad7164347..9c954513ab2c873ed662cb92066462523b0192ca 100644 (file)
@@ -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;
index 263a7cdcc595ef52d709b8f1c626b70ff93f8b54..5dc4421b75dc32942264fa954d8e7b6ea79fe9e0 100644 (file)
@@ -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;
-        }
     }
 
     
index 66dd7387e2ede46650480f64deeb0c79c4a82d12..69bdfc7b0aa740ff57d6942b010f95755278020a 100644 (file)
@@ -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);
 
     //------------------------------
index ba515c6d73f80b19e1953c92ec3627f8cfae26a7..fe97b0cc4943b939a7548f9ef75fbe7b12a512d8 100644 (file)
@@ -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;