]> Repos - portaudio/commitdiff
wasapi: fixed full-duplex failure (when host sample types differ) due to incorrect...
authordmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 10 Jun 2010 09:45:54 +0000 (09:45 +0000)
committerdmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 10 Jun 2010 09:45:54 +0000 (09:45 +0000)
src/hostapi/wasapi/pa_win_wasapi.c

index b0e469e6df9fcc4d787d4c19868d20a4e2adc4ee..65e6ba7aeb13d4061615bfe9ef07e905adaa0f74 100644 (file)
@@ -2185,6 +2185,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
        PaTime buffer_latency;\r
        ULONG framesPerHostCallback;\r
        PaUtilHostBufferSizeMode bufferMode;\r
+       const BOOL fullDuplex = ((inputParameters != NULL) && (outputParameters != NULL));\r
 \r
        // validate PaStreamParameters\r
        if ((result = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError)\r
@@ -2265,7 +2266,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiPolling))\r
                        stream->in.streamFlags = 0; // polling interface\r
                else\r
-               if (outputParameters != NULL)\r
+               if (fullDuplex)\r
                        stream->in.streamFlags = 0; // polling interface is implemented for full-duplex mode also\r
 \r
                // Create Audio client\r
@@ -2379,7 +2380,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiPolling))\r
                        stream->out.streamFlags = 0; // polling interface\r
                else\r
-               if (inputParameters != NULL)\r
+               if (fullDuplex)\r
                        stream->out.streamFlags = 0; // polling interface is implemented for full-duplex mode also\r
 \r
                // Create Audio client\r
@@ -2455,8 +2456,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         outputSampleFormat = hostOutputSampleFormat = paInt16; /* Surpress 'uninitialized var' warnings. */\r
     }\r
 \r
-       // og full-duplex\r
-       if ((inputParameters != NULL) && (outputParameters != NULL))\r
+       // log full-duplex\r
+       if (fullDuplex)\r
                PRINT(("WASAPI::OpenStream: full-duplex mode\n"));\r
 \r
        // paWinWasapiPolling must be on/or not on both streams\r
@@ -2504,12 +2505,14 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                        goto error;\r
                }\r
 \r
-               // serious problem #2\r
-               if (stream->out.framesPerHostCallback != stream->in.framesPerHostCallback)\r
+               // serious problem #2 - No, Not a problem, as framesPerHostCallback take into account\r
+               // sample size while it is not a problem for PA full-duplex, we must care of\r
+               // preriod only!\r
+               /*if (stream->out.framesPerHostCallback != stream->in.framesPerHostCallback)\r
                {\r
                        PRINT(("WASAPI: OpenStream: framesPerHostCallback discrepancy\n"));\r
                        goto error;\r
-               }\r
+               }*/\r
        }\r
 \r
        framesPerHostCallback = (outputParameters) ? stream->out.framesPerHostCallback:\r