]> Repos - portaudio/commitdiff
fix for half duplex and build issues from Toni Wilen.
authorrossb <rossb@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 14 May 2009 14:37:37 +0000 (14:37 +0000)
committerrossb <rossb@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 14 May 2009 14:37:37 +0000 (14:37 +0000)
src/hostapi/wdmks/pa_win_wdmks.c

index 4d9e13f7f67bb8171e3ce2e62fabae7f8c146f27..93032ece1e905a15adba4e7166ebf54f343be4a3 100644 (file)
@@ -77,7 +77,7 @@
 
 #include <windows.h>
 #include <winioctl.h>
-
+#include <process.h>
 
 #ifdef __GNUC__
     #undef PA_LOGE_
 #endif
 
 #ifdef _MSC_VER
+    #define NOMMIDS
     #define DYNAMIC_GUID(data) {data}
-    #define _INC_MMREG
     #define _NTRTL_ /* Turn off default definition of DEFINE_GUIDEX */
     #undef DEFINE_GUID
     #define DEFINE_GUID(n,data) EXTERN_C const GUID n = {data}
     #define DEFINE_GUID_THUNK(n,data) DEFINE_GUID(n,data)
     #define DEFINE_GUIDEX(n) DEFINE_GUID_THUNK(n, STATIC_##n)
-    #if !defined( DEFINE_WAVEFORMATEX_GUID )
-        #define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
-    #endif
-    #define  WAVE_FORMAT_ADPCM      0x0002
-    #define  WAVE_FORMAT_IEEE_FLOAT 0x0003
-    #define  WAVE_FORMAT_ALAW       0x0006
-    #define  WAVE_FORMAT_MULAW      0x0007
-    #define  WAVE_FORMAT_MPEG       0x0050
-    #define  WAVE_FORMAT_DRM        0x0009
 #endif
 
+#include <mmreg.h>
 #include <ks.h>
 #include <ksmedia.h>
 #include <tchar.h>
@@ -2924,11 +2916,26 @@ static DWORD WINAPI ProcessingThread(LPVOID pParam)
                     PaUtil_SetInputChannel(&stream->bufferProcessor,i,((unsigned char*)(stream->packets[inbuf].Header.Data))+(i*stream->inputSampleSize),stream->deviceInputChannels);
                 }
             }
-            /* Only call the EndBufferProcessing function is the total input frames == total output frames */
-            if((stream->bufferProcessor.hostInputFrameCount[0] + stream->bufferProcessor.hostInputFrameCount[1]) ==
-                (stream->bufferProcessor.hostOutputFrameCount[0] + stream->bufferProcessor.hostOutputFrameCount[1]) )
+            
+            if (stream->recordingPin && stream->playbackPin) /* full duplex */
+            {
+                /* Only call the EndBufferProcessing function when the total input frames == total output frames */
+
+                if((stream->bufferProcessor.hostInputFrameCount[0] + stream->bufferProcessor.hostInputFrameCount[1]) ==
+                        (stream->bufferProcessor.hostOutputFrameCount[0] + stream->bufferProcessor.hostOutputFrameCount[1]) )
+                {
+                    framesProcessed = PaUtil_EndBufferProcessing(&stream->bufferProcessor,&cbResult);
+                }
+                else
+                {
+                    framesProcessed = 0;
+                }
+            }
+            else 
+            {
                 framesProcessed = PaUtil_EndBufferProcessing(&stream->bufferProcessor,&cbResult);
-            else framesProcessed = 0;
+            }
+
             if( doChannelCopy )
             {
                 /* Copy the first output channel to the other channels */