added high latency PA option, tracking down cause of missing samples
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 3 May 2018 20:24:40 +0000 (20:24 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 3 May 2018 20:24:40 +0000 (20:24 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3567 01035d8c-6547-0410-b346-abe4f91aad63

freedv-dev/src/fdmdv2_main.cpp
freedv-dev/src/fdmdv2_pa_wrapper.cpp
freedv-dev/src/fdmdv2_pa_wrapper.h

index 0b5824ab6e0f658024b8696404db5e590a75a2ff..ee0718f5d7580e2e154110d72c1ab872f20d96f1 100644 (file)
@@ -2599,6 +2599,7 @@ void  MainFrame::initPortAudioDevice(PortAudioWrap *pa, int inDevice, int outDev
         pa->setInputChannelCount(inputChannels);           // stereo input
         pa->setInputSampleFormat(PA_SAMPLE_TYPE);
         pa->setInputLatency(pa->getInputDefaultLowLatency());
+        fprintf(stderr,"PA in; low: %f high: %f\n", pa->getInputDefaultLowLatency(), pa->getInputDefaultHighLatency());
         pa->setInputHostApiStreamInfo(NULL);
     }
 
@@ -2611,6 +2612,7 @@ void  MainFrame::initPortAudioDevice(PortAudioWrap *pa, int inDevice, int outDev
         pa->setOutputChannelCount(2);                      // stereo output
         pa->setOutputSampleFormat(PA_SAMPLE_TYPE);
         pa->setOutputLatency(pa->getOutputDefaultLowLatency());
+        fprintf(stderr,"PA out; low: %f high: %f\n", pa->getOutputDefaultLowLatency(), pa->getOutputDefaultHighLatency());
         pa->setOutputHostApiStreamInfo(NULL);
     }
 
@@ -2620,7 +2622,7 @@ void  MainFrame::initPortAudioDevice(PortAudioWrap *pa, int inDevice, int outDev
       On Linux, setting this to wxGetApp().m_framesPerBuffer caused
       intermittant break up on the audio from my IC7200 on Ubuntu 14.
       After a day of bug hunting I found that 0, as recommended by the
-      PortAudio docunmentation, fixed the problem.
+      PortAudio documentation, fixed the problem.
     */
 
     //pa->setFramesPerBuffer(wxGetApp().m_framesPerBuffer);
index 2f67ca26d189b84fbb4d0f7ee7eba516a3b3688d..95eee5cb3ba703720e65371a2aab0056d81fbfc9 100644 (file)
@@ -207,6 +207,14 @@ PaTime  PortAudioWrap::getInputDefaultLowLatency()
     return Pa_GetDeviceInfo(m_inputBuffer.device)->defaultLowInputLatency;
 }
 
+//----------------------------------------------------------------
+// getInputDefaultHighLatency()
+//----------------------------------------------------------------
+PaTime  PortAudioWrap::getInputDefaultHighLatency()
+{
+    return Pa_GetDeviceInfo(m_inputBuffer.device)->defaultHighInputLatency;
+}
+
 //----------------------------------------------------------------
 // setOutputChannelCount()
 //----------------------------------------------------------------
@@ -268,6 +276,14 @@ PaTime  PortAudioWrap::getOutputDefaultLowLatency()
     return Pa_GetDeviceInfo(m_outputBuffer.device)->defaultLowOutputLatency;
 }
 
+//----------------------------------------------------------------
+// getOutputDefaultHighLatency()
+//----------------------------------------------------------------
+PaTime  PortAudioWrap::getOutputDefaultHighLatency()
+{
+    return Pa_GetDeviceInfo(m_outputBuffer.device)->defaultHighOutputLatency;
+}
+
 //----------------------------------------------------------------
 // setFramesPerBuffer()
 //----------------------------------------------------------------
index 3d216c0dba9904e011aa1eec87227773fbc6c1a5..b666beb5b43f7324533ee6cac29b2708171cb320 100644 (file)
@@ -78,6 +78,7 @@ class PortAudioWrap
         PaError             setInputLatency(PaTime latency);
         void                setInputHostApiStreamInfo(void *info = NULL);
         PaTime              getInputDefaultLowLatency();
+        PaTime              getInputDefaultHighLatency();
         const char          *getDeviceName(PaDeviceIndex dev);
 
         PaError             setOutputDevice(PaDeviceIndex dev);
@@ -87,6 +88,7 @@ class PortAudioWrap
         PaError             setOutputLatency(PaTime latency);
         void                setOutputHostApiStreamInfo(void *info = NULL);
         PaTime              getOutputDefaultLowLatency();
+        PaTime              getOutputDefaultHighLatency();
 
         void                setFdmdvState(FDMDV* fdmdv_state)                       {this->m_pFDMDV_state = fdmdv_state;}
         void                setOutputBuffer(const PaStreamParameters& outputBuffer) {this->m_outputBuffer = outputBuffer;}