]> Repos - portaudio/commitdiff
wasapi:
authordmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 25 Mar 2010 23:27:27 +0000 (23:27 +0000)
committerdmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 25 Mar 2010 23:27:27 +0000 (23:27 +0000)
 - fixed int24 Mono to Stereo mixer (affects Mono streams starting in Exclusive mode)
pa_converters:
 - avoid using 64-bit integer math for Int24_To_Float32 and Int24_To_Int32 under x64 Posix platforms (long is 64-bit there), now using explicit PaInt32 type

src/common/pa_converters.c
src/hostapi/wasapi/pa_win_wasapi.c

index 70e7a7d2e48c15afdeba3fc46e15bf5bba522095..75cb276fcf1195074c0fa03a5163046e48e17b6c 100644 (file)
@@ -1073,13 +1073,13 @@ static void Int24_To_Float32(
     {
 
 #if defined(PA_LITTLE_ENDIAN)
-        temp = (((long)src[0]) << 8);  
-        temp = temp | (((long)src[1]) << 16);
-        temp = temp | (((long)src[2]) << 24);
+        temp = (((PaInt32)src[0]) << 8);  
+        temp = temp | (((PaInt32)src[1]) << 16);
+        temp = temp | (((PaInt32)src[2]) << 24);
 #elif defined(PA_BIG_ENDIAN)
-        temp = (((long)src[0]) << 24);
-        temp = temp | (((long)src[1]) << 16);
-        temp = temp | (((long)src[2]) << 8);
+        temp = (((PaInt32)src[0]) << 24);
+        temp = temp | (((PaInt32)src[1]) << 16);
+        temp = temp | (((PaInt32)src[2]) << 8);
 #endif
 
         *dest = (float) ((double)temp * const_1_div_2147483648_);
@@ -1106,13 +1106,13 @@ static void Int24_To_Int32(
     {
 
 #if defined(PA_LITTLE_ENDIAN)
-        temp = (((long)src[0]) << 8);  
-        temp = temp | (((long)src[1]) << 16);
-        temp = temp | (((long)src[2]) << 24);
+        temp = (((PaInt32)src[0]) << 8);  
+        temp = temp | (((PaInt32)src[1]) << 16);
+        temp = temp | (((PaInt32)src[2]) << 24);
 #elif defined(PA_BIG_ENDIAN)
-        temp = (((long)src[0]) << 24);
-        temp = temp | (((long)src[1]) << 16);
-        temp = temp | (((long)src[2]) << 8);
+        temp = (((PaInt32)src[0]) << 24);
+        temp = temp | (((PaInt32)src[1]) << 16);
+        temp = temp | (((PaInt32)src[2]) << 8);
 #endif
 
         *dest = temp;
index 71930d53028431bad642abf3c2206358de7788d6..cb14cf5d9bef8432c786b64945e42b3590037dca 100644 (file)
@@ -850,8 +850,8 @@ static BOOL UseWOW64VistaWorkaround()
 \r
 // ------------------------------------------------------------------------------------------\r
 #define _WASAPI_MONO_TO_STEREO_MIXER(TYPE)\\r
-       TYPE * __restrict to   = __to;\\r
-       TYPE * __restrict from = __from;\\r
+       TYPE * __restrict to   = (TYPE *)__to;\\r
+       TYPE * __restrict from = (TYPE *)__from;\\r
        TYPE * __restrict end  = from + count;\\r
        while (from != end)\\r
        {\\r
@@ -875,10 +875,7 @@ static void _MixMonoToStereo_16(void *__to, void *__from, UINT32 count)
 // ------------------------------------------------------------------------------------------\r
 static void _MixMonoToStereo_24(void *__to, void *__from, UINT32 count)\r
 {\r
-#pragma pack(push, 1)\r
-       typedef struct wasapi_int24 { BYTE d[3]; } wasapi_int24; //<< 24 bit value, packed to 1 byte to avoid padding\r
-#pragma pack(pop)\r
-       _WASAPI_MONO_TO_STEREO_MIXER(wasapi_int24);\r
+       _WASAPI_MONO_TO_STEREO_MIXER(int); // !!! int24 data is contained in 32-bit containers\r
 }\r
 \r
 // ------------------------------------------------------------------------------------------\r