Changeset 271 for OCO/trunk/drv16/waveplay.cpp
- Timestamp:
- Nov 19, 2007, 8:44:17 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/waveplay.cpp
r266 r271 46 46 { 47 47 ULONG open_strategy = 0UL; 48 ULONG LastSpace=0; 48 49 // int force_close(void); 49 50 } … … 339 340 if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) { 340 341 DebugInt3(); 341 *pulBytesTransferred = *pulBytesTransferred & ~(pConfigInfo->ulSampleSize-1); 342 ulBytesToTransfer = ulBytesToTransfer & ~(pConfigInfo->ulSampleSize-1); 343 #ifdef DEBUG 344 dprintf(("New ulBr %d" , ulBytesToTransfer)); 345 #endif 342 346 } 343 347 pConfigInfo->pfnConvert(pUserBuffer, ulBytesToTransfer, pConfigInfo->pConversionBuffer); … … 351 355 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) { 352 356 DebugInt3(); 357 #ifdef DEBUG 358 dprintf(("New pulBr %d" , pulBytesTransferred)); 359 #endif 353 360 } 354 361 } … … 366 373 ULONG ulBytesToTransfer, ULONG FAR *pulBytesTransferred) 367 374 { 375 OSSRET rc; 376 ULONG Space; 377 ULONG i; 368 378 // if (!waveOpened) return TRUE; 369 379 … … 381 391 ULONG ulCvtBufferSize, ulSampleCount, ulHwSampleCount; 382 392 LONG lSRatePosition; 383 OSSRET rc;384 393 385 394 //bytes to convert is bounded by bytes to transfer & max conversion buffer size … … 402 411 pConfigInfo->pfnSRateConv(pUserBuffer, ulCvtBufferSize, pConfigInfo->pSRateConvBuffer, 403 412 pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 404 413 //PS++ !!!!! This don't be !!!!!!! 414 OSS16_WaveGetSpace(StreamId, &Space); 415 if (ulCvtBufferSize > Space) 416 { 417 #ifdef DEBUG 418 dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space)); 419 #endif 420 for (i=0; i < 0xffffff; i++) 421 { 422 OSS16_WaveGetSpace(StreamId, &Space); 423 if (ulCvtBufferSize <= Space) break; 424 } 425 #ifdef DEBUG 426 dprintf(("OUT %ld need %ld space:%ld Last:%ld",i, ulCvtBufferSize, Space,LastSpace)); 427 #endif 428 } 405 429 if((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS || 406 430 *pulBytesTransferred == 0) 407 431 { 408 432 if(rc == OSSERR_BUFFER_FULL) { 409 dprintf2(("WAVEPLAY::AddBuffer; OSS16_WaveAddBuffer %lx %x failed due to full buffer", ulCvtBufferSize, (USHORT)rc)); 433 GetSpace(StreamId, pConfigInfo, &Space); 434 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space)); 410 435 } 411 #ifdef DEBUG 412 else dprintf(("WAVEPLAY::AddBuffer; OSS16_WaveAddBuffer %lx %x failed", ulCvtBufferSize, (USHORT)rc)); 413 #endif /* DEBUG */ 436 else dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc)); 414 437 *pulBytesTransferred = 0; 415 438 return FALSE; … … 423 446 424 447 //update sample rate position 425 lSRatePosition = (LONG)(pConfigInfo->ulSRatePosition + ulHwSampleCount*pConfigInfo->ulSRateIncrement); 448 449 lSRatePosition = (LONG)(pConfigInfo->ulSRatePosition + ulHwSampleCount * pConfigInfo->ulSRateIncrement); 426 450 lSRatePosition = lSRatePosition - (LONG)ulSampleCount*(LONG)SRATE_SHIFT_VALUE; 427 451 … … 439 463 } 440 464 else 441 if(OSS16_WaveAddBuffer(StreamId, pUserBuffer, ulBytesToTransfer, pulBytesTransferred) != OSSERR_SUCCESS) 442 { 465 { 466 if( (rc=OSS16_WaveAddBuffer(StreamId, pUserBuffer, ulBytesToTransfer, pulBytesTransferred)) != OSSERR_SUCCESS) 467 { 443 468 *pulBytesTransferred = 0; 469 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer failed due to an error rc=%x",(USHORT)rc)); 444 470 return FALSE; 471 } 445 472 } 446 473 return TRUE; … … 473 500 BOOL WAVEPLAY::GetSpace(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, ULONG FAR *pulStreamSpace) 474 501 { 475 ULONG space ;502 ULONG space,cvt; 476 503 477 504 // if (!waveOpened) return TRUE; … … 484 511 return FALSE; 485 512 } 486 487 *pulStreamSpace= ConvertLengthInvert(space, pConfigInfo);513 LastSpace = space; 514 cvt = ConvertLengthInvert(space, pConfigInfo); 488 515 //round to sample boundary 489 *pulStreamSpace &= ~(pConfigInfo->ulSampleSize - 1);516 *pulStreamSpace =cvt & ( ~(pConfigInfo->ulSampleSize - 1)); 490 517 return TRUE; 491 518 }
Note:
See TracChangeset
for help on using the changeset viewer.