Changeset 396 for OCO/trunk/drv16/wavestrm.cpp
- Timestamp:
- Oct 17, 2008, 5:37:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/wavestrm.cpp
r379 r396 1 2 1 /* SCCSID = %W% %E% */ 3 2 /**************************************************************************** … … 51 50 // the data has been played and 1 if there is still some data left. 52 51 //****************************************************************************** 53 USHORT WAVESTREAM::_vRealignBuffer(ULONG FAR *bytesinc, PSTREAMBUFFER pbuffer) 54 { 55 // if none of the data in this stream buffer has been consumed 56 if (!*bytesinc) { 57 pbuffer->ulDonepos = 0; 58 pbuffer->ulBuffpos = 0; 59 return 1; 60 } 61 62 pbuffer->ulDonepos += *bytesinc; 63 pbuffer->ulBuffpos = pbuffer->ulDonepos; 64 *bytesinc = 0; 65 if(pbuffer->ulDonepos >= pbuffer->ulBuffsz) { 66 //calc position in next buffer 67 *bytesinc = pbuffer->ulDonepos - pbuffer->ulBuffsz; 68 return 0; //all of the buffer has been consumed 69 } 70 return 1; 71 } 52 USHORT WAVESTREAM::_vRealignBuffer(ULONG endpos, PSTREAMBUFFER pbuffer) 53 { 54 ULONG streambuf_start, bufconsumed; 55 USHORT usRC; 56 57 streambuf_start = pbuffer->ulDonepos - pbuffer->ulBuffpos; 58 // if none of the data in this stream buffer has been consumed 59 if (endpos <= streambuf_start) { 60 pbuffer->ulDonepos = 0; 61 pbuffer->ulBuffpos = 0; 62 usRC = 1; 63 } 64 // else some or all of the data has been consumed 65 else { 66 bufconsumed = endpos - streambuf_start; 67 // some of the buffer has been consumed 68 if (bufconsumed <= pbuffer->ulBuffsz) { 69 pbuffer->ulDonepos = 0; 70 pbuffer->ulBuffpos = pbuffer->ulBuffsz - bufconsumed; 71 pbuffer->ulBuffpos &= 0xFFFFFFFC; //keep it on a dword boundary 72 usRC = 1; 73 } 74 // all of the buffer has been consumed 75 else { 76 pbuffer->ulDonepos = 0; 77 pbuffer->ulBuffpos = pbuffer->ulBuffsz; 78 usRC = 0; 79 } 80 } 81 return(usRC); 82 } 83 72 84 //****************************************************************************** 73 85 // _vRealignPausedBuffers(void) … … 89 101 void WAVESTREAM::_vRealignPausedBuffers(ULONG endpos) 90 102 { 91 PSTREAMBUFFER ptempbuff; 92 93 switch (ulStreamType & STREAM_WRITE) { 94 case STREAM_READ: 95 //SvL: Don't get the lastest recording data as a read command 96 // would now restart recording (as it's stopped) 97 // Just return what we've got or push the buffer on the inprocess queue 98 ptempbuff = (PSTREAMBUFFER)qhDone.Head(); 99 if(ptempbuff) { 100 if(ptempbuff->ulBuffpos) {//if we recorded anything into this buffer, then return it now 101 ReturnBuffer(); 102 return; 103 } 104 ptempbuff->ulBuffpos = 0; 105 ptempbuff->ulDonepos = 0; 106 qhInProcess.PushOnHead(qhDone.PopHead()); 107 } 108 break; 103 PQUEUEHEAD pTempHead = new QUEUEHEAD; 104 PSTREAMBUFFER ptempbuff; 105 USHORT usRC; 106 107 108 switch (ulStreamType & STREAM_WRITE) { 109 case STREAM_READ: 110 _vReadAudioBuf(); 111 break; 109 112 110 113 case STREAM_WRITE: 111 { 112 PQUEUEHEAD pTempHead = new QUEUEHEAD; 113 ULONG bytesinc; 114 USHORT usRC; 115 116 bytesinc = endpos - _ulBytesProcessed; 117 bytesinc &= 0xFFFFFFFC; //keep it on a dword boundary 118 119 // if there are bufferes on the done queue, pop them off the head and 120 // push them on the head of qhTempHead. This will reorder them so 121 // that the more recently used ones will be in the front of the queue. 122 // Pass them all to _vRealignBuffer. If the rc from _vRealignBuffer is 123 // 0 then there is no unprocessed data in the buffer (it is ready to 124 // be returned) so put it on the Tail of the done queue. 125 // If the rc is 1 then put it on the head of the InProcess queue. 126 127 while (qhDone.IsElements()) { 128 pTempHead->PushOnTail(qhDone.PopHead()); 129 } /* endwhile */ 130 131 while (qhInProcess.IsElements()) { 132 pTempHead->PushOnTail(qhInProcess.PopHead()); 133 } /* endwhile */ 134 135 while(pTempHead->IsElements()) { 136 usRC = _vRealignBuffer(&bytesinc, (PSTREAMBUFFER)pTempHead->Head()); 137 if (usRC) { 138 qhInProcess.PushOnTail(pTempHead->PopHead()); 139 } 140 else { 141 qhDone.PushOnTail(pTempHead->PopHead()); 142 } 143 } /* endwhile */ 144 if(qhDone.IsElements()) 145 ReturnBuffer(); 146 147 delete pTempHead; // free the memory this ain't no Java here !! 148 break; 149 } 150 default: 151 break; 152 } /* endswitch */ 153 } 114 115 // if there is a buffer on the InProcess Queue 116 // only check the first one as any others are just waiting..... 117 if (qhInProcess.IsElements()) { 118 // if any data has been written from this stream buffer 119 ptempbuff = (PSTREAMBUFFER)qhInProcess.Head(); 120 if (ptempbuff->ulDonepos) { 121 _vRealignBuffer(endpos, ptempbuff); 122 } /* end if ulDonepos */ 123 } 124 125 // if there are bufferes on the done queue, pop them off the head and 126 // push them on the head of qhTempHead. This will reorder them so 127 // that the more recently used ones will be in the front of the queue. 128 // Pass them all to _vRealignBuffer. If the rc from _vRealignBuffer is 129 // 0 then there is no unprocessed data in the buffer (it is ready to 130 // be returned) so put it on the Tail of the done queue. 131 // If the rc is 1 then put it on the head of the InProcess queue. 132 133 while (qhDone.IsElements()) { 134 pTempHead->PushOnHead(qhDone.PopHead()); 135 } /* endwhile */ 136 137 while (pTempHead->IsElements()) { 138 usRC = _vRealignBuffer(endpos, (PSTREAMBUFFER)pTempHead->Head()); 139 if (usRC) 140 qhInProcess.PushOnHead(pTempHead->PopHead()); 141 else 142 qhDone.PushOnTail(pTempHead->PopHead()); 143 } /* endwhile */ 144 break; 145 default: 146 break; 147 } /* endswitch */ 148 delete pTempHead; // free the memory this ain't no Java here !! 149 } 150 154 151 //****************************************************************************** 155 152 // get ready to start streaming … … 164 161 ULONG space, byteswritten; 165 162 163 dgprintf(("AddBuffers")); 164 165 byteswritten = 0; 166 166 if (ulStreamType & STREAM_WRITE) { 167 if(!qhInProcess.Head() && !qhDone.Head()) { 168 //underrun: stop playback 169 // dprintf(("underrun: stop playback")); 170 171 //save last known position 172 _ulUnderrunBase = GetCurrentPos(); 173 174 //silence wave stream before stopping it (removes clicks) 175 pahw->SetVolume(StreamId, getMixerStreamId(), 0); 176 177 //and stop it 178 pahw->Stop(StreamId); 179 fUnderrun = TRUE; 180 return; 181 } 182 if(pahw->GetSpace(StreamId, &_configinfo, &space) == FALSE) { 183 dprintf(("pahw->getSpace: No room!")); 167 // get the space available in the hardware buffer 168 // only call GetSpace once because the amount of free space in 169 // the hardware buffer is a moving target and calling it more than once 170 // could keep us in this loop writing 4 or 8 bytes at a time. 171 // In extream cases we will stay stuck in this loop long enough to casue a trap rjj 172 if(pahw->GetSpace(StreamId, &_configinfo, &space) == FALSE) { 173 dgprintf(("WAVESTREAM::AddBuffers Error 1")); 184 174 return; 185 175 } 186 while(space) { 187 byteswritten = AddBuffer(space); 188 if(byteswritten == (ULONG)-1) break; 189 space -= byteswritten; 190 } 191 } 192 } 193 //****************************************************************************** 194 // write one buffer to the audio buffer 176 space &= ( ~(_configinfo.ulSampleSize - 1)); 177 while (space && qhInProcess.IsElements()) { 178 byteswritten = AddBuffer(space); 179 if(byteswritten == (ULONG)-1) 180 break; 181 space -= byteswritten; 182 space &= ( ~(_configinfo.ulSampleSize - 1)); 183 } 184 185 } 186 } 187 //****************************************************************************** 188 // write one buffer to the audio buffer 1 195 189 // the caller of this function MUST make sure it ok to write the audio buffer.. 196 190 // _AudioBufWrite will not check if there is room in the audio buffer of if … … 199 193 ULONG WAVESTREAM::AddBuffer(ULONG space) 200 194 { 201 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qh Done.Tail();195 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 202 196 ULONG pdataBuf; 203 ULONG Buff_left, byteswritten; 204 205 if(!pTemp || pTemp->ulBuffpos >= (pTemp->ulBuffsz & 0xFFFFFFFC)) { 206 pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 207 } 208 if(!pTemp) { 209 #ifdef DEBUG 210 dprintf(("AddBuffer: pTemp == NULL")); 211 #endif /* DEBUG */ 212 return (ULONG)-1; 197 ULONG Buff_left, byteswritten, start_pos; 198 199 ddprintf(("AddBuffer")); 200 // make sure we have a buffer to copy from..... 201 if (!pTemp) { 202 return (ULONG)-1; 203 } 204 205 // get the starting position. Call WaveGetHwPtr. if we get a bad rc 206 // then we bail out. 207 if(pahw->GetHwPtr(StreamId, &_configinfo, &start_pos) == FALSE) 208 { 209 dgprintf(("WAVESTREAM::AddBuffer Error in WaveGetHwPtr")); 210 DebugInt3(); 211 return (ULONG)-1; 213 212 } 214 213 … … 216 215 pdataBuf = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos; 217 216 Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos; 218 219 if(Buff_left) { 220 // write the audio buffer 221 Buff_left = min(Buff_left, space); 222 if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE) { 223 dprintf(("AddBuffer: pahw->Transfer failed!!")); 224 return (ULONG)-1; 225 } 226 if(byteswritten == 0) { 227 return (ULONG)-1; //no more room 228 } 229 230 // update the buffer pos counter 231 pTemp->ulBuffpos += byteswritten; 232 } 233 else byteswritten = 0; 234 235 if(pTemp == qhInProcess.Head()) { 236 qhDone.PushOnTail(qhInProcess.PopHead()); 237 } 238 dprintf(("AddBuffer %lx size %d, bytes written %d", pdataBuf, (USHORT)Buff_left, (USHORT)byteswritten)); 217 Buff_left = min(Buff_left, space); 218 219 if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE) { 220 dgprintf(("AddBuffer: pahw->Transfer failed!!")); 221 return (ULONG)-1; 222 } 223 if(byteswritten == 0) { 224 return (ULONG)-1; //no more room 225 } 226 // update the buffer pos counter 227 pTemp->ulBuffpos += byteswritten; 228 229 // update the done Position 230 pTemp->ulDonepos = start_pos + byteswritten; 231 232 // check to see if the buffer has been copied and needs to be put on the done queue 233 if (pTemp->ulBuffpos >= (pTemp->ulBuffsz & 0xFFFFFFFC)) { 234 qhDone.PushOnTail(qhInProcess.PopHead()); 235 } 236 dgprintf(("WAVESTREAM::AddBuffer sz %lx, bywr %lx dp %lx", Buff_left, byteswritten,pTemp->ulDonepos)); 239 237 return byteswritten; 240 238 } … … 249 247 ULONG Buff_left, bytesread; 250 248 251 if(!pTemp) 249 if(!pTemp) 252 250 return FALSE; 253 251 … … 290 288 PSTREAMBUFFER ptemp; 291 289 ULONG ulCurBytesProcessed = 0; 292 ULONG bytesinc;290 // ULONG bytesinc; 293 291 294 292 #ifdef DEBUG 295 //dprintf(("WAVESTREAM::Process"));293 ddprintf(("WAVESTREAM::Process")); 296 294 #endif 297 295 296 // get the stream position. if we get a bad rc or the position is 0 297 // then we bail out. Hopefully this will be better next time. 298 // GetPostiion returns the adjusted hw pointer from the ALSA status ioctl 299 // This is really a running total of bytes consumed by the hardware. 300 if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE) 301 { 302 ddprintf(("Error No bytes processed")); 303 DebugInt3(); 304 return; 305 } 306 ddprintf(("StPos: %lx", ulCurBytesProcessed)); 307 // save the bytes processed in the stream object 308 _ulBytesProcessed = ulCurBytesProcessed; 309 298 310 switch (ulStreamType & STREAM_WRITE) { 299 case STREAM_WRITE: 300 { 301 if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE || 302 ulCurBytesProcessed == 0) 303 {//shouldn't happen 304 DebugInt3(); 305 return; 306 } 307 308 bytesinc = ulCurBytesProcessed - _ulBytesProcessed; 309 dprintf3(("P: %lx %x", ulCurBytesProcessed, (USHORT)bytesinc)); 310 311 if(ulCurBytesProcessed < _ulBytesProcessed) 311 312 // if there are buffers that have been completly written to the audio buffer 313 // check the first one on the done queue 314 // if it's data has been consumed by the hardware return it. 315 // 316 // Bug #18 Sometimes MMPM gives us really small buffers. If we 317 // wait for the buffer to be completly consumed and there is a tiny buffer 318 // on the queue after this one, the sound part could underrun before we get a 319 // chance to refill it. To fix this we will return the buffer if it will be 320 // consumed before the next call to WAVESTREAM:Process(). 321 // rjj Fix for Bug #18 28082008 322 case STREAM_WRITE: 312 323 { 313 ULONG ulCurBytesProcessed, ulStreamPos; 314 315 if(OSS16_WaveGetPos(StreamId, &ulCurBytesProcessed) != OSSERR_SUCCESS) { 316 ulCurBytesProcessed = 0; 324 if(qhDone.IsElements()) { 325 ptemp = (PSTREAMBUFFER)qhDone.Head(); 326 while ((_ulBytesProcessed + _configinfo.ulBytesPerIRQ) >= ptemp->ulDonepos) 327 { 328 ReturnBuffer(); 329 ptemp = (PSTREAMBUFFER)qhDone.Head(); 330 } 317 331 } 318 319 ulStreamPos = pahw->ConvertPositionInvert(ulCurBytesProcessed, &_configinfo); 320 //round to sample boundary 321 ulStreamPos &= ~(_configinfo.ulSampleSize - 1); 322 323 #ifdef DEBUG 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 #endif /* DEBUG */ 327 } 328 _ulBytesProcessed = ulCurBytesProcessed; 329 330 while(bytesinc) 331 { 332 if(qhDone.IsElements()) { // if there are buffers that have been completly written to the audio buffer 333 // check the first one on the done queue 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 341 ptemp = (PSTREAMBUFFER)qhDone.Head(); 342 ptemp->ulDonepos += bytesinc; 343 bytesinc = 0; 344 if ((ptemp->ulDonepos + _configinfo.ulBytesPerIRQ) >= ptemp->ulBuffsz) 345 { 346 //calc position in next buffer 347 bytesinc = ptemp->ulDonepos - ptemp->ulBuffsz; 348 // dprintf2(("Process: Return buffer %lx size %d", ptemp->pBuffptr, ptemp->ulBuffsz)); 349 ReturnBuffer(); 350 } 351 } 352 else break; //shouldn't happen 353 } 354 355 if (qhInProcess.IsElements()){ 356 AddBuffers(FALSE); 357 } 332 if (qhInProcess.IsElements()){ 333 AddBuffers(FALSE); 334 } 335 358 336 break; 359 } 360 case STREAM_READ: 337 338 } 339 case STREAM_READ: 361 340 while(_vReadAudioBuf()); 362 341 break; 363 default:364 break;342 default: 343 break; 365 344 } /* endswitch */ 366 345 … … 382 361 { 383 362 qhInProcess.PushOnTail((PQUEUEELEMENT)pStreamBuf); 384 // dprintf2(("WAVESTREAM::Write: Push on tail %lx %ld", ((PSTREAMBUFFER)qhInProcess.Tail())->pBuffptr, ((PSTREAMBUFFER)qhInProcess.Tail())->ulBuffsz)); 385 if(fUnderrun) { 386 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 387 388 // dprintf(("Restart after underrun!")); 389 fUnderrun = FALSE; 390 391 // configure the wave device 392 // (NOTE: Must call this function; sample rate position is reset there) 393 if(pahw->ConfigDev(StreamId, &_configinfo, pTemp->ulBuffsz) == FALSE) { 394 dprintf(("ConfigDev failed!!")); 395 } 396 397 // prepare wave device for playback/recording 398 if(pahw->Prepare(StreamId) == FALSE) { 399 dprintf(("Prepare failed!!")); 400 } 401 AddBuffers(TRUE); 402 if(ulStreamType == STREAM_WAVE_PLAY) 403 MixerSetWaveVolume(getMixerStreamId(), StreamId, volume); 404 } 363 // dprintf2(("WAVESTREAM::Write: Push on tail %lx %ld", ((PSTREAMBUFFER)qhInProcess.Tail())->pBuffptr, ((PSTREAMBUFFER)qhInProcess.Tail())->ulBuffsz)); 405 364 return 0; 406 365 } … … 433 392 if (ulStreamState == STREAM_STREAMING) // if the stream is active 434 393 { 435 if (ulStreamType & STREAM_WRITE)394 if (ulStreamType & STREAM_WRITE) 436 395 { 437 if(pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE)396 if(pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 438 397 { 439 398 DebugInt3(); 440 399 Processed = _ulBytesProcessed; //last known position 441 400 } 442 } 443 else Processed = _ulBytesProcessed; 444 } 445 else Processed = _ulBytesProcessed; 446 447 //add position of underrun (if one occurred in the past) 448 Processed += _ulUnderrunBase; 401 } 402 else 403 Processed = _ulBytesProcessed; 404 } 405 else 406 Processed = _ulBytesProcessed; 449 407 450 408 // if we haven't processed anything then just return … … 467 425 if (ulStreamState == STREAM_STREAMING) // if the stream is active 468 426 { 469 470 if(pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE)427 if (ulStreamType & STREAM_WRITE) { 428 if(pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 471 429 { 472 430 DebugInt3(); 473 431 Processed = _ulBytesProcessed; //last known position 474 432 } 475 476 else Processed = _ulBytesProcessed; 477 }478 else Processed = _ulBytesProcessed;479 480 //add position of underrun (if one occurred in the past)481 Processed += _ulUnderrunBase; 433 } 434 else 435 Processed = _ulBytesProcessed; 436 } 437 else 438 Processed = _ulBytesProcessed; 439 482 440 return Processed; 483 441 } … … 517 475 518 476 #ifdef DEBUG 519 //dprintf(("WAVESTREAM::StartStream"));477 ddprintf(("WAVESTREAM::StartStream")); 520 478 #endif 521 479 522 480 if(ulStreamState == STREAM_STREAMING) { 523 d printf(("StartStream: already playing!!"));481 ddprintf(("StartStream: already playing!!")); 524 482 return NO_ERROR; 525 483 } … … 528 486 // (NOTE: Must call this function; sample rate position is reset there) 529 487 if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE) { 530 d printf(("StartStream: ConfigDev failed!!"));488 ddprintf(("StartStream: ConfigDev failed!!")); 531 489 goto fail; 532 490 } 533 534 491 // prepare wave device for playback/recording 535 492 if(pahw->Prepare(StreamId) == FALSE) { 536 d printf(("StartStream: Prepare failed!!"));493 ddprintf(("StartStream: Prepare failed!!")); 537 494 goto fail; 538 495 } 539 496 540 497 _ulBytesProcessed = 0; 541 _ulUnderrunBase = 0;542 fUnderrun = FALSE;543 498 544 499 ulStreamState = STREAM_STREAMING; 545 500 //Adding the first buffer also starts playback 546 501 if(ulStreamType == STREAM_WAVE_PLAY) { 547 502 AddBuffers(TRUE); 548 503 //Must set volume after adding buffers (voices inside sblive driver might not 549 504 //be allocated otherwise (first start) ) 505 dprintf(("SetVolume %lx",volume)); 550 506 pahw->SetVolume(StreamId, getMixerStreamId(), volume); 551 507 } … … 555 511 pahw->SetVolume(StreamId, getMixerStreamId(), inputgain); 556 512 557 513 if(pahw->Start(StreamId) != TRUE) { 558 514 dprintf(("pahw->Start failed!!")); 559 515 goto fail; 560 516 } 561 517 } 562 //dprintf(("WAVESTREAM::StartStream %lx", StreamId));518 ddprintf(("WAVESTREAM::StartStream %lx", StreamId)); 563 519 return NO_ERROR; 564 520 … … 573 529 if(ulStreamState == STREAM_STOPPED) { 574 530 dprintf(("WAVESTREAM::StopStream %lx (already stopped)", StreamId)); 575 fUnderrun = FALSE;576 531 pControl->ulTime = GetCurrentTime(); 577 532 return NO_ERROR; … … 587 542 588 543 ulStreamState = STREAM_STOPPED; 589 fUnderrun = FALSE; 590 // dprintf(("WAVESTREAM::StopStream %lx", StreamId)); 544 ddprintf(("WAVESTREAM::StopStream %lx", StreamId)); 591 545 ReturnBuffers(); 592 546 pControl->ulTime = GetCurrentTime(); 593 _ulTimeBase = GetCurrentTime(); 547 548 // We need to set _ulBytesProcessed to 0 here. if we do not 549 // and MMPM restarts the stream by sending a DDCMD_SETUP followed By 550 // DDCMD_ENABLE_EVENT the event time will get screwed up. rjj 551 _ulBytesProcessed = 0; 594 552 return NO_ERROR; 595 553 } … … 606 564 607 565 ulStreamState = STREAM_PAUSED; 608 fUnderrun = FALSE; 609 610 // dprintf(("WAVESTREAM::PauseStream %lx", StreamId)); 566 567 ddprintf(("WAVESTREAM::PauseStream %lx", StreamId)); 568 611 569 _vRealignPausedBuffers(endpos); 612 570 613 571 _ulBytesProcessed = endpos; 614 572 pControl->ulTime = GetCurrentTime(); 573 _ulBytesProcessed = 0; 615 574 return NO_ERROR; 616 575 } … … 634 593 switch(type) { 635 594 case PROPERTY_VOLUME: 636 volume = value; 595 volume = value; 596 dprintf(("WAVESTREAM::SetProperty() Vol: %0lx",value)); 637 597 if(ulStreamState == STREAM_STREAMING && ulStreamType == STREAM_WAVE_PLAY) { 638 598 MixerSetWaveVolume(getMixerStreamId(), StreamId, volume); … … 655 615 //****************************************************************************** 656 616 //****************************************************************************** 657 ULONG WAVESTREAM::GetProperty(int type) 617 ULONG WAVESTREAM::GetProperty(int type) 658 618 { 659 619 #ifdef DEBUG … … 677 637 //****************************************************************************** 678 638 WAVESTREAM::WAVESTREAM(ULONG streamtype, LPMCI_AUDIO_INIT pinit, USHORT filesysnum, OSSSTREAMID mixerStreamId): 679 STREAM(streamtype, filesysnum, mixerStreamId) 639 STREAM(streamtype, filesysnum, mixerStreamId) 680 640 { 681 641 #ifdef DEBUG … … 692 652 _ulBytesProcessed = 0; 693 653 _ulTimeBase = 0; 694 _ulUnderrunBase = 0;654 //_ulUnderrunBase = 0; 695 655 ulSavedInputGain = 0; 696 656 697 657 _configinfo.pConversionBuffer = 0; 698 658 pahw->SetupConversion(&_configinfo, pinit->ulOperation, pinit->sMode, pinit->sChannels, pinit->lBitsPerSRate); 699 700 if(_configinfo.usConversion != CONVERT_NONE) 659 660 if(_configinfo.usConversion != CONVERT_NONE) 701 661 {//allocate conversion buffer 702 662 PVOID pSelOff; 703 663 LIN linAddr; 704 664 705 if(DevHelp_VMAlloc( VMDHA_FIXED, CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0)665 if(DevHelp_VMAlloc((VMDHA_FIXED | VMDHA_CONTIG), CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0) 706 666 { 667 //dgprintf(("Error in DevHelp_VMAlloc Conversion Buffer")); 707 668 DebugInt3(); //should never happen!! 708 669 _configinfo.usConversion = CONVERT_NONE; … … 710 671 else _configinfo.pConversionBuffer = linAddr; 711 672 } 712 if(_configinfo.fSampleRateConversion == TRUE) 673 if(_configinfo.fSampleRateConversion == TRUE) 713 674 {//allocate buffer for sample rate conversion 714 675 PVOID pSelOff; 715 676 LIN linAddr; 716 677 717 if(DevHelp_VMAlloc( VMDHA_FIXED, CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0)678 if(DevHelp_VMAlloc((VMDHA_FIXED | VMDHA_CONTIG), CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0) 718 679 { 719 DebugInt3(); //should never happen!! 680 //dgprintf(("Error in DevHelp_VMAlloc SR Conversion Buffer")); 681 DebugInt3(); //should never happen!! 720 682 } 721 683 else _configinfo.pSRateConvBuffer = linAddr; … … 724 686 pinit->ulFlags |= pahw->QueryDataFlags(pinit->ulOperation, pinit->sMode, pinit->lBitsPerSRate); 725 687 726 fUnderrun = FALSE;688 //fUnderrun = FALSE; 727 689 StreamId = 0; 728 690 729 691 if(pahw->Open(current_device, ulStreamType, ulSysFileNum, &StreamId) != TRUE) 730 692 {
Note:
See TracChangeset
for help on using the changeset viewer.