[DSOUND]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 7 Feb 2010 15:57:25 +0000 (15:57 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 7 Feb 2010 15:57:25 +0000 (15:57 +0000)
- Fix broken assert
- Fix calculation of length for the first locked audio buffer

svn path=/trunk/; revision=45488

reactos/dll/directx/dsound_new/secondary.c

index a3fe2b1..4474c26 100644 (file)
@@ -263,8 +263,9 @@ SecondaryDirectSoundBuffer8Impl_fnLock(
     else
     {
         ASSERT(dwOffset < This->BufferSize);
-        ASSERT(dwBytes < This->BufferSize);
-        ASSERT(dwBytes + dwOffset <= This->BufferSize);
+        ASSERT(dwBytes <= This->BufferSize);
+
+        dwBytes = min(This->BufferSize - dwOffset, dwBytes);
 
         *ppvAudioPtr1 = This->Buffer + dwOffset;
         *pdwAudioBytes1 = dwBytes;
@@ -316,7 +317,7 @@ SecondaryDirectSoundBuffer8Impl_fnPlay(
     /* release primary buffer */
     PrimaryDirectSoundBuffer_ReleaseLock(This->PrimaryBuffer);
 
-    DPRINT1("SetFormatSuccess PrimaryBuffer %p\n", This->PrimaryBuffer);
+    DPRINT("SetFormatSuccess PrimaryBuffer %p\n", This->PrimaryBuffer);
     return DS_OK;
 }