Changeset 513 for OCO/branches/DAZ/drv16/waveplay.cpp
- Timestamp:
- Jul 12, 2010, 12:57:31 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/branches/DAZ/drv16/waveplay.cpp
r507 r513 2 2 /* SCCSID = %W% %E% */ 3 3 /**************************************************************************** 4 * 5 * Copyright (c) IBM Corporation 1994 - 1997. 6 * 7 * The following IBM OS/2 source code is provided to you solely for the 4 * * 5 * Copyright (c) IBM Corporation 1994 - 1997. * 6 * * 7 * The following IBM OS/2 source code is provided to you solely for the * 8 8 * the purpose of assisting you in your development of OS/2 device drivers. * 9 * You may use this code in accordance with the IBM License Agreement 10 * provided in the IBM Device Driver Source Kit for OS/2. 11 * 9 * You may use this code in accordance with the IBM License Agreement * 10 * provided in the IBM Device Driver Source Kit for OS/2. * 11 * * 12 12 ****************************************************************************/ 13 13 /**@internal %W% … … 15 15 * @version %I% 16 16 * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit, 17 * 17 * <stack context>. 18 18 * @history 19 19 * … … 44 44 extern "C" 45 45 { 46 47 46 ULONG open_strategy = 0UL; 47 ULONG LastSpace=0; 48 48 //int force_close(void); 49 49 } … … 59 59 BOOL WAVEPLAY::Open(ULONG ulDevice, ULONG ulStreamType, ULONG ulSysFileNum, OSSSTREAMID FAR *pStreamId) 60 60 { 61 61 ULONG ret; 62 62 //dprintf(("WAVEPLAY::Open %lx",StreamId)); 63 64 63 if (fAPMSuspend) 64 { 65 65 //dprintf(("WAVEPLAY::Open. Suspend state")); 66 67 68 69 70 71 72 73 74 66 apm_resume(); 67 } 68 69 if(StreamId == 0UL) 70 { 71 if((ret = OSS16_WaveOpen(ulDevice, ulStreamType, ulSysFileNum, pStreamId)) != OSSERR_SUCCESS) 72 { 73 dprintf(("OSS16_WaveOpen failed!!")); 74 DebugInt3(); 75 75 //StreamId = 0; 76 76 //waveOpened = 0; 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 77 return FALSE; 78 } else 79 waveOpened++; 80 //if the device only supports one active stream, then it is shared by 81 //all wave stream instances. MMPM/2 takes care of proper sharing for us 82 //if the device supports multiple active streams, then we always open 83 //a new ALSA stream 84 //if(devCaps[ulDevice].waveOutCaps.nrStreams == 1) { 85 StreamId = *pStreamId; 86 //} 87 ulDeviceSave = ulDevice; 88 ulStreamTypeSave = ulStreamType; 89 ulSysFileNumSave = ulSysFileNum; 90 } 91 else { 92 *pStreamId = StreamId; 93 } 94 return TRUE; 95 95 } 96 96 … … 101 101 //dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 102 102 #if 0 // fixme to be gone? 103 104 105 106 107 108 109 110 103 //if ((open_strategy & 1)) 104 //if (waveOpened == 1) 105 if (force_closed) 106 { 107 waveOpened--; 108 StreamId = 0UL; 109 open_strategy = 0UL; 110 force_closed = 0; 111 111 //dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 112 113 114 112 return TRUE; 113 } 114 else 115 115 #endif // fixme to be gone? 116 117 /* Setting DISABLE_STREAM_REUSE will close the open stream here. 116 { 117 /* Setting DISABLE_STREAM_REUSE will close the open stream here. */ 118 118 /* If left unset, the idea is the open stream will be reused instead. */ 119 /* FIXME: Does it make sense that a Close function does not close 120 /* anything? 119 /* FIXME: Does it make sense that a Close function does not close */ 120 /* anything? */ 121 121 #ifdef DISABLE_STREAM_REUSE 122 123 124 125 126 127 128 122 if(devCaps[ulDeviceNr].waveOutCaps.nrStreams > 1) 123 { 124 if (OSS16_WaveClose(StreamIdl) == OSSERR_SUCCESS) 125 { 126 waveOpened--; 127 StreamId = 0UL; 128 open_strategy = 0UL; 129 129 dprintf(("OSS16_WAVECLOSE: Success")); 130 131 132 133 134 } 135 136 130 return TRUE; 131 } else { 132 dprintf(("OSS16_WAVECLOSE: Error")); 133 return FALSE; 134 } 135 } 136 else 137 137 #else /* !DISABLE_STREAM_REUSE */ 138 138 if (StreamIdl == NULL) return FALSE; 139 139 #endif /* DISABLE_STREAM_REUSE */ 140 141 140 return TRUE; 141 } 142 142 } 143 143 //****************************************************************************** … … 145 145 BOOL WAVEPLAY::ConfigDev(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, ULONG ulFirstBufSize) 146 146 { 147 148 ULONGfragsize;149 intsamplesize;150 ULONGulPCMConsumeRate;151 USHORTrc;152 153 154 155 147 OSS32_HWPARAMS hwparam; 148 ULONG fragsize; 149 int samplesize; 150 ULONG ulPCMConsumeRate; 151 USHORT rc; 152 153 154 if (fAPMSuspend) 155 { 156 156 //dprintf(("WAVEPLAY::ConfigDev. Suspend state")); 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 hwparam.ulPeriodSize= fragsize;221 222 223 224 hwparam.ulSampleRate= pConfigInfo->ulHwSampleRate;225 226 hwparam.ulNumChannels= pConfigInfo->ulHwNumChannels;227 hwparam.ulDataType= QueryOSSDataFormat(OPERATION_PLAY, pConfigInfo->ulDataType, pConfigInfo->ulHwBitsPerSample);228 229 230 231 232 233 234 235 236 // 237 // 238 // 239 240 241 157 apm_resume(); 158 } 159 160 if (StreamId == NULL) 161 { 162 WAVEPLAY::Open(ulDeviceSave, ulStreamTypeSave, ulSysFileNumSave, &StreamId); 163 if (StreamId == NULL) 164 { 165 dprintf(("WAVEPLAY::ConfigDev. Error reopening stream")); 166 return FALSE; 167 } 168 } 169 dprintf4(("WAVEPLAY::ConfigDev SampleRate %ld", pConfigInfo->ulHwSampleRate)); 170 dprintf4(("WAVEPLAY::ConfigDev ulFirstBufSize=%lx ulFragsize=%lx", ulFirstBufSize, pConfigInfo->ulFragsize)); 171 172 if(ulFirstBufSize == 0) 173 { 174 ulFirstBufSize = pConfigInfo->ulFragsize; //no conversion required (see below) 175 if (ulFirstBufSize == 0) 176 { 177 DebugInt3(); 178 ulFirstBufSize = 8192; //should never happen! 179 dprintf(("Arg - shouldn't happen")); 180 } 181 } 182 else 183 { 184 //convert size of first buffer 185 ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo); 186 dprintf4(("ulFirstBufSize %lx", ulFirstBufSize)); 187 } 188 //Must call this method (i.e. resets sample rate conversion position) 189 WAVEAUDIO::ConfigDev(StreamId, pConfigInfo, ulFirstBufSize); 190 191 //get real sample format used to program the audio hardware (taking conversion into account) 192 QuerySampleFormat(OPERATION_PLAY, pConfigInfo); 193 194 //convert consume rate 195 ulPCMConsumeRate = ConvertLength(pConfigInfo->ulPCMConsumeRate, pConfigInfo); 196 dprintf4(("cons rate %lx buf size %lx init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate)); 197 198 fragsize = ulPCMConsumeRate/64; //start with 64 irqs/sec 2756 199 200 //if the buffer is smaller than our predefined fragmentsize (*2), then correct it 201 //I assume here that buffers sizes don't radically change (except the last one) 202 //while playing a stream. If they do get a lot smaller, then we'll run into problems. 203 //There's nothing we can do about it as the fragment size can't be changed 204 //while the stream is playing. 205 ULONG minimumsize = ulFirstBufSize/2; //650 206 if(minimumsize && minimumsize < fragsize) 207 { 208 while(minimumsize < fragsize) fragsize = fragsize / 2; // 209 210 if(fragsize < ulPCMConsumeRate/256) 211 {//lower limit; don't accept extremely small buffers 212 fragsize = ulPCMConsumeRate/256; 213 } 214 } 215 samplesize = (int)pConfigInfo->ulHwSampleSize; 216 217 //round to nearest 64 byte boundary 218 fragsize = (fragsize + 63) & ~(63); 219 220 hwparam.ulPeriodSize = fragsize; 221 pConfigInfo->ulFragsize = fragsize; 222 223 dprintf4(("fragsize %lx", fragsize)); 224 hwparam.ulSampleRate = pConfigInfo->ulHwSampleRate; 225 hwparam.ulBitsPerSample = pConfigInfo->ulHwBitsPerSample; 226 hwparam.ulNumChannels = pConfigInfo->ulHwNumChannels; 227 hwparam.ulDataType = QueryOSSDataFormat(OPERATION_PLAY, pConfigInfo->ulDataType, pConfigInfo->ulHwBitsPerSample); 228 rc = (USHORT)OSS16_WaveSetFormat(StreamId, &hwparam); 229 dprintf4(("WAVEPLAY:ConfigDev:OSS16_WaveSetFormat . rc = %d",rc)); 230 dprintf4(("samp rate=%ld bps=%ld channels=%ld type=%ld", hwparam.ulSampleRate, hwparam.ulBitsPerSample, hwparam.ulNumChannels, hwparam.ulDataType)); 231 232 if( rc != OSSERR_SUCCESS) { 233 dprintf(("WAVEPLAY:ConfigDev: rc %d",rc)); 234 DebugInt3(); 235 // vladest 236 // OSS16_WaveClose(StreamId); 237 // StreamId = 0; 238 // waveOpened = 0; 239 return FALSE; 240 } 241 return TRUE; 242 242 } 243 243 //****************************************************************************** … … 246 246 //****************************************************************************** 247 247 BOOL WAVEPLAY::Transfer(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, 248 249 250 { 251 252 253 254 255 248 LINEAR pUserBuffer, ULONG ulBytesToTransfer, 249 ULONG FAR *pulBytesTransferred) 250 { 251 *pulBytesTransferred = 0; 252 253 //dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer)); 254 255 if (fAPMSuspend) { 256 256 //dprintf(("WAVEPLAY::Transfer. Suspend state")); 257 258 259 260 261 262 257 apm_resume(); 258 } 259 260 if (!ulBytesToTransfer) { 261 return TRUE; 262 } 263 263 264 264 //if (!waveOpened) return TRUE; 265 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 266 if(pConfigInfo->usConversion == CONVERT_NONE) 267 { 268 if (AddBuffer(StreamId, pConfigInfo, pUserBuffer, ulBytesToTransfer, pulBytesTransferred) == FALSE) 269 { 270 dprintf(("Transfer.False. NoConv ulB %ld tr:%ld",ulBytesToTransfer,*pulBytesTransferred)); 271 *pulBytesTransferred = 0; 272 return FALSE; 273 } 274 } 275 else 276 { 277 if(pConfigInfo->pfnConvert) 278 { 279 ULONG ulCvtBufferSize; 280 281 //bytes to convert is bounded by bytes to transfer & max conversion buffer size 282 ulCvtBufferSize = CONVERT_LENGTH(ulBytesToTransfer, pConfigInfo->ulConversionFactor); 283 ulCvtBufferSize = min(CONVERSION_BUFFER_SIZE, ulCvtBufferSize); 284 285 //convert back from conversion to 'real' 286 ulBytesToTransfer = CONVERT_LENGTH(ulCvtBufferSize, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 287 288 if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) 289 { 290 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); 291 291 //DebugInt3(); 292 293 294 295 296 297 298 299 300 301 302 303 304 305 292 ulBytesToTransfer = ulBytesToTransfer & ~(pConfigInfo->ulSampleSize-1); 293 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); 294 } 295 pConfigInfo->pfnConvert(pUserBuffer, ulBytesToTransfer, pConfigInfo->pConversionBuffer); 296 if(AddBuffer(StreamId, pConfigInfo, pConfigInfo->pConversionBuffer, ulCvtBufferSize, pulBytesTransferred) == FALSE) 297 { 298 *pulBytesTransferred = 0; 299 return FALSE; 300 } 301 //convert back from conversion to 'real' 302 *pulBytesTransferred = CONVERT_LENGTH(*pulBytesTransferred, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 303 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) 304 { 305 dprintf(("Transfer New pulBr %ld" , pulBytesTransferred)); 306 306 //DebugInt3(); 307 308 309 310 311 307 } 308 } 309 else 310 { 311 dprintf(("Transfer Zero pConfigInfo->pfnConvert")); 312 312 //DebugInt3(); 313 314 315 316 313 return FALSE; 314 } 315 } 316 return TRUE; 317 317 } 318 318 //****************************************************************************** … … 320 320 //****************************************************************************** 321 321 BOOL WAVEPLAY::AddBuffer(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, LINEAR pUserBuffer, 322 323 { 324 325 322 ULONG ulBytesToTransfer, ULONG FAR *pulBytesTransferred) 323 { 324 OSSRET rc; 325 ULONG Space; 326 326 //if (!waveOpened) return TRUE; 327 327 328 328 //PS Here is inrerrupt time.... 329 329 if (fAPMSuspend) { 330 330 //dprintf(("WAVEPLAY::AddBuffer. Suspend state")); 331 apm_resume(); 332 //return FALSE; 333 } 334 335 if (pConfigInfo->fSampleRateConversion) 336 { 337 ULONG ulCvtBufferSize, ulSampleCount, ulHwSampleCount; 338 LONG lSRatePosition; 339 340 //bytes to convert is bounded by bytes to transfer & max conversion buffer size 341 ulCvtBufferSize = SRATE_CONVERT_LENGTH(ulBytesToTransfer, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 342 ulCvtBufferSize = min(CONVERSION_BUFFER_SIZE, ulCvtBufferSize); 343 //round to sample boundary 344 ulCvtBufferSize &= ~(pConfigInfo->ulHwSampleSize - 1); 345 346 if(ulCvtBufferSize == 0) 347 { 348 *pulBytesTransferred = ulBytesToTransfer; 349 if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) 350 { 351 pConfigInfo->ulSRatePosition -= pConfigInfo->ulSRateIncrement; 352 } 353 return TRUE; 354 } 355 pConfigInfo->pfnSRateConv(pUserBuffer, ulCvtBufferSize, pConfigInfo->pSRateConvBuffer, 356 pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 357 OSS16_WaveGetSpace(StreamId, &Space); 358 if (ulCvtBufferSize > Space) 359 { 360 dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space)); 361 if (Space < pConfigInfo->ulBytesPerIRQ) 362 { 363 return TRUE; 364 } 365 366 if (ulCvtBufferSize > Space) 367 ulCvtBufferSize = Space & ~(pConfigInfo->ulHwSampleSize - 1); 368 } 369 if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS 370 || *pulBytesTransferred == 0) 371 { 372 if(rc == OSSERR_BUFFER_FULL) 373 { 374 GetSpace(StreamId, pConfigInfo, &Space); 375 dprintf(("WPLAY::AddBuffer; %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space)); 376 } 377 #ifdef DEBUG 378 else 379 dprintf(("WPLAY::AddBuffer; %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc)); 380 #endif 381 *pulBytesTransferred = 0; 382 return FALSE; 383 } 384 ulHwSampleCount = *pulBytesTransferred/pConfigInfo->ulHwSampleSize; 385 386 //convert back from conversion to 'real' 387 ulSampleCount = SRATE_CONVERT_LENGTH_INVERT(ulHwSampleCount, 388 pConfigInfo->ulSRatePosition, 389 pConfigInfo->ulSRateIncrement); 390 391 //update sample rate position 392 393 lSRatePosition = (LONG)(pConfigInfo->ulSRatePosition + ulHwSampleCount * pConfigInfo->ulSRateIncrement); 394 lSRatePosition = lSRatePosition - (LONG)ulSampleCount*(LONG)SRATE_SHIFT_VALUE; 395 396 // if the last sample is still needed for the next run, then adjust sample count and 397 // sample rate conversion position 398 if(lSRatePosition < 0) 399 { 400 dprintf4(("WAVEPLAY::AddBuffer; sratepos < 0")); 401 dprintf4(("ulHwSampleCount %lx pConfigInfo->ulSRateIncrement %lx ulSampleCount %lx", ulHwSampleCount, pConfigInfo->ulSRateIncrement, ulSampleCount)); 402 pConfigInfo->ulSRatePosition = 0; 403 } 404 else 405 { 406 pConfigInfo->ulSRatePosition = (ULONG)lSRatePosition; 407 } 408 *pulBytesTransferred = ulSampleCount*pConfigInfo->ulHwSampleSize; 409 } 410 else 411 { 412 if( (rc=OSS16_WaveAddBuffer(StreamId, pUserBuffer, ulBytesToTransfer, pulBytesTransferred)) != OSSERR_SUCCESS) 413 { 414 *pulBytesTransferred = 0; 415 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer failed due to an error rc=%x",(USHORT)rc)); 416 dprintf(("StreamID:%x PUB:%lx BtTr:%ld",(USHORT)StreamId, pUserBuffer, ulBytesToTransfer)); 417 return FALSE; 418 } 419 } 420 return TRUE; 331 apm_resume(); 332 //return FALSE; 333 } 334 335 if (pConfigInfo->fSampleRateConversion) 336 { 337 ULONG ulCvtBufferSize, ulSampleCount, ulHwSampleCount; 338 LONG lSRatePosition; 339 340 //bytes to convert is bounded by bytes to transfer & max conversion buffer size 341 ulCvtBufferSize = SRATE_CONVERT_LENGTH(ulBytesToTransfer, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 342 ulCvtBufferSize = min(CONVERSION_BUFFER_SIZE, ulCvtBufferSize); 343 //round to sample boundary 344 ulCvtBufferSize &= ~(pConfigInfo->ulHwSampleSize - 1); 345 346 if(ulCvtBufferSize == 0) 347 { 348 *pulBytesTransferred = ulBytesToTransfer; 349 if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) 350 { 351 pConfigInfo->ulSRatePosition -= pConfigInfo->ulSRateIncrement; 352 } 353 return TRUE; 354 } 355 pConfigInfo->pfnSRateConv(pUserBuffer, ulCvtBufferSize, pConfigInfo->pSRateConvBuffer, 356 pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 357 OSS16_WaveGetSpace(StreamId, &Space); 358 if (ulCvtBufferSize > Space) 359 { 360 dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space)); 361 if (Space < pConfigInfo->ulBytesPerIRQ) 362 { 363 return TRUE; 364 } 365 366 if (ulCvtBufferSize > Space) 367 ulCvtBufferSize = Space & ~(pConfigInfo->ulHwSampleSize - 1); 368 } 369 if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS 370 || *pulBytesTransferred == 0) 371 { 372 if(rc == OSSERR_BUFFER_FULL) { 373 GetSpace(StreamId, pConfigInfo, &Space); 374 dprintf(("WPLAY::AddBuffer; %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space)); 375 } else { 376 dprintf(("WPLAY::AddBuffer; %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc)); 377 } 378 *pulBytesTransferred = 0; 379 return FALSE; 380 } 381 ulHwSampleCount = *pulBytesTransferred/pConfigInfo->ulHwSampleSize; 382 383 //convert back from conversion to 'real' 384 ulSampleCount = SRATE_CONVERT_LENGTH_INVERT(ulHwSampleCount, 385 pConfigInfo->ulSRatePosition, 386 pConfigInfo->ulSRateIncrement); 387 388 //update sample rate position 389 390 lSRatePosition = (LONG)(pConfigInfo->ulSRatePosition + ulHwSampleCount * pConfigInfo->ulSRateIncrement); 391 lSRatePosition = lSRatePosition - (LONG)ulSampleCount*(LONG)SRATE_SHIFT_VALUE; 392 393 // if the last sample is still needed for the next run, then adjust sample count and 394 // sample rate conversion position 395 if(lSRatePosition < 0) 396 { 397 dprintf4(("WAVEPLAY::AddBuffer; sratepos < 0")); 398 dprintf4(("ulHwSampleCount %lx pConfigInfo->ulSRateIncrement %lx ulSampleCount %lx", ulHwSampleCount, pConfigInfo->ulSRateIncrement, ulSampleCount)); 399 pConfigInfo->ulSRatePosition = 0; 400 } 401 else 402 { 403 pConfigInfo->ulSRatePosition = (ULONG)lSRatePosition; 404 } 405 *pulBytesTransferred = ulSampleCount*pConfigInfo->ulHwSampleSize; 406 } 407 else 408 { 409 if( (rc=OSS16_WaveAddBuffer(StreamId, pUserBuffer, ulBytesToTransfer, pulBytesTransferred)) != OSSERR_SUCCESS) 410 { 411 *pulBytesTransferred = 0; 412 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer failed due to an error rc=%x",(USHORT)rc)); 413 dprintf(("StreamID:%x PUB:%lx BtTr:%ld",(USHORT)StreamId, pUserBuffer, ulBytesToTransfer)); 414 return FALSE; 415 } 416 } 417 return TRUE; 421 418 } 422 419 //****************************************************************************** … … 425 422 BOOL WAVEPLAY::GetPosition(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, ULONG FAR *pulStreamPosition) 426 423 { 427 428 429 //if (!waveOpened) return TRUE;430 431 432 433 434 435 436 437 *pulStreamPosition= ConvertPositionInvert(ulCurBytesProcessed, pConfigInfo);438 439 440 424 ULONG ulCurBytesProcessed; 425 426 //if (!waveOpened) return TRUE; 427 428 if(OSS16_WaveGetPos(StreamId, &ulCurBytesProcessed) != OSSERR_SUCCESS) { 429 *pulStreamPosition = 0; 430 dprintf(("WAVEPLAY::GetPosition: Failed")); 431 return FALSE; 432 } 433 434 *pulStreamPosition = ConvertPositionInvert(ulCurBytesProcessed, pConfigInfo); 435 //round to sample boundary 436 *pulStreamPosition &= ~(pConfigInfo->ulSampleSize - 1); 437 return TRUE; 441 438 } 442 439 //****************************************************************************** … … 445 442 BOOL WAVEPLAY::GetSpace(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, ULONG FAR *pulStreamSpace) 446 443 { 447 448 449 //if (!waveOpened) return TRUE;450 451 452 453 454 455 456 457 458 //dprintf(("GetSpace: len %ld",space));459 460 461 462 444 ULONG space,cvt; 445 446 //if (!waveOpened) return TRUE; 447 448 if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) 449 { 450 *pulStreamSpace = 0; 451 dprintf(("WAVEPLAY::GetSpace: Failed")); 452 return FALSE; 453 } 454 455 //dprintf(("GetSpace: len %ld",space)); 456 cvt = ConvertLengthInvert(space, pConfigInfo); 457 //round to sample boundary 458 *pulStreamSpace =cvt & ( ~(pConfigInfo->ulSampleSize - 1)); 459 return TRUE; 463 460 } 464 461 //****************************************************************************** … … 467 464 BOOL WAVEPLAY::GetHwPtr(OSSSTREAMID StreamId, PWAVECONFIGINFO pConfigInfo, ULONG FAR *pulHwPtr) 468 465 { 469 470 471 472 473 474 475 476 477 478 479 480 481 466 ULONG space,cvt; 467 468 if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) 469 { 470 *pulHwPtr = 0; 471 dprintf(("WAVEPLAY::WaveGetHwPtr: Failed")); 472 return FALSE; 473 } 474 475 cvt = ConvertLengthInvert(space, pConfigInfo); 476 //round to sample boundary 477 *pulHwPtr = cvt & (~(pConfigInfo->ulSampleSize - 1)); 478 return TRUE; 482 479 } 483 480 //****************************************************************************** … … 486 483 BOOL WAVEPLAY::SetVolume(OSSSTREAMID StreamId, OSSSTREAMID mixerStreamId, ULONG ulVolume) 487 484 { 488 485 return MixerSetWaveVolume(mixerStreamId, StreamId, ulVolume); 489 486 } 490 487 //****************************************************************************** … … 494 491 #pragma on (unreferenced) 495 492 { 496 493 return MixerQueryVolume(mixerStreamId, OSS32_MIX_VOLUME_CAPTURE); 497 494 } 498 495 //****************************************************************************** … … 502 499 #pragma on (unreferenced) 503 500 { 504 505 501 DebugInt3(); 502 return FALSE; 506 503 } 507 504 … … 509 506 #pragma data_seg ("_initdata","endds"); 510 507 /******************************************************************************/ 511 /* WAVEPLAY::WAVEPLAY(USHORT PrimeDma, USHORT SecDma, USHORT Irq) 512 /* The constructor, basicly passes the resources info up the stream to the 513 /* "parent classes" and calles _vSetup which constructs all the resource 514 /* class objects we need to run. 515 /* 508 /* WAVEPLAY::WAVEPLAY(USHORT PrimeDma, USHORT SecDma, USHORT Irq) */ 509 /* The constructor, basicly passes the resources info up the stream to the */ 510 /* "parent classes" and calles _vSetup which constructs all the resource */ 511 /* class objects we need to run. */ 512 /* */ 516 513 /******************************************************************************/ 517 514
Note:
See TracChangeset
for help on using the changeset viewer.