Changeset 483 for OCO/trunk/drv16/waveplay.cpp
- Timestamp:
- May 6, 2010, 3:08:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/waveplay.cpp
r478 r483 189 189 } 190 190 #ifdef DEBUG 191 dprintf(("WAVEPLAY::ConfigDev1 SampleRate %ld", pConfigInfo->ulHwSampleRate)); 192 dprintf(("ulFirstBufSize %ld", ulFirstBufSize)); 193 dprintf(("ulFragsize %ld", pConfigInfo->ulFragsize)); 191 dprintf(("WAVEPLAY::ConfigDev SampleRate %ld", pConfigInfo->ulHwSampleRate)); 192 dprintf(("WAVEPLAY::ConfigDev ulFirstBufSize=%lx ulFragsize=%lx", ulFirstBufSize, pConfigInfo->ulFragsize)); 194 193 #endif 195 194 … … 197 196 { 198 197 ulFirstBufSize = pConfigInfo->ulFragsize; //no conversion required (see below) 199 if (ulFirstBufSize == 0) 198 if (ulFirstBufSize == 0) 200 199 { 201 200 DebugInt3(); … … 206 205 } 207 206 } 208 else 207 else 209 208 { 210 209 //convert size of first buffer 211 210 ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo); 212 211 #ifdef DEBUG 213 dprintf(("ulFirstBufSize %l d", ulFirstBufSize));212 dprintf(("ulFirstBufSize %lx", ulFirstBufSize)); 214 213 #endif /* DEBUG */ 215 214 } … … 223 222 ulPCMConsumeRate = ConvertLength(pConfigInfo->ulPCMConsumeRate, pConfigInfo); 224 223 #ifdef DEBUG 225 dprintf(("cons rate %l d buf size %ldinit rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate));224 dprintf(("cons rate %lx buf size %lx init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate)); 226 225 #endif /* DEBUG */ 227 226 … … 237 236 { 238 237 while(minimumsize < fragsize) fragsize = fragsize / 2; // 239 238 240 239 if(fragsize < ulPCMConsumeRate/256) 241 240 {//lower limit; don't accept extremely small buffers … … 252 251 253 252 #ifdef DEBUG 254 dprintf(("fragsize %l d", fragsize));253 dprintf(("fragsize %lx", fragsize)); 255 254 #endif 256 255 hwparam.ulSampleRate = pConfigInfo->ulHwSampleRate; … … 288 287 289 288 #ifdef DEBUG 290 //dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer));289 //dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer)); 291 290 #endif 292 291 … … 319 318 } 320 319 } 321 else 322 { 323 if(pConfigInfo->pfnConvert) 320 else 321 { 322 if(pConfigInfo->pfnConvert) 324 323 { 325 324 ULONG ulCvtBufferSize; … … 332 331 ulBytesToTransfer = CONVERT_LENGTH(ulCvtBufferSize, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 333 332 334 if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) 333 if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) 335 334 { 336 335 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); … … 349 348 //convert back from conversion to 'real' 350 349 *pulBytesTransferred = CONVERT_LENGTH(*pulBytesTransferred, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 351 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) 350 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) 352 351 { 353 352 #ifdef DEBUG … … 357 356 } 358 357 } 359 else 358 else 360 359 { 361 360 dprintf(("Transfer Zero pConfigInfo->pfnConvert")); … … 374 373 OSSRET rc; 375 374 ULONG Space; 376 ULONG i;377 375 // if (!waveOpened) return TRUE; 378 376 … … 398 396 ulCvtBufferSize &= ~(pConfigInfo->ulHwSampleSize - 1); 399 397 400 if(ulCvtBufferSize == 0) 398 if(ulCvtBufferSize == 0) 401 399 { 402 400 *pulBytesTransferred = ulBytesToTransfer; 403 if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) 401 if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) 404 402 { 405 403 pConfigInfo->ulSRatePosition -= pConfigInfo->ulSRateIncrement; … … 423 421 ulCvtBufferSize = Space & ~(pConfigInfo->ulHwSampleSize - 1); 424 422 } 425 if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS 423 if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS 426 424 || *pulBytesTransferred == 0) 427 425 { 428 if(rc == OSSERR_BUFFER_FULL) 426 if(rc == OSSERR_BUFFER_FULL) 429 427 { 430 428 GetSpace(StreamId, pConfigInfo, &Space); … … 432 430 } 433 431 #ifdef DEBUG 434 else 432 else 435 433 dprintf(("WPLAY::AddBuffer; %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc)); 436 434 #endif … … 452 450 // if the last sample is still needed for the next run, then adjust sample count and 453 451 // sample rate conversion position 454 if(lSRatePosition < 0) 452 if(lSRatePosition < 0) 455 453 { 456 454 dprintf4(("WAVEPLAY::AddBuffer; sratepos < 0")); … … 458 456 pConfigInfo->ulSRatePosition = 0; 459 457 } 460 else 458 else 461 459 { 462 460 pConfigInfo->ulSRatePosition = (ULONG)lSRatePosition; … … 507 505 // if (!waveOpened) return TRUE; 508 506 509 if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) 507 if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) 510 508 { 511 509 *pulStreamSpace = 0; … … 529 527 ULONG space,cvt; 530 528 531 if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) 529 if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) 532 530 { 533 531 *pulHwPtr = 0;
Note:
See TracChangeset
for help on using the changeset viewer.