=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: mmdevapi/tests: Produce audible 16bit output too.

Alexandre Julliard julliard at winehq.org
Thu Feb 21 14:29:36 CST 2013


Module: wine
Branch: master
Commit: c771fe923178972dc1a990c6c2bcb08c771b6681
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c771fe923178972dc1a990c6c2bcb08c771b6681

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Wed Feb 15 22:23:34 2012 +0100

mmdevapi/tests: Produce audible 16bit output too.

---

 dlls/mmdevapi/tests/render.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
index e753299..beebfb6 100644
--- a/dlls/mmdevapi/tests/render.c
+++ b/dlls/mmdevapi/tests/render.c
@@ -75,8 +75,10 @@ static DWORD wave_generate_tone(PWAVEFORMATEX pwfx, BYTE* data, UINT32 frames)
     DWORD cn, i;
     double delta, y;
 
-    if(!winetest_interactive || wfxe->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE ||
-       !IsEqualGUID(&wfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
+    if(!winetest_interactive)
+        return AUDCLNT_BUFFERFLAGS_SILENT;
+    if(wfxe->Format.wBitsPerSample != ((wfxe->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
+       IsEqualGUID(&wfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)) ? 8 * sizeof(float) : 16))
         return AUDCLNT_BUFFERFLAGS_SILENT;
 
     for(delta = phase, cn = 0; cn < wfxe->Format.nChannels;
@@ -84,8 +86,10 @@ static DWORD wave_generate_tone(PWAVEFORMATEX pwfx, BYTE* data, UINT32 frames)
         for(i = 0; i < frames; i++){
             y = sin(2*PI*(440.* i / wfxe->Format.nSamplesPerSec + delta));
             /* assume alignment is granted */
-            ((float*)data)[cn+i*wfxe->Format.nChannels] = y;
-            /* fixme: 16bit for exclusive mode */
+            if(wfxe->Format.wBitsPerSample == 16)
+                ((short*)data)[cn+i*wfxe->Format.nChannels] = y * 32767.9;
+            else
+                ((float*)data)[cn+i*wfxe->Format.nChannels] = y;
         }
     }
     phase += 440.* frames / wfxe->Format.nSamplesPerSec;




More information about the wine-cvs mailing list