]> Repos - portaudio/commitdiff
fixed VS2010 compilation
authorFrancesco Lamonica <lamonica@netresults.it>
Tue, 16 Feb 2021 21:11:01 +0000 (22:11 +0100)
committerFrancesco Lamonica <lamonica@netresults.it>
Tue, 16 Feb 2021 22:15:53 +0000 (23:15 +0100)
src/hostapi/wasapi/pa_win_wasapi.c

index 23f41a1ad1925533f0ef5443d29f97e6f169c8dd..0cd59bb359befb28c2f9cf4667a11541805bc65f 100644 (file)
     #include <mmdeviceapi.h>
     #include <devicetopology.h>    // Used to get IKsJackDescription interface
     #undef INITGUID
+// Visual Studio 2010 does not support the inline keyword
+#if (_MSC_VER <= 1600)
+    #define inline _inline
+#endif
 #endif
 #ifndef __MWERKS__
     #include <malloc.h>
@@ -2078,6 +2082,7 @@ static PaDeviceInfo *AllocateDeviceListMemory(PaWasapiHostApiRepresentation *paW
 
     if (paWasapi->deviceCount != 0)
     {
+        UINT32 i;
         UINT32 deviceCount = paWasapi->deviceCount;
     #if defined(PA_WASAPI_MAX_CONST_DEVICE_COUNT) && (PA_WASAPI_MAX_CONST_DEVICE_COUNT > 0)
         if (deviceCount < PA_WASAPI_MAX_CONST_DEVICE_COUNT)
@@ -2089,7 +2094,7 @@ static PaDeviceInfo *AllocateDeviceListMemory(PaWasapiHostApiRepresentation *paW
         {
             return NULL;
         }
-        for (UINT32 i = 0; i < deviceCount; ++i)
+        for (i = 0; i < deviceCount; ++i)
             hostApi->deviceInfos[i] = NULL;
 
         // Allocate all device info structs in a contiguous block
@@ -6091,6 +6096,7 @@ static inline INT32 GetNextSleepTime(SystemTimer *timer, ThreadIdleScheduler *sc
     UINT32 sleepTime)
 {
     INT32 nextSleepTime;
+    INT32 procTime;
 
     // Get next sleep time
     if (sleepTime == 0)
@@ -6104,7 +6110,7 @@ static inline INT32 GetNextSleepTime(SystemTimer *timer, ThreadIdleScheduler *sc
     //
     // [9],{2},[8],{1},[9],{1},[9],{3},[7],{2},[8],{3},[7],{2},[8],{2},[8],{3},[7],{2},[8],...
     //
-    INT32 procTime = (INT32)(SystemTimer_GetTime(timer) - startTime);
+    procTime = (INT32)(SystemTimer_GetTime(timer) - startTime);
     nextSleepTime -= procTime;
     if (nextSleepTime < timer->granularity)
         nextSleepTime = 0;