[ros-diffs] [silverblade] 34534: Corrected wave output device close routine to ensure the device is "idle" rather than "stopped" (which actually means playback is paused...) Also added code to the I/O completion routine to detect when a submitted WAVEHDR from the client application has finished being played. No WAVEHDRs are returned to the client application (yet...)

silverblade at svn.reactos.org silverblade at svn.reactos.org
Tue Jul 15 22:43:33 CEST 2008


Author: silverblade
Date: Tue Jul 15 15:43:32 2008
New Revision: 34534

URL: http://svn.reactos.org/svn/reactos?rev=34534&view=rev
Log:
Corrected wave output device close routine to ensure the device is "idle"
rather than "stopped" (which actually means playback is paused...) Also
added code to the I/O completion routine to detect when a submitted WAVEHDR
from the client application has finished being played. No WAVEHDRs are
returned to the client application (yet...)


Modified:
    branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c
    branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c

Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c
URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c?rev=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] Tue Jul 15 15:43:32 2008
@@ -176,7 +176,14 @@
             StreamInfo->CurrentBuffer = StreamInfo->CurrentBuffer->lpNext;
         }
 
+        /* Reset the writing offset */
         StreamInfo->BufferOffset = 0;
+
+        if ( StreamInfo->CurrentBuffer )
+        {
+            /* Reset the completion offset */
+            StreamInfo->CurrentBuffer->reserved = 0;
+        }
     }
 
     /* Increase the number of outstanding buffers */
@@ -217,6 +224,7 @@
     IN  DWORD BytesWritten)
 {
     PWAVE_STREAM_INFO StreamInfo;
+    PWAVEHDR WaveHeader = (PWAVEHDR) Parameter;
 
     TRACE_("CompleteWaveBuffer(%p, %p, %d)\n",
            SoundDeviceInstance,
@@ -224,6 +232,25 @@
           (int) BytesWritten);
 
     ASSERT(SoundDeviceInstance);
+    ASSERT(WaveHeader);
+
+    WaveHeader->reserved += BytesWritten;
+    ASSERT(WaveHeader->reserved <= WaveHeader->dwBufferLength);
+
+    if ( WaveHeader->reserved == WaveHeader->dwBufferLength )
+    {
+        TRACE_("* Completed wavehdr %p (length %d)\n",
+                WaveHeader,
+                (int) WaveHeader->dwBufferLength);
+        /* TODO: Give it back to the client */
+    }
+    else
+    {
+        TRACE_("* Partial wavehdr completion %p (%d/%d)\n",
+                WaveHeader,
+                (int) WaveHeader->reserved,
+                (int) WaveHeader->dwBufferLength);
+    }
 
     StreamInfo = &SoundDeviceInstance->Streaming.Wave;
 

Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c
URL: http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c?rev=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] Tue Jul 15 15:43:32 2008
@@ -114,7 +114,8 @@
             Result = GetWaveDeviceState(Instance, &State);
             ASSERT(Result == MMSYSERR_NOERROR);
 
-            if ( State == WAVE_DD_PLAYING )
+            /* Must not be playing or paused */
+            if ( State != WAVE_DD_IDLE )
                 return WAVERR_STILLPLAYING;
 
             Result = DestroySoundDeviceInstance(Instance);



More information about the Ros-diffs mailing list