From: drowe67 Date: Thu, 3 May 2018 07:19:06 +0000 (+0000) Subject: added more detail to portaudio status flag counters X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=37f996f8a5d534fd641affc5224a9477929dc6e0;p=freetel-svn-tracking.git added more detail to portaudio status flag counters git-svn-id: https://svn.code.sf.net/p/freetel/code@3562 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-dev/src/fdmdv2_main.cpp b/freedv-dev/src/fdmdv2_main.cpp index 4b0b139d..0b5824ab 100644 --- a/freedv-dev/src/fdmdv2_main.cpp +++ b/freedv-dev/src/fdmdv2_main.cpp @@ -96,8 +96,8 @@ int g_infifo1_full; int g_outfifo1_empty; int g_infifo2_full; int g_outfifo2_empty; -int g_PAstatusFlags1; -int g_PAstatusFlags2; +int g_PAstatus1[4]; +int g_PAstatus2[4]; // playing and recording from sound files @@ -1258,9 +1258,14 @@ void MainFrame::OnTimer(wxTimerEvent &evt) /* FIFO under/overflow debug counters */ char fifo_counters[80]; - sprintf(fifo_counters, "%d %d %d %d %d %d", g_infifo1_full, g_outfifo1_empty, g_infifo2_full, g_outfifo2_empty,g_PAstatusFlags1, g_PAstatusFlags2 ); + 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); } // command from UDP thread that is best processed in main thread to avoid seg faults @@ -1744,7 +1749,9 @@ void MainFrame::OnBerReset(wxCommandEvent& event) g_error_histn[i] = 0; } g_infifo1_full = g_outfifo1_empty = g_infifo2_full = g_outfifo2_empty = 0; - g_PAstatusFlags1 = g_PAstatusFlags2 = 0; + for (int i=0; i<4; i++) { + g_PAstatus1[i] = g_PAstatus2[i] = 0; + } } @@ -2788,8 +2795,10 @@ void MainFrame::startRxStream() g_rxUserdata->infifo2 = fifo_create(10*N48); //fprintf(stderr, "N48: %d 10*N48: %d\n", N48, 10*N48); g_infifo1_full = g_outfifo1_empty = g_infifo2_full = g_outfifo2_empty = 0; - g_PAstatusFlags1 = g_PAstatusFlags2 = 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; + } /* TODO: might be able to tune these on a per waveform basis */ g_rxUserdata->rxinfifo = fifo_create(20 * N8); @@ -3716,10 +3725,19 @@ int MainFrame::rxCallback( (void) timeInfo; (void) statusFlags; - if (statusFlags) { - g_PAstatusFlags1++; + if (statusFlags & 0x1) { // input underflow + g_PAstatus1[0]++; } - + if (statusFlags & 0x2) { // input overflow + g_PAstatus1[1]++; + } + if (statusFlags & 0x4) { // output underflow + g_PAstatus1[2]++; + } + if (statusFlags & 0x8) { // output overflow + g_PAstatus1[3]++; + } + wxMutexLocker lock(g_mutexProtectingCallbackData); // @@ -3790,8 +3808,17 @@ int MainFrame::txCallback( short indata[MAX_FPB]; short outdata[MAX_FPB]; - if (statusFlags) { - g_PAstatusFlags2++; + if (statusFlags & 0x1) { // input underflow + g_PAstatus2[0]++; + } + if (statusFlags & 0x2) { // input overflow + g_PAstatus2[1]++; + } + if (statusFlags & 0x4) { // output underflow + g_PAstatus2[2]++; + } + if (statusFlags & 0x8) { // output overflow + g_PAstatus2[3]++; } wxMutexLocker lock(g_mutexProtectingCallbackData); diff --git a/freedv-dev/src/topFrame.cpp b/freedv-dev/src/topFrame.cpp index ff991f30..66dd7387 100644 --- a/freedv-dev/src/topFrame.cpp +++ b/freedv-dev/src/topFrame.cpp @@ -172,6 +172,11 @@ TopFrame::TopFrame(wxString plugInName, wxWindow* parent, wxWindowID id, const w 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 c59e2dad..ba515c6d 100644 --- a/freedv-dev/src/topFrame.h +++ b/freedv-dev/src/topFrame.h @@ -104,6 +104,8 @@ class TopFrame : public wxFrame wxStaticText *m_textBER; wxStaticText *m_textResyncs; wxStaticText *m_textFifos; + wxStaticText *m_textPA1; + wxStaticText *m_textPA2; wxRadioButton *m_rbSync; wxRadioButton *m_rb1400old;