Changeset 369 for OCO/trunk/drv16/wavestrm.cpp
- Timestamp:
- Sep 3, 2008, 4:08:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/wavestrm.cpp
r288 r369 299 299 case STREAM_WRITE: 300 300 { 301 if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE || 301 if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE || 302 302 ulCurBytesProcessed == 0) 303 303 {//shouldn't happen … … 318 318 319 319 ulStreamPos = pahw->ConvertPositionInvert(ulCurBytesProcessed, &_configinfo); 320 320 //round to sample boundary 321 321 ulStreamPos &= ~(_configinfo.ulSampleSize - 1); 322 322 323 323 #ifdef DEBUG 324 325 324 dprintf(("WARNING: Process: Current pos %ld pos %ld incr %d", ulCurBytesProcessed, _ulBytesProcessed, bytesinc)); 325 dprintf(("WARNING: hw pos %lx, streampos %lx", ulCurBytesProcessed, ulStreamPos)); 326 326 #endif /* DEBUG */ 327 327 } … … 330 330 while(bytesinc) 331 331 { 332 if(qhDone.IsElements()) { // if there are buffers that have been 333 // completly written to the audio buffer 332 if(qhDone.IsElements()) { // if there are buffers that have been completly written to the audio buffer 334 333 // check the first one on the done queue 335 // if it's data has been consumed by 336 // the hardware return it 334 // if it's data has been consumed by the hardware return it. 335 // Bug #18 Sometimes MMPM gives us really small buffers. If we 336 // wait for the buffer to be completly consumed and there is a tiny buffer 337 // on the queue after this one, the sound part could underrun before we get a 338 // chance to refill it. To fix this we will return the buffer if it will be 339 // consumed before the next call to WAVESTREAM:Process(). 340 // rjj Fix for Bug #18 28082008 337 341 ptemp = (PSTREAMBUFFER)qhDone.Head(); 338 342 ptemp->ulDonepos += bytesinc; 339 343 bytesinc = 0; 340 if(ptemp->ulDonepos >= ptemp->ulBuffsz) 344 if ((ptemp->ulDonepos + _configinfo.ulBytesPerIRQ) >= ptemp->ulBuffsz) 341 345 { 342 346 //calc position in next buffer 343 347 bytesinc = ptemp->ulDonepos - ptemp->ulBuffsz; 344 // 348 // dprintf2(("Process: Return buffer %lx size %d", ptemp->pBuffptr, ptemp->ulBuffsz)); 345 349 ReturnBuffer(); 346 }347 350 } 351 } 348 352 else break; //shouldn't happen 349 353 }
Note:
See TracChangeset
for help on using the changeset viewer.