]> Repos - portaudio/commitdiff
Fix for WaveRT WDM drivers that do not support memory mapped position register, and...
authorrobiwan <robiwan@0f58301d-fd10-0410-b4af-bbb618454e57>
Fri, 28 Dec 2012 16:54:25 +0000 (16:54 +0000)
committerrobiwan <robiwan@0f58301d-fd10-0410-b4af-bbb618454e57>
Fri, 28 Dec 2012 16:54:25 +0000 (16:54 +0000)
src/hostapi/wdmks/pa_win_wdmks.c
src/os/win/pa_win_waveformat.c

index 088057e942b2e3a0ec6a6d3b6b09398d7dd67962..bbdc39abab0a89325938294c998ec1e879057268 100644 (file)
@@ -4959,8 +4959,18 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
 
                 if (result != paNoError)
                 {
+                    unsigned long pos = 0xdeadc0de;
                     PA_DEBUG(("Failed to register capture position register, using PinGetAudioPositionViaIOCTL\n"));
                     stream->capture.pPin->fnAudioPosition = PinGetAudioPositionViaIOCTL;
+                    /* Test position function */
+                    result = (stream->capture.pPin->fnAudioPosition)(stream->capture.pPin, &pos);
+                    if (result != paNoError || pos != 0x0)
+                    {
+                        PA_DEBUG(("Failed to read capture position register (IOCTL)\n"));
+                        PaWinWDM_SetLastErrorInfo(paUnanticipatedHostError, "Failed to read capture position register (IOCTL)");
+                        result = paUnanticipatedHostError;
+                        goto error;
+                    }                
                 }
                 else
                 {
@@ -5071,8 +5081,18 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
 
                 if (result != paNoError)
                 {
+                    unsigned long pos = 0xdeadc0de;
                     PA_DEBUG(("Failed to register rendering position register, using PinGetAudioPositionViaIOCTL\n"));
                     stream->render.pPin->fnAudioPosition = PinGetAudioPositionViaIOCTL;
+                    /* Test position function */
+                    result = (stream->render.pPin->fnAudioPosition)(stream->render.pPin, &pos);
+                    if (result != paNoError || pos != 0x0)
+                    {
+                        PA_DEBUG(("Failed to read render position register (IOCTL)\n"));
+                        PaWinWDM_SetLastErrorInfo(paUnanticipatedHostError, "Failed to read render position register (IOCTL)");
+                        result = paUnanticipatedHostError;
+                        goto error;
+                    }
                 }
                 else
                 {
index bbf616c3448315d1ffcd516406f80ba277bb4713..2eb23347583cc1cb7609f686e91fc156c7fc203b 100644 (file)
@@ -104,7 +104,6 @@ void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
     *((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid;\r
 }\r
 \r
-\r
 PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )\r
 {\r
        switch( numChannels ){\r
@@ -129,11 +128,16 @@ PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )
                        return PAWIN_SPEAKER_5POINT1; \r
         /* case 7: */\r
                case 8:\r
-                       return PAWIN_SPEAKER_7POINT1;\r
+            /* RoBi: PAWIN_SPEAKER_7POINT1_SURROUND fits normal surround sound setups better than PAWIN_SPEAKER_7POINT1, f.i. NVidia HDMI Audio\r
+               output is silent on channels 5&6 with NVidia drivers, and channel 7&8 with Micrsoft HD Audio driver using PAWIN_SPEAKER_7POINT1. \r
+               With PAWIN_SPEAKER_7POINT1_SURROUND both setups work OK. */\r
+                       return PAWIN_SPEAKER_7POINT1_SURROUND;\r
        }\r
 \r
     /* Apparently some Audigy drivers will output silence \r
        if the direct-out constant (0) is used. So this is not ideal.    \r
+\r
+       RoBi 2012-12-19: Also, NVidia driver seem to output garbage instead. Again not very ideal.\r
     */\r
        return  PAWIN_SPEAKER_DIRECTOUT;\r
 \r