From 836bd46253238d8f735a9fcefad14a01ad137f4b Mon Sep 17 00:00:00 2001 From: rossb Date: Thu, 14 May 2009 14:37:37 +0000 Subject: [PATCH] fix for half duplex and build issues from Toni Wilen. --- src/hostapi/wdmks/pa_win_wdmks.c | 37 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/hostapi/wdmks/pa_win_wdmks.c b/src/hostapi/wdmks/pa_win_wdmks.c index 4d9e13f..93032ec 100644 --- a/src/hostapi/wdmks/pa_win_wdmks.c +++ b/src/hostapi/wdmks/pa_win_wdmks.c @@ -77,7 +77,7 @@ #include #include - +#include #ifdef __GNUC__ #undef PA_LOGE_ @@ -121,24 +121,16 @@ #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 #include #include #include @@ -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 */ -- 2.43.0