Changeset 2637 for trunk/src/dsound/OS2SNDBUFFER.CPP
- Timestamp:
- Feb 4, 2000, 8:29:17 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dsound/OS2SNDBUFFER.CPP
r1744 r2637 1 /* $Id: OS2SNDBUFFER.CPP,v 1. 5 1999-11-14 22:12:15hugh Exp $ */1 /* $Id: OS2SNDBUFFER.CPP,v 1.6 2000-02-04 19:29:16 hugh Exp $ */ 2 2 3 3 /* … … 100 100 bufferdesc.lpwfxFormat->cbSize + sizeof(WAVEFORMATEX)); 101 101 102 bufferdesc.lpwfxFormat = lpfxFormat; 103 102 104 lpBuffer = (LPSTR)VirtualAlloc( 0, bufferdesc.dwBufferBytes, MEM_COMMIT, PAGE_READWRITE); 103 105 if(lpBuffer == NULL) … … 108 110 return; 109 111 } 112 110 113 } 111 114 //****************************************************************************** … … 210 213 Ticks = CurrentTicks-me->LastTickCnt; 211 214 dprintf((" Is Playing, Ticks: Last %d Current %d Difference %d",me->LastTickCnt, CurrentTicks,Ticks)); 212 me->LastTickCnt = CurrentTicks;213 214 NewPos = ((me->frequency*Ticks)/1000)*(me-> bufferdesc.lpwfxFormat->wBitsPerSample/8);215 dprintf((" Frequency: %d Bits per Sample %d",me->frequency,me->lpfxFormat->wBitsPerSample)); 216 217 NewPos = ((me->frequency*Ticks)/1000)*(me->lpfxFormat->wBitsPerSample/8); 215 218 dprintf((" advance pos by %d bytes",NewPos)); 219 220 if(NewPos) 221 me->LastTickCnt = CurrentTicks; 216 222 217 223 if(me->playpos+NewPos >= me->bufferdesc.dwBufferBytes) … … 235 241 if(me->writepos >= me->bufferdesc.dwBufferBytes) 236 242 me->writepos = me->writepos % me->bufferdesc.dwBufferBytes; 237 243 dprintf((" new Pos Write: %d Play: %d",me->writepos,me->playpos)); 238 244 } 239 245 else … … 361 367 dwWriteCursor = me->writepos; 362 368 } 369 dprintf((" Buffer at 0x%08X Size %d",me->lpBuffer,me->bufferdesc.dwBufferBytes)); 363 370 if(dwWriteCursor + dwWriteBytes > me->bufferdesc.dwBufferBytes ) 364 371 { 365 372 *(DWORD *)lplpvAudioPtr1 = (DWORD)(me->lpBuffer + dwWriteCursor); 366 373 *lpdwAudioBytes1 = me->bufferdesc.dwBufferBytes - dwWriteCursor; 374 dprintf((" Lock1 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr1,*lpdwAudioBytes1)); 367 375 if(lplpvAudioPtr2 && lpdwAudioBytes2) 368 376 { 369 *(DWORD *)lplpvAudioPtr2 = (DWORD)me->lpBuffer; 370 *lpdwAudioBytes2 = dwWriteBytes - *lpdwAudioBytes1; 377 *(DWORD *)lplpvAudioPtr2 = (DWORD)me->lpBuffer; 378 *lpdwAudioBytes2 = dwWriteBytes - *lpdwAudioBytes1; 379 dprintf((" Lock2 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr2,*lpdwAudioBytes2)); 371 380 } 372 381 } … … 375 384 *(DWORD *)lplpvAudioPtr1 = (DWORD)(me->lpBuffer + dwWriteCursor); 376 385 *lpdwAudioBytes1 = dwWriteBytes; 386 dprintf((" Lock1 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr1,*lpdwAudioBytes1)); 377 387 if(lplpvAudioPtr2 && lpdwAudioBytes2) 378 388 { 379 *(DWORD *)lplpvAudioPtr2 = 0; 380 *lpdwAudioBytes2 = 0; 389 *(DWORD *)lplpvAudioPtr2 = 0; 390 *lpdwAudioBytes2 = 0; 391 dprintf((" Lock2 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr2,*lpdwAudioBytes2)); 381 392 } 382 393 } … … 493 504 me->LastTickCnt = CurrentTicks; 494 505 495 NewPos = ((me->frequency*Ticks)/1000)*(me-> bufferdesc.lpwfxFormat->wBitsPerSample>>8);506 NewPos = ((me->frequency*Ticks)/1000)*(me->lpfxFormat->wBitsPerSample>>8); 496 507 if(me->playpos+NewPos >= me->bufferdesc.dwBufferBytes) 497 508 { … … 531 542 return DSERR_INVALIDPARAM; 532 543 } 544 533 545 return DS_OK; 534 546 }
Note:
See TracChangeset
for help on using the changeset viewer.