Changeset 513
- Timestamp:
- Jul 12, 2010, 12:57:31 AM (15 years ago)
- Location:
- OCO/branches/DAZ
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
OCO/branches/DAZ/drv16/dwavestrm.cpp
r483 r513 168 168 ULONG DWAVESTREAM::StartStream(void) 169 169 { 170 #ifdef DEBUG171 170 dprintf(("DWAVESTREAM::StartStream")); 172 #endif173 171 return WAVESTREAM::StartStream(); 174 172 } 175 173 //***************************************************************************** 176 174 //***************************************************************************** 177 void DWAVESTREAM::AddBuffers( BOOL fFirst)175 void DWAVESTREAM::AddBuffers(SHORT sFirst) 178 176 { 179 177 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Tail(); 180 178 ULONG space, Buff_left, byteswritten; 181 179 182 #ifdef DEBUG183 180 dprintf(("DW::AddBuffers")); 184 #endif185 181 if (!pTemp) pTemp = (PSTREAMBUFFER)qhInProcess.Tail(); 186 182 … … 194 190 return; 195 191 } 196 if( fFirst)192 if(sFirst) 197 193 { 198 194 space = min(space, 4*_configinfo.ulFragsize); … … 222 218 else 223 219 { 224 WAVESTREAM::AddBuffers( fFirst);220 WAVESTREAM::AddBuffers(sFirst); 225 221 } 226 222 } -
OCO/branches/DAZ/drv16/dwavestrm.hpp
r33 r513 59 59 virtual void ReturnBuffer(void); // returns one buffer 60 60 61 virtual void AddBuffers( BOOL fFirst); // Initialize the audio buffer object61 virtual void AddBuffers(SHORT sFirst); // Initialize the audio buffer object 62 62 63 63 QUEUEHEAD qhReturn; //queue with buffers to be returned -
OCO/branches/DAZ/drv16/mixer.cpp
r486 r513 317 317 fSetWaveVolume = FALSE; 318 318 //if per-stream volume not supported, change PCM volume instead 319 //dprintf(("Setting PCM volume instead")); 319 320 return MixerSetVolume(mixerStreamId, OSS32_MIX_VOLUME_PCM, Volume, fFlags); 320 321 } -
OCO/branches/DAZ/drv16/ossidc16.cpp
r508 r513 5 5 */ 6 6 7 extern "C" { 7 extern "C" { // 16-bit header files are not C++ aware 8 8 #define INCL_16 9 9 #define INCL_DOSINFOSEG … … 33 33 34 34 void DumpDeviceCaps (LPOSS32_DEVCAPS pDevCaps); 35 void DumpWaveCaps 36 void DumpMixerCaps 35 void DumpWaveCaps (LPWAVE_CAPS pWaveCaps); 36 void DumpMixerCaps (LPOSS32_MIXCAPS pMixCaps); 37 37 #endif 38 38 … … 56 56 // Attach to the 32 bits OSS driver 57 57 if(DevHelp_AttachDD((NPSZ)"ALSA32$ ",(NPBYTE)&IDCTable)) { 58 58 return FALSE; 59 59 } 60 60 idcpacket.init.handler16 = (ULONG)(VOID FAR *)OSSIDC_ENTRY; … … 77 77 IDC32_PACKET idcpacket; 78 78 OSS32_DEVCAPS devcaps; 79 OSSRET 80 81 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 82 83 idcpacket.fileid 79 OSSRET ret; 80 81 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 82 83 idcpacket.fileid = 0x666; 84 84 idcpacket.devcaps.devicenr = devicenr; 85 85 idcpacket.devcaps.pDevCaps = (ULONG)&devcaps; … … 87 87 88 88 #ifdef DEBUG 89 90 91 92 89 if (ret == OSSERR_SUCCESS) 90 DumpDeviceCaps (&devcaps); 91 else 92 dprintf (("IDC32_OSS32_QUERYDEVCAPS - FAILED!")); 93 93 #endif 94 94 … … 123 123 { 124 124 IDC32_PACKET idcpacket; 125 OSSRET 126 127 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 128 129 idcpacket.fileid 130 idcpacket.open.devicenr 125 OSSRET ret; 126 127 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 128 129 idcpacket.fileid = ulSysFileNum; 130 idcpacket.open.devicenr = devicenr; 131 131 idcpacket.open.streamtype = (ulStreamType == STREAM_WAVE_PLAY) ? OSS32_STREAM_WAVEOUT : OSS32_STREAM_WAVEIN; 132 132 ret = CallOSS32(IDC32_WAVE_OPEN, &idcpacket); … … 216 216 if(SELECTOROF(pHwParams) != _SS()) 217 217 {//must be located on the stack! 218 219 220 218 dprintf(("OSS16_WaveSetFormat error. Invalid stack segment for parameters...")); 219 DebugInt3(); 220 return OSSERR_INVALID_PARAMETER; 221 221 } 222 222 223 idcpacket.fileid 224 idcpacket.streamid 223 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 224 idcpacket.streamid = StreamId; 225 225 idcpacket.sethwparams.hwparams = (ULONG)pHwParams; 226 226 return CallOSS32(IDC32_WAVE_SETHWPARAMS, &idcpacket); … … 229 229 //****************************************************************************** 230 230 OSSRET DBGCALLCONV OSS16_WaveAddBuffer(OSSSTREAMID StreamId, LINEAR pBuffer, ULONG size, 231 232 { 233 IDC32_PACKET idcpacket; 234 OSSRET 235 236 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 237 238 idcpacket.fileid 239 idcpacket.streamid 231 ULONG FAR *lpBytesTransferred) 232 { 233 IDC32_PACKET idcpacket; 234 OSSRET ret; 235 236 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 237 238 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 239 idcpacket.streamid = StreamId; 240 240 idcpacket.buffer.buffer = pBuffer; 241 241 idcpacket.buffer.size = size; … … 250 250 { 251 251 IDC32_PACKET idcpacket; 252 OSSRET 253 254 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 255 256 idcpacket.fileid 257 idcpacket.streamid 252 OSSRET ret; 253 254 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 255 256 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 257 idcpacket.streamid = StreamId; 258 258 ret = CallOSS32(IDC32_WAVE_GETPOS, &idcpacket); 259 259 … … 266 266 { 267 267 IDC32_PACKET idcpacket; 268 OSSRET 269 270 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 271 272 idcpacket.fileid 273 idcpacket.streamid 268 OSSRET ret; 269 270 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 271 272 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 273 idcpacket.streamid = StreamId; 274 274 ret = CallOSS32(IDC32_WAVE_GETSPACE, &idcpacket); 275 275 … … 282 282 { 283 283 IDC32_PACKET idcpacket; 284 OSSRET 285 286 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 287 288 idcpacket.fileid 289 idcpacket.streamid 284 OSSRET ret; 285 286 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 287 288 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 289 idcpacket.streamid = StreamId; 290 290 ret = CallOSS32(IDC32_WAVE_GETHWPTR, &idcpacket); 291 291 … … 298 298 { 299 299 IDC32_PACKET idcpacket; 300 OSSRET 301 302 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 303 304 idcpacket.fileid 305 idcpacket.streamid 300 OSSRET ret; 301 302 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 303 304 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 305 idcpacket.streamid = StreamId; 306 306 ret = CallOSS32(IDC32_WAVE_GETSTATUS, &idcpacket); 307 307 … … 317 317 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 318 318 319 idcpacket.fileid 320 idcpacket.streamid 319 idcpacket.fileid = FindStreamFileId_fromStreamId(StreamId); 320 idcpacket.streamid = StreamId; 321 321 idcpacket.setwavevol.volume = volume; 322 322 return CallOSS32(IDC32_WAVE_SETVOLUME, &idcpacket); … … 327 327 { 328 328 IDC32_PACKET idcpacket; 329 OSSRET 329 OSSRET ret; 330 330 331 331 dprintf(("OSS16_MidiOpen. type: %d",midiType)); 332 332 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 333 333 334 idcpacket.fileid 335 idcpacket.open.devicenr 334 idcpacket.fileid = 0x666; //TODO 335 idcpacket.open.devicenr = devicenr; 336 336 switch(midiType) { 337 337 case MPU401_RECEIVE: 338 339 338 idcpacket.open.streamtype = OSS32_STREAM_MPU401_MIDIIN; 339 break; 340 340 case MPU401_SEND: 341 342 341 idcpacket.open.streamtype = OSS32_STREAM_MPU401_MIDIOUT; 342 break; 343 343 case FM_SEND: 344 345 344 idcpacket.open.streamtype = OSS32_STREAM_FM_MIDIOUT; 345 break; 346 346 case WAVETABLE_SEND: 347 348 347 idcpacket.open.streamtype = OSS32_STREAM_WAVETABLE_MIDIOUT; 348 break; 349 349 } 350 350 ret = CallOSS32(IDC32_MIDI_OPEN, &idcpacket); … … 361 361 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 362 362 363 idcpacket.fileid 364 idcpacket.streamid 363 idcpacket.fileid = 0x666; //TODO 364 idcpacket.streamid = StreamId; 365 365 idcpacket.midiwrite.midiByte = midiByte; 366 366 return CallOSS32(IDC32_MIDI_WRITE, &idcpacket); … … 371 371 { 372 372 IDC32_PACKET idcpacket; 373 OSSRET 374 375 // 373 OSSRET ret; 374 375 // dprintf(("OSS16_MidiRead. id: %d",StreamId)); 376 376 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 377 377 378 378 if(SELECTOROF(buffer) != _SS()) 379 379 {//must be located on the stack! 380 381 380 DebugInt3(); 381 return OSSERR_INVALID_PARAMETER; 382 382 } 383 383 384 idcpacket.fileid = 0x666;//TODO385 idcpacket.streamid 384 idcpacket.fileid = 0x666; //TODO 385 idcpacket.streamid = StreamId; 386 386 idcpacket.midiread.buffer = (ULONG)buffer; 387 387 idcpacket.midiread.bufsize = bufsize; … … 397 397 IDC32_PACKET idcpacket; 398 398 OSS32_MIDICAPS midiCaps; 399 OSSRET 399 OSSRET ret; 400 400 401 401 dprintf(("OSS16_MidiQueryCaps. id: %d",streamid)); … … 530 530 { 531 531 IDC32_PACKET idcpacket; 532 OSSRET 533 534 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 535 536 idcpacket.fileid 537 idcpacket.open.devicenr 532 OSSRET ret; 533 534 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 535 536 idcpacket.fileid = 0x766; //TODO 537 idcpacket.open.devicenr = devicenr; 538 538 ret = CallOSS32(IDC32_MIXER_OPEN, &idcpacket); 539 539 *pStreamId = idcpacket.streamid; … … 560 560 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 561 561 562 idcpacket.fileid 563 idcpacket.streamid 562 idcpacket.fileid = 0x766; //TODO 563 idcpacket.streamid = StreamId; 564 564 idcpacket.mixvol.line = usLine; 565 565 idcpacket.mixvol.volume = ulVolume; … … 572 572 { 573 573 IDC32_PACKET idcpacket; 574 OSSRET 575 576 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 577 578 idcpacket.fileid 579 idcpacket.streamid 574 OSSRET ret; 575 576 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 577 578 idcpacket.fileid = 0x766; //TODO 579 idcpacket.streamid = StreamId; 580 580 idcpacket.mixvol.line = usLine; 581 581 … … 592 592 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 593 593 594 idcpacket.fileid = 0x766;//TODO595 idcpacket.streamid 594 idcpacket.fileid = 0x766; //TODO 595 idcpacket.streamid = StreamId; 596 596 idcpacket.mixprop.property = usProperty; 597 idcpacket.mixprop.value 597 idcpacket.mixprop.value = ulValue; 598 598 599 599 return CallOSS32(IDC32_MIXER_SETPROPERTY, &idcpacket); … … 603 603 OSSRET DBGCALLCONV OSS16_MixGetProperty(OSSSTREAMID StreamId, USHORT usProperty, ULONG FAR *pValue) 604 604 { 605 606 OSSRETret;607 608 609 610 idcpacket.fileid= 0x766; //TODO611 idcpacket.streamid= StreamId;612 613 614 615 616 605 IDC32_PACKET idcpacket; 606 OSSRET ret; 607 608 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 609 610 idcpacket.fileid = 0x766; //TODO 611 idcpacket.streamid = StreamId; 612 idcpacket.mixprop.property = usProperty; 613 614 ret = CallOSS32(IDC32_MIXER_GETPROPERTY, &idcpacket); 615 *pValue = idcpacket.mixprop.value; 616 return ret; 617 617 } 618 618 //****************************************************************************** … … 620 620 OSSRET DBGCALLCONV OSS16_MixQueryCaps(OSSSTREAMID Streamid, OSS32_MIXCAPS FAR *pCaps) 621 621 { 622 IDC32_PACKETidcpacket;623 624 OSSRETret;625 626 627 628 629 630 631 622 IDC32_PACKET idcpacket; 623 OSS32_MIXCAPS mixerCaps; 624 OSSRET ret; 625 626 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 627 628 idcpacket.fileid = 0x766; //TODO 629 idcpacket.streamid = Streamid; 630 idcpacket.mixcaps.pCaps = (ULONG)&mixerCaps; 631 ret = CallOSS32(IDC32_MIXER_QUERYCAPS, &idcpacket); 632 632 633 633 #ifdef DEBUG 634 635 636 637 634 if (ret == OSSERR_SUCCESS) 635 DumpMixerCaps (&mixerCaps); 636 else 637 dprintf (("IDC32_MIXER_QUERYCAPS - FAILED!")); 638 638 #endif 639 639 640 641 640 _fmemcpy(pCaps, &mixerCaps, sizeof(mixerCaps)); 641 return ret; 642 642 } 643 643 //****************************************************************************** … … 646 646 OSSRET CallOSS32(USHORT cmd, IDC32_PACKET FAR *pIDCPacket) 647 647 { 648 649 650 651 652 653 654 655 656 657 658 659 660 661 // 662 663 664 665 666 667 668 669 670 671 672 673 674 675 648 ULONG rc = 0; 649 ULONG idcptr = (ULONG)IDCTable.ProtIDCEntry; 650 ULONG idcparm; 651 652 if(idcptr == 0) 653 return OSSERR_ACCESS_DENIED; 654 655 if(SELECTOROF(pIDCPacket) != _SS()) { 656 dprintf(("CallOSS32 error. Invalid stack segment for parameters...")); 657 DebugInt3(); 658 return OSSERR_INVALID_PARAMETER; 659 } 660 661 // dprintf(("CallOSS32. cmd: %d", cmd)); 662 663 idcparm = (ULONG)pIDCPacket; 664 665 _asm { 666 pusha 667 mov cx, cmd 668 mov dx, word ptr [idcparm+2] 669 mov bx, word ptr [idcparm] 670 call dword ptr [idcptr] 671 mov word ptr rc, ax 672 mov word ptr [rc+2], dx 673 popa 674 } 675 return(rc); 676 676 } 677 677 //****************************************************************************** … … 683 683 { 684 684 IDC32_PACKET idcpacket; 685 ULONG 686 687 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 688 689 690 691 692 693 idcpacket.buffer.buffer 685 ULONG buffer; 686 687 _fmemset(&idcpacket, 0, sizeof(idcpacket)); 688 689 if (DevHelp_VirtToLin(SELECTOROF(debstr),OFFSETOF(debstr),&buffer)) 690 return OSSERR_INVALID_PARAMETER; 691 692 693 idcpacket.buffer.buffer = (ULONG)buffer; 694 694 idcpacket.buffer.size = bufsize; 695 695 return CallOSS32(IDC32_DEBUG_STRING, &idcpacket); … … 704 704 #pragma on (unreferenced) 705 705 { 706 //dprintf(("OSSIDC cmd:%lx param1:%lx param2:%lx", cmd, param1, param2)); 707 switch(cmd & 0xFFFF) 708 { 709 case IDC16_INIT: 710 break; 711 712 case IDC16_EXIT: 713 DestroyStreams(); 714 IDCTable.ProtIDCEntry = 0; 715 break; 716 case IDC16_MIDI_IRQ: 717 MPU_401::processIrq(0); 718 break; 719 720 case IDC16_CLOSE_UNI16: 721 { 722 force_closed = 1; 723 #ifdef DEBUG 724 dprintf(("IDC16_CLOSE_UNI16")); 725 #endif 726 pWavePlay->Close(0); 727 //WAVEAUDIO::WavePlayClose(); 728 break; 729 } 730 case IDC16_PROCESS: 731 { 732 PWAVESTREAM pStream; 706 //dprintf(("OSSIDC cmd:%lx param1:%lx param2:%lx", cmd, param1, param2)); 707 switch(cmd & 0xFFFF) 708 { 709 case IDC16_INIT: 710 break; 711 712 case IDC16_EXIT: 713 DestroyStreams(); 714 IDCTable.ProtIDCEntry = 0; 715 break; 716 case IDC16_MIDI_IRQ: 717 MPU_401::processIrq(0); 718 break; 719 720 case IDC16_CLOSE_UNI16: 721 { 722 force_closed = 1; 723 dprintf(("IDC16_CLOSE_UNI16")); 724 pWavePlay->Close(0); 725 //WAVEAUDIO::WavePlayClose(); 726 break; 727 } 728 case IDC16_PROCESS: 729 { 730 PWAVESTREAM pStream; 733 731 //dprintf(("IDC16_PROCESS, %d", param1)); 734 //Signal all active wave playback streams to update their status 735 pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_PLAY); 736 while(pStream) 737 { 738 pStream->Process(); 739 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream); 740 } 741 //Signal all active wave capture streams to update their status 742 pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_CAPTURE); 743 while(pStream) 744 { 745 pStream->Process(); 746 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_CAPTURE, pStream); 747 } 748 //dprintf(("IDC16_PROCESS end")); 749 break; 750 } 751 752 } 753 return 0; 732 //Signal all active wave playback streams to update their status 733 pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_PLAY); 734 while(pStream) { 735 pStream->Process(); 736 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream); 737 } 738 //Signal all active wave capture streams to update their status 739 pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_CAPTURE); 740 while(pStream) { 741 pStream->Process(); 742 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_CAPTURE, pStream); 743 } 744 //dprintf(("IDC16_PROCESS end")); 745 break; 746 } 747 748 } 749 return 0; 754 750 } 755 751 //****************************************************************************** … … 760 756 void DumpMixerCaps (LPOSS32_MIXCAPS pMixCaps) 761 757 { 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 758 dprintf (("\nMixerCaps")); 759 dprintf ((" name '%s'", pMixCaps->name)); 760 dprintf ((" fuCtrlCaps %lxh", pMixCaps->fuCtrlCaps)); 761 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_MASTER_FRONT)) 762 dprintf ((" OSS32_MIX_VOLUME_MASTER_FRONT")); 763 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_MASTER_REAR)) 764 dprintf ((" OSS32_MIX_VOLUME_MASTER_REAR")); 765 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_PCM)) 766 dprintf ((" OSS32_MIX_VOLUME_PCM")); 767 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_MIDI)) 768 dprintf ((" OSS32_MIX_VOLUME_MIDI")); 769 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_LINEIN)) 770 dprintf ((" OSS32_MIX_VOLUME_LINEIN")); 771 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_MIC)) 772 dprintf ((" OSS32_MIX_VOLUME_MIC")); 773 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_CD)) 774 dprintf ((" OSS32_MIX_VOLUME_CD")); 775 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_SPDIF)) 776 dprintf ((" OSS32_MIX_VOLUME_SPDIF")); 777 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_VIDEO)) 778 dprintf ((" OSS32_MIX_VOLUME_VIDEO")); 779 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_SPEAKER)) 780 dprintf ((" OSS32_MIX_VOLUME_SPEAKER")); 781 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_PHONE)) 782 dprintf ((" OSS32_MIX_VOLUME_PHONE")); 783 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_HEADPHONE)) 784 dprintf ((" OSS32_MIX_VOLUME_HEADPHONE")); 785 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_AUX)) 786 dprintf ((" OSS32_MIX_VOLUME_AUX")); 787 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_VOLUME_CAPTURE)) 788 dprintf ((" OSS32_MIX_VOLUME_CAPTURE")); 789 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_INPUTSRC)) 790 dprintf ((" OSS32_MIX_INPUTSRC")); 791 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_LEVEL_BASS)) 792 dprintf ((" OSS32_MIX_LEVEL_BASS")); 793 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_LEVEL_TREBLE)) 794 dprintf ((" OSS32_MIX_LEVEL_TREBLE")); 795 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_LEVEL_3DCENTER)) 796 dprintf ((" OSS32_MIX_LEVEL_3DCENTER")); 797 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_LEVEL_3DDEPTH)) 798 dprintf ((" OSS32_MIX_LEVEL_3DDEPTH")); 799 if (pMixCaps->fuCtrlCaps & OSS32_MIX_FLAG (OSS32_MIX_SWITCH_MICBOOST)) 800 dprintf ((" OSS32_MIX_SWITCH_MICBOOST")); 801 802 803 dprintf ((" fuRecCaps %lxh", pMixCaps->fuRecCaps)); 804 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_MIC)) 805 dprintf ((" OSS32_MIX_RECSRC_MIC")); 806 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_CD)) 807 dprintf ((" OSS32_MIX_RECSRC_CD")); 808 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_LINE)) 809 dprintf ((" OSS32_MIX_RECSRC_LINE")); 810 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_VIDEO)) 811 dprintf ((" OSS32_MIX_RECSRC_VIDEO")); 812 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_AUX)) 813 dprintf ((" OSS32_MIX_RECSRC_AUX")); 814 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_MIXER)) 815 dprintf ((" OSS32_MIX_RECSRC_MIXER")); 816 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_MIXER_MONO)) 817 dprintf ((" OSS32_MIX_RECSRC_MIXER_MONO")); 818 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_PHONE)) 819 dprintf ((" OSS32_MIX_RECSRC_PHONE")); 820 if (pMixCaps->fuRecCaps & OSS32_MIX_FLAG (OSS32_MIX_RECSRC_SYNTH)) 821 dprintf ((" OSS32_MIX_RECSRC_SYNTH")); 826 822 } 827 823 //****************************************************************************** … … 829 825 void DumpDeviceCaps (LPOSS32_DEVCAPS pDevCaps) 830 826 { 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 827 dprintf (("\nDeviceCaps")); 828 dprintf ((" nrDevices %d", pDevCaps->nrDevices)); 829 830 dprintf ((" ulCaps %uxh", pDevCaps->ulCaps)); 831 if (pDevCaps->ulCaps & OSS32_CAPS_WAVE_PLAYBACK) 832 dprintf ((" OSS32_CAPS_WAVE_PLAYBACK")); 833 if (pDevCaps->ulCaps & OSS32_CAPS_WAVE_CAPTURE) 834 dprintf ((" OSS32_CAPS_WAVE_CAPTURE")); 835 if (pDevCaps->ulCaps & OSS32_CAPS_FMSYNTH_PLAYBACK) 836 dprintf ((" OSS32_CAPS_FMSYNTH_PLAYBACK")); 837 if (pDevCaps->ulCaps & OSS32_CAPS_WAVETABLE_PLAYBACK) 838 dprintf ((" OSS32_CAPS_WAVETABLE_PLAYBACK")); 839 if (pDevCaps->ulCaps & OSS32_CAPS_MPU401_PLAYBACK) 840 dprintf ((" OSS32_CAPS_MPU401_PLAYBACK")); 841 if (pDevCaps->ulCaps & OSS32_CAPS_MPU401_CAPTURE) 842 dprintf ((" OSS32_CAPS_MPU401_CAPTURE")); 843 844 dprintf ((" szDeviceName %s", (char far*)pDevCaps->szDeviceName)); 845 dprintf ((" szMixerName %s", (char far*)pDevCaps->szMixerName)); 846 847 848 dprintf (("WaveOutCaps")); 849 DumpWaveCaps (&pDevCaps->waveOutCaps); 850 851 dprintf (("WaveInCaps")); 852 DumpWaveCaps (&pDevCaps->waveInCaps); 857 853 } 858 854 //****************************************************************************** … … 860 856 void DumpWaveCaps (LPWAVE_CAPS pWaveCaps) 861 857 { 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 858 dprintf ((" nrStreams %d", pWaveCaps->nrStreams)); 859 dprintf ((" ulMinChannels %ld", pWaveCaps->ulMinChannels)); 860 dprintf ((" ulMaxChannels %ld", pWaveCaps->ulMaxChannels)); 861 dprintf ((" ulChanFlags %lxh", pWaveCaps->ulChanFlags)); 862 if (pWaveCaps->ulChanFlags & OSS32_CAPS_PCM_CHAN_MONO) 863 dprintf ((" OSS32_CAPS_PCM_CHAN_MONO")); 864 if (pWaveCaps->ulChanFlags & OSS32_CAPS_PCM_CHAN_STEREO) 865 dprintf ((" OSS32_CAPS_PCM_CHAN_STEREO")); 866 if (pWaveCaps->ulChanFlags & OSS32_CAPS_PCM_CHAN_QUAD) 867 dprintf ((" OSS32_CAPS_PCM_CHAN_QUAD")); 868 if (pWaveCaps->ulChanFlags & OSS32_CAPS_PCM_CHAN_5_1) 869 dprintf ((" OSS32_CAPS_PCM_CHAN_5_1")); 870 871 872 dprintf ((" ulMinRate %ld", pWaveCaps->ulMinRate)); 873 dprintf ((" ulMaxRate %ld", pWaveCaps->ulMaxRate)); 874 875 dprintf ((" ulRateFlags %lxh", pWaveCaps->ulRateFlags)); 876 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_5512) 877 dprintf ((" OSS32_CAPS_PCM_RATE_5512")); 878 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_8000) 879 dprintf ((" OSS32_CAPS_PCM_RATE_8000")); 880 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_11025) 881 dprintf ((" OSS32_CAPS_PCM_RATE_11025")); 882 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_16000) 883 dprintf ((" OSS32_CAPS_PCM_RATE_16000")); 884 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_22050) 885 dprintf ((" OSS32_CAPS_PCM_RATE_22050")); 886 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_32000) 887 dprintf ((" OSS32_CAPS_PCM_RATE_32000")); 888 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_44100) 889 dprintf ((" OSS32_CAPS_PCM_RATE_44100")); 890 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_48000) 891 dprintf ((" OSS32_CAPS_PCM_RATE_48000")); 892 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_64000) 893 dprintf ((" OSS32_CAPS_PCM_RATE_64000")); 894 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_88200) 895 dprintf ((" OSS32_CAPS_PCM_RATE_88200")); 896 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_96000) 897 dprintf ((" OSS32_CAPS_PCM_RATE_96000")); 898 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_176400) 899 dprintf ((" OSS32_CAPS_PCM_RATE_176400")); 900 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_192000) 901 dprintf ((" OSS32_CAPS_PCM_RATE_192000")); 902 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_HALFDUPLEX) 903 dprintf ((" OSS32_CAPS_PCM_RATE_HALFDUPLEX")); 904 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_CONTINUOUS) 905 dprintf ((" OSS32_CAPS_PCM_RATE_CONTINUOUS")); 906 if (pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_KNOT) 907 dprintf ((" OSS32_CAPS_PCM_RATE_KNOT")); 908 909 910 dprintf ((" ulDataFormats %lxh", pWaveCaps->ulDataFormats)); 911 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S8) 912 dprintf ((" OSS32_CAPS_PCM_FORMAT_S8")); 913 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U8) 914 dprintf ((" OSS32_CAPS_PCM_FORMAT_U8")); 915 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S16_LE) 916 dprintf ((" OSS32_CAPS_PCM_FORMAT_S16_LE")); 917 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S16_BE) 918 dprintf ((" OSS32_CAPS_PCM_FORMAT_S16_BE")); 919 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U16_LE) 920 dprintf ((" OSS32_CAPS_PCM_FORMAT_U16_LE")); 921 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U16_BE) 922 dprintf ((" OSS32_CAPS_PCM_FORMAT_U16_BE")); 923 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S24_LE) 924 dprintf ((" OSS32_CAPS_PCM_FORMAT_S24_LE")); 925 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S24_BE) 926 dprintf ((" OSS32_CAPS_PCM_FORMAT_S24_BE")); 927 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U24_LE) 928 dprintf ((" OSS32_CAPS_PCM_FORMAT_U24_LE")); 929 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U24_BE) 930 dprintf ((" OSS32_CAPS_PCM_FORMAT_U24_BE")); 931 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S32_LE) 932 dprintf ((" OSS32_CAPS_PCM_FORMAT_S32_LE")); 933 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S32_BE) 934 dprintf ((" OSS32_CAPS_PCM_FORMAT_S32_BE")); 935 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U32_LE) 936 dprintf ((" OSS32_CAPS_PCM_FORMAT_U32_LE")); 937 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U32_BE) 938 dprintf ((" OSS32_CAPS_PCM_FORMAT_U32_BE")); 939 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW) 940 dprintf ((" OSS32_CAPS_PCM_FORMAT_MULAW")); 941 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW) 942 dprintf ((" OSS32_CAPS_PCM_FORMAT_ALAW")); 943 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM) 944 dprintf ((" OSS32_CAPS_PCM_FORMAT_ADPCM")); 945 if (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MPEG) 946 dprintf ((" OSS32_CAPS_PCM_FORMAT_MPEG")); 951 947 } 952 948 //****************************************************************************** -
OCO/branches/DAZ/drv16/waudio.cpp
r496 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% 14 14 * @notes 15 * 16 * 17 * 15 * The default for 8 bps is unsigned and signed for > 8 bps 16 * The default byte order for > 8 bps is little endian 17 * (important for devices that support both formats) 18 18 * 19 19 * @version %I% 20 20 * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit, 21 * 21 * <stack context>. 22 22 * @history 23 23 * … … 86 86 // 87 87 ULONG aaulWave[NUMFREQS][BPSTYPES][MONOSTEREO] = { 88 WAVE_FORMAT_1M08, /* 11.025kHz, 8-bitMono */89 WAVE_FORMAT_1S08, /* 11.025kHz, 8-bitStereo */90 91 92 93 94 95 96 WAVE_FORMAT_2M08, /* 22.05kHz , 8-bitMono */97 WAVE_FORMAT_2S08, /* 22.05kHz , 8-bitStereo */98 99 100 101 102 103 104 WAVE_FORMAT_4M08, /* 44.1kHz , 8-bitMono */105 WAVE_FORMAT_4S08, /* 44.1kHz , 8-bitStereo */106 107 108 109 110 111 112 WAVE_FORMAT_8M08, /* 8.0kHz , 8-bitMono */113 WAVE_FORMAT_8S08, /* 8.0kHz , 8-bitStereo */114 115 116 117 118 119 WAVE_FORMAT_8S16/* 8.0kHz , 32-bit Stereo */ //TODO: what else can we fill in?120 88 WAVE_FORMAT_1M08, /* 11.025kHz, 8-bit Mono */ 89 WAVE_FORMAT_1S08, /* 11.025kHz, 8-bit Stereo */ 90 WAVE_FORMAT_1M16, /* 11.025kHz, 16-bit Mono */ 91 WAVE_FORMAT_1S16, /* 11.025kHz, 16-bit Stereo */ 92 WAVE_FORMAT_1M16, /* 11.025kHz, 24-bit Mono */ //TODO: what else can we fill in? 93 WAVE_FORMAT_1S16, /* 11.025kHz, 24-bit Stereo */ //TODO: what else can we fill in? 94 WAVE_FORMAT_1M16, /* 11.025kHz, 32-bit Mono */ //TODO: what else can we fill in? 95 WAVE_FORMAT_1S16, /* 11.025kHz, 32-bit Stereo */ //TODO: what else can we fill in? 96 WAVE_FORMAT_2M08, /* 22.05kHz , 8-bit Mono */ 97 WAVE_FORMAT_2S08, /* 22.05kHz , 8-bit Stereo */ 98 WAVE_FORMAT_2M16, /* 22.05kHz , 16-bit Mono */ 99 WAVE_FORMAT_2S16, /* 22.05kHz , 16-bit Stereo */ 100 WAVE_FORMAT_2M16, /* 22.05kHz , 24-bit Mono */ //TODO: what else can we fill in? 101 WAVE_FORMAT_2S16, /* 22.05kHz , 24-bit Stereo */ //TODO: what else can we fill in? 102 WAVE_FORMAT_2M16, /* 22.05kHz , 32-bit Mono */ //TODO: what else can we fill in? 103 WAVE_FORMAT_2S16, /* 22.05kHz , 32-bit Stereo */ //TODO: what else can we fill in? 104 WAVE_FORMAT_4M08, /* 44.1kHz , 8-bit Mono */ 105 WAVE_FORMAT_4S08, /* 44.1kHz , 8-bit Stereo */ 106 WAVE_FORMAT_4M16, /* 44.1kHz , 16-bit Mono */ 107 WAVE_FORMAT_4S16, /* 44.1kHz , 16-bit Stereo */ 108 WAVE_FORMAT_4M16, /* 44.1kHz , 24-bit Mono */ //TODO: what else can we fill in? 109 WAVE_FORMAT_4S16, /* 44.1kHz , 24-bit Stereo */ //TODO: what else can we fill in? 110 WAVE_FORMAT_4M16, /* 44.1kHz , 32-bit Mono */ //TODO: what else can we fill in? 111 WAVE_FORMAT_4S16, /* 44.1kHz , 32-bit Stereo */ //TODO: what else can we fill in? 112 WAVE_FORMAT_8M08, /* 8.0kHz , 8-bit Mono */ 113 WAVE_FORMAT_8S08, /* 8.0kHz , 8-bit Stereo */ 114 WAVE_FORMAT_8M16, /* 8.0kHz , 16-bit Mono */ 115 WAVE_FORMAT_8S16, /* 8.0kHz , 16-bit Stereo */ 116 WAVE_FORMAT_8M16, /* 8.0kHz , 24-bit Mono */ //TODO: what else can we fill in? 117 WAVE_FORMAT_8S16, /* 8.0kHz , 24-bit Stereo */ //TODO: what else can we fill in? 118 WAVE_FORMAT_8M16, /* 8.0kHz , 32-bit Mono */ //TODO: what else can we fill in? 119 WAVE_FORMAT_8S16 /* 8.0kHz , 32-bit Stereo */ //TODO: what else can we fill in? 120 }; 121 121 122 122 // … … 125 125 // _usfind_matching_sample_rate) and the number of channels 126 126 ULONG aaulAlaw[NUMFREQS][MONOSTEREO] = { 127 ALAW_8B11KM,/* 8bit 11kHz mono*/128 ALAW_8B11KS,/* 8bit 11kHz stereo*/129 ALAW_8B22KM,/* 8bit 22kHz mono*/130 ALAW_8B22KS,/* 8bit 22kHz stereo*/131 ALAW_8B44KM,/* 8bit 44kHz mono*/132 ALAW_8B44KS,/* 8bit 44kHz stereo*/133 ALAW_8B8KM ,/* 8bit 8kHz mono*/134 ALAW_8B8KS/* 8bit 8kHz stereo*/135 127 ALAW_8B11KM, /* 8bit 11kHz mono*/ 128 ALAW_8B11KS, /* 8bit 11kHz stereo*/ 129 ALAW_8B22KM, /* 8bit 22kHz mono*/ 130 ALAW_8B22KS, /* 8bit 22kHz stereo*/ 131 ALAW_8B44KM, /* 8bit 44kHz mono*/ 132 ALAW_8B44KS, /* 8bit 44kHz stereo*/ 133 ALAW_8B8KM , /* 8bit 8kHz mono*/ 134 ALAW_8B8KS /* 8bit 8kHz stereo*/ 135 }; 136 136 // 137 137 // the following 2-D array defines the subtypes for DATATYPE_MULAW … … 139 139 // _usfind_matching_sample_rate) and the number of channels 140 140 ULONG aaulMulaw[NUMFREQS][MONOSTEREO] = { 141 MULAW_8B11KM,/* 8bit 11kHz mono*/142 MULAW_8B11KS,/* 8bit 11kHz stereo*/143 MULAW_8B22KM,/* 8bit 22kHz mono*/144 MULAW_8B22KS,/* 8bit 22kHz stereo*/145 MULAW_8B44KM,/* 8bit 44kHz mono*/146 MULAW_8B44KS,/* 8bit 44kHz stereo*/147 MULAW_8B8KM ,/* 8bit 8kHz mono*/148 MULAW_8B8KS/* 8bit 8kHz stereo*/149 141 MULAW_8B11KM, /* 8bit 11kHz mono*/ 142 MULAW_8B11KS, /* 8bit 11kHz stereo*/ 143 MULAW_8B22KM, /* 8bit 22kHz mono*/ 144 MULAW_8B22KS, /* 8bit 22kHz stereo*/ 145 MULAW_8B44KM, /* 8bit 44kHz mono*/ 146 MULAW_8B44KS, /* 8bit 44kHz stereo*/ 147 MULAW_8B8KM , /* 8bit 8kHz mono*/ 148 MULAW_8B8KS /* 8bit 8kHz stereo*/ 149 }; 150 150 151 151 // … … 161 161 162 162 WAVEAUDIO::WAVEAUDIO(ULONG devicetype, ULONG ulDeviceNr) : 163 164 { 165 166 167 163 AUDIOHW(devicetype) 164 { 165 this->ulDeviceNr = ulDeviceNr; 166 167 StreamId = 0; 168 168 } 169 169 170 170 /**@internal _usfind_matching_sample_rate 171 * @param 172 * @param 171 * @param PULONG pulSampleRate 172 * @param PULONG pSampleRates 173 173 * @return 174 174 * @notes … … 182 182 USHORT WAVEAUDIO::_usfind_matching_sample_rate(PULONG pulSampleRate, int nrSampleRates, PULONG pSampleRates) 183 183 { 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 184 ULONG ulMinDistance = 0x7fffffff; 185 USHORT usMatching; 186 USHORT us; 187 188 if(nrSampleRates == 0) { 189 nrSampleRates = 4; 190 pSampleRates = aulSuppSampleRates; 191 } 192 for ( us = 0; us < nrSampleRates; us++ ) { 193 ULONG ulDistance = distance( *pulSampleRate, pSampleRates[us] ); 194 if (ulDistance < ulMinDistance) { 195 ulMinDistance = ulDistance; 196 usMatching = us; 197 } 198 } 199 *pulSampleRate = pSampleRates[usMatching]; 200 return usMatching; 201 201 } 202 202 //****************************************************************************** … … 208 208 ULONG WAVEAUDIO::QueryDataFlags(ULONG ulOperation, ULONG ulDataType, ULONG ulBitsPerSample) 209 209 { 210 ULONG 210 ULONG ulFlags; 211 211 PWAVE_CAPS pWaveCaps; 212 212 213 ulFlags = FIXED 214 213 ulFlags = FIXED | // Fixed length data 214 LEFT_ALIGNED; // Left align bits on byte bndry (for samples < 8 bits; TODO) 215 215 216 216 if(ulOperation == OPERATION_PLAY) { 217 217 pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps; 218 218 } 219 219 else pWaveCaps = &devCaps[ulDeviceNr].waveInCaps; … … 223 223 case DATATYPE_WAVEFORM: 224 224 case PCM: 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 225 //NOTE1: The default for 8 bps is unsigned and signed for > 8 bps !!! 226 //NOTE2: The default byte order for > 8 bps is little endian 227 228 switch(ulBitsPerSample) 229 { 230 case 8: 231 //default = unsigned 232 break; 233 case 16: 234 //default = signed 235 ulFlags |= TWOS_COMPLEMENT; 236 237 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_LE)) 238 { 239 ulFlags |= BIG_ENDIAN; 240 } 241 //else little endian 242 break; 243 case 24: 244 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS_SIGNED) 245 { 246 ulFlags |= TWOS_COMPLEMENT; 247 } 248 //else unsigned 249 250 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS_LE)) 251 { 252 ulFlags |= BIG_ENDIAN; 253 } 254 //else little endian 255 break; 256 case 32: 257 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS_SIGNED) 258 { 259 ulFlags |= TWOS_COMPLEMENT; 260 } 261 //else unsigned 262 263 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS_LE)) 264 { 265 ulFlags |= BIG_ENDIAN; 266 } 267 //else little endian 268 break; 269 }//switch BPS 270 break; 271 271 272 272 case DATATYPE_ALAW: 273 273 case DATATYPE_RIFF_ALAW: 274 274 case A_LAW: 275 275 break; 276 276 277 277 case DATATYPE_MULAW: 278 278 case DATATYPE_RIFF_MULAW: 279 279 case MU_LAW: 280 280 break; 281 281 282 282 case DATATYPE_ADPCM_AVC: 283 283 case DATATYPE_CT_ADPCM: 284 284 break; 285 285 286 286 default: 287 288 287 DebugInt3(); 288 return 0; 289 289 } 290 290 return ulFlags; … … 294 294 //****************************************************************************** 295 295 ULONG WAVEAUDIO::QueryOSSDataFormat(ULONG ulOperation, ULONG ulDataType, 296 296 ULONG ulBitsPerSample) 297 297 { 298 298 ULONG ulDataFormat; … … 300 300 301 301 if(ulOperation == OPERATION_PLAY) { 302 302 pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps; 303 303 } 304 304 else pWaveCaps = &devCaps[ulDeviceNr].waveInCaps; … … 308 308 case DATATYPE_WAVEFORM: 309 309 case PCM: 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 310 //NOTE1: The default for 8 bps is unsigned and signed for > 8 bps !!! 311 //NOTE2: The default byte order for > 8 bps is little endian 312 switch(ulBitsPerSample) 313 { 314 case 8: 315 //Default is unsigned, so check that first 316 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U8) 317 { 318 ulDataFormat = OSS32_PCM_FORMAT_U8; 319 } 320 else ulDataFormat = OSS32_PCM_FORMAT_S8; 321 break; 322 323 case 16: 324 //Default is signed, so check that first 325 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_SIGNED) 326 {//signed LE or BE 327 //Default is LE, so check that first 328 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_LE) 329 { 330 ulDataFormat = OSS32_PCM_FORMAT_S16_LE; 331 } 332 else ulDataFormat = OSS32_PCM_FORMAT_S16_BE; 333 } 334 else 335 {//unsigned LE or BE 336 //Default is LE, so check that first 337 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_LE) 338 { 339 ulDataFormat = OSS32_PCM_FORMAT_U16_LE; 340 } 341 else ulDataFormat = OSS32_PCM_FORMAT_U16_BE; 342 } 343 break; 344 345 case 24: 346 //Default is signed, so check that first 347 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS_SIGNED) 348 {//signed LE or BE 349 //Default is LE, so check that first 350 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS_LE) 351 { 352 ulDataFormat = OSS32_PCM_FORMAT_S24_LE; 353 } 354 else ulDataFormat = OSS32_PCM_FORMAT_S24_BE; 355 } 356 else 357 {//unsigned LE or BE 358 //Default is LE, so check that first 359 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS_LE) 360 { 361 ulDataFormat = OSS32_PCM_FORMAT_U24_LE; 362 } 363 else ulDataFormat = OSS32_PCM_FORMAT_U24_BE; 364 } 365 break; 366 367 case 32: 368 //Default is signed, so check that first 369 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS_SIGNED) 370 {//signed LE or BE 371 //Default is LE, so check that first 372 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS_LE) 373 { 374 ulDataFormat = OSS32_PCM_FORMAT_S32_LE; 375 } 376 else ulDataFormat = OSS32_PCM_FORMAT_S32_BE; 377 } 378 else 379 {//unsigned LE or BE 380 //Default is LE, so check that first 381 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS_LE) 382 { 383 ulDataFormat = OSS32_PCM_FORMAT_U32_LE; 384 } 385 else ulDataFormat = OSS32_PCM_FORMAT_U32_BE; 386 } 387 break; 388 }//switch BPS 389 break; 390 390 391 391 case DATATYPE_ALAW: 392 392 case DATATYPE_RIFF_ALAW: 393 393 case A_LAW: 394 395 394 ulDataFormat = OSS32_PCM_FORMAT_ALAW; 395 break; 396 396 397 397 case DATATYPE_MULAW: 398 398 case DATATYPE_RIFF_MULAW: 399 399 case MU_LAW: 400 401 400 ulDataFormat = OSS32_PCM_FORMAT_MULAW; 401 break; 402 402 403 403 case DATATYPE_ADPCM_AVC: 404 404 case DATATYPE_CT_ADPCM: 405 406 405 ulDataFormat = OSS32_PCM_FORMAT_ADPCM; 406 break; 407 407 408 408 default: 409 410 411 409 dprintf(("DataFormat wrong:%x",ulBitsPerSample)); 410 DebugInt3(); 411 return 0; 412 412 } 413 413 return ulDataFormat; //flag to format type … … 417 417 //****************************************************************************** 418 418 BOOL WAVEAUDIO::SetupConversion(PWAVECONFIGINFO pConfigInfo, 419 420 421 { 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 else usConversion |= CONVERT_UNSIGNED;//unsigned to unsigned488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1560 561 // 562 563 564 565 566 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1567 568 // 569 570 571 572 573 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);//factor 2574 575 // 576 577 578 579 580 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);//factor 2581 582 // 583 584 585 586 587 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);//factor 2588 589 // 590 591 592 593 594 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);//factor 2595 596 597 598 599 600 601 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(2,0);//factor 4602 603 604 605 606 607 608 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(2,0);//factor 4609 610 611 612 613 614 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5615 616 617 618 619 620 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5621 622 623 624 625 626 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5627 628 629 630 631 632 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5633 634 635 636 637 638 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1639 640 641 642 643 644 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1645 646 647 648 649 650 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1651 652 653 654 655 656 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1657 658 659 660 661 662 663 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1664 665 666 667 668 669 670 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5671 672 673 674 675 676 677 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5678 679 680 681 682 683 684 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);//factor 2685 686 687 688 689 690 691 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);//factor 2692 693 694 695 696 697 698 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1699 700 701 702 703 704 705 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1706 707 708 709 710 711 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5712 713 714 715 716 717 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5718 719 720 721 722 723 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5724 725 726 727 728 729 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);//factor 0.5730 731 732 733 734 735 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);//factor 0.25736 737 738 739 740 741 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);//factor 0.25742 743 744 745 746 747 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);//factor 0.25748 749 750 751 752 753 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);//factor 0.25754 755 756 757 758 759 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);//factor 1760 761 762 763 764 765 766 767 768 769 //sample rate...770 771 772 773 774 775 pConfigInfo->ulFixedSampleRate= pWaveStream->GetProperty(PROPERTY_FREQUENCY);776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 419 ULONG ulOperation, ULONG ulDataType, 420 ULONG ulNumChannels, ULONG ulBitsPerSample) 421 { 422 USHORT usConversion; 423 PWAVE_CAPS pWaveCaps; 424 ULONG ulNrSampleRates; 425 426 usConversion = CONVERT_NONE; 427 428 if(ulOperation == OPERATION_PLAY) { 429 pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps; 430 } 431 else pWaveCaps = &devCaps[ulDeviceNr].waveInCaps; 432 433 //Check if hardware only supports one sample rate; if true, then we perform 434 //manual sample rate conversion before sending buffers to the ALSA driver 435 FindMatchingSampleRate(pConfigInfo->ulSampleRate, pWaveCaps->ulRateFlags, &ulNrSampleRates, &pConfigInfo->ulFixedSampleRate); 436 if(ulNrSampleRates <= 2 && pConfigInfo->ulSampleRate != pConfigInfo->ulFixedSampleRate) { 437 pConfigInfo->fSampleRateConversion = TRUE; 438 } 439 else { 440 pConfigInfo->fSampleRateConversion = FALSE; 441 } 442 443 //check if mono/stereo conversion is necessary 444 if(ulNumChannels < pWaveCaps->ulMinChannels) { 445 if(ulNumChannels == 1) { 446 if(ulOperation == OPERATION_PLAY) 447 usConversion |= CONVERT_MONO_STEREO; 448 else usConversion |= CONVERT_STEREO_MONO; 449 } 450 else DebugInt3(); 451 } 452 else 453 if(ulNumChannels > pWaveCaps->ulMaxChannels) { 454 if(ulNumChannels == 2) { 455 if(ulOperation == OPERATION_PLAY) 456 usConversion |= CONVERT_STEREO_MONO; 457 else usConversion |= CONVERT_MONO_STEREO; 458 } 459 else DebugInt3(); 460 } 461 462 //check for sample bit conversion 463 switch(ulDataType) { 464 case DATATYPE_NULL: //Warp 3 buggy data type 465 case DATATYPE_WAVEFORM: 466 case PCM: 467 switch(ulBitsPerSample) 468 { 469 case 8: 470 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_8BPS)) 471 { 472 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS)) { 473 DebugInt3(); 474 return FALSE; 475 } 476 if(ulOperation == OPERATION_PLAY) 477 usConversion |= CONVERT_8_16; 478 else usConversion |= CONVERT_16_8; 479 480 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_SIGNED) 481 { 482 if(ulOperation == OPERATION_PLAY) { 483 usConversion |= CONVERT_UNSIGNED_TO_SIGNED; 484 } 485 else usConversion |= CONVERT_SIGNED_TO_UNSIGNED; 486 } 487 else usConversion |= CONVERT_UNSIGNED; //unsigned to unsigned 488 } 489 else 490 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U8) && 491 (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_S8)) 492 { 493 if(ulOperation == OPERATION_PLAY) 494 usConversion |= (CONVERT_UNSIGNED_TO_SIGNED | CONVERT_8BPS); 495 else usConversion |= (CONVERT_SIGNED_TO_UNSIGNED | CONVERT_8BPS); 496 } 497 else { 498 if(usConversion != CONVERT_NONE) { 499 usConversion |= (CONVERT_8BPS | CONVERT_UNSIGNED); 500 } 501 } 502 break; 503 504 case 16: 505 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS)) 506 { 507 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_8BPS)) { 508 DebugInt3(); 509 return FALSE; 510 } 511 if(ulOperation == OPERATION_PLAY) 512 usConversion |= CONVERT_16_8; 513 else usConversion |= CONVERT_8_16; 514 515 if(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_U8) 516 { 517 if(ulOperation == OPERATION_PLAY) { 518 usConversion |= CONVERT_SIGNED_TO_UNSIGNED; 519 } 520 else usConversion |= CONVERT_UNSIGNED_TO_SIGNED; 521 } 522 else usConversion |= CONVERT_SIGNED; //signed to signed 523 } 524 else 525 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_SIGNED) && 526 (pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_16BPS_UNSIGNED)) 527 { 528 if(ulOperation == OPERATION_PLAY) 529 usConversion |= (CONVERT_SIGNED_TO_UNSIGNED | CONVERT_16BPS); 530 else usConversion |= (CONVERT_UNSIGNED_TO_SIGNED | CONVERT_16BPS); 531 } 532 else { 533 if(usConversion != CONVERT_NONE) { 534 usConversion |= (CONVERT_16BPS | CONVERT_SIGNED); 535 } 536 } 537 break; 538 } 539 break; 540 541 case DATATYPE_ALAW: 542 case DATATYPE_RIFF_ALAW: 543 case A_LAW: 544 case DATATYPE_MULAW: 545 case DATATYPE_RIFF_MULAW: 546 case MU_LAW: 547 case DATATYPE_ADPCM_AVC: 548 case DATATYPE_CT_ADPCM: 549 default: 550 DebugInt3(); 551 return FALSE; 552 } 553 554 pConfigInfo->usConversion = usConversion; 555 556 switch(usConversion) { 557 case CONVERT_NONE: 558 pConfigInfo->usConversion = CONVERT_NONE; 559 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 560 pConfigInfo->pfnConvert = ConvertNone; 561 // dprintf(("CNV_NONE")); 562 break; 563 564 case CONVERT_8_UNSIGNED_TO_8_SIGNED: 565 case CONVERT_8_SIGNED_TO_8_UNSIGNED: 566 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 567 pConfigInfo->pfnConvert = Convert8To8SignChange; 568 // dprintf(("CNV_8_U_TO_8_S/CNV_8_S_TO_8_U")); 569 break; 570 571 case CONVERT_8_UNSIGNED_TO_8_UNSIGNED_MONO_STEREO: 572 case CONVERT_8_SIGNED_TO_8_SIGNED_MONO_STEREO: 573 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0); //factor 2 574 pConfigInfo->pfnConvert = Convert8MonoTo8Stereo; 575 // dprintf(("CNV_8_U_TO_8_U_MN_ST/CNV_8_S_TO_8_S_MN_ST")); 576 break; 577 578 case CONVERT_8_SIGNED_TO_8_UNSIGNED_MONO_STEREO: 579 case CONVERT_8_UNSIGNED_TO_8_SIGNED_MONO_STEREO: 580 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0); //factor 2 581 pConfigInfo->pfnConvert = Convert8MonoTo8StereoSignChange; 582 // dprintf(("CNV_8_S_TO_8_U_MN_ST/CNV_8_U_TO_8_S_MN_ST")); 583 break; 584 585 case CONVERT_8_SIGNED_TO_16_SIGNED: 586 case CONVERT_8_UNSIGNED_TO_16_UNSIGNED: 587 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0); //factor 2 588 pConfigInfo->pfnConvert = Convert8To16; 589 // dprintf(("CNV_8_S_TO_16_S/CNV_8_U_TO_16_U")); 590 break; 591 592 case CONVERT_8_SIGNED_TO_16_UNSIGNED: 593 case CONVERT_8_UNSIGNED_TO_16_SIGNED: 594 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0); //factor 2 595 pConfigInfo->pfnConvert = Convert8To16SignChange; 596 //dprintf(("CNV_8_S_TO_16_U/CNV_8_U_TO_16_S")); 597 break; 598 599 case CONVERT_8_SIGNED_TO_16_SIGNED_MONO_STEREO: 600 case CONVERT_8_UNSIGNED_TO_16_UNSIGNED_MONO_STEREO: 601 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(2,0); //factor 4 602 pConfigInfo->pfnConvert = Convert8MonoTo16Stereo; 603 //dprintf(("CNV_8_S_TO_16_S_MN_ST/CNV_8_U_TO_16_U_MN_ST")); 604 break; 605 606 case CONVERT_8_SIGNED_TO_16_UNSIGNED_MONO_STEREO: 607 case CONVERT_8_UNSIGNED_TO_16_SIGNED_MONO_STEREO: 608 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(2,0); //factor 4 609 pConfigInfo->pfnConvert = Convert8MonoTo16StereoSignChange; 610 //dprintf(("CNV_8_S_TO_16_U_MN_ST/CNV_8_U_TO_16_S_MN_ST")); 611 break; 612 613 case CONVERT_8_UNSIGNED_TO_8_UNSIGNED_STEREO_MONO: 614 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 615 pConfigInfo->pfnConvert = Convert8UnsignedTo8UnsignedStereoMono; 616 //dprintf(("CNV_8_U_TO_8_U_ST_MN")); 617 break; 618 619 case CONVERT_8_SIGNED_TO_8_SIGNED_STEREO_MONO: 620 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 621 pConfigInfo->pfnConvert = Convert8SignedTo8SignedStereoMono; 622 //dprintf(("CNV_8_S_TO_8_S_ST_MN")); 623 break; 624 625 case CONVERT_8_UNSIGNED_TO_8_SIGNED_STEREO_MONO: 626 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 627 pConfigInfo->pfnConvert = Convert8UnsignedTo8SignedStereoMono; 628 //dprintf(("CNV_8_U_TO_8_S_ST_MN")); 629 break; 630 631 case CONVERT_8_SIGNED_TO_8_UNSIGNED_STEREO_MONO: 632 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 633 pConfigInfo->pfnConvert = Convert8SignedTo8UnsignedStereoMono; 634 //dprintf(("CNV_8_S_TO_8_U_ST_MN")); 635 break; 636 637 case CONVERT_8_UNSIGNED_TO_16_UNSIGNED_STEREO_MONO: 638 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 639 pConfigInfo->pfnConvert = Convert8UnsignedTo16UnsignedStereoMono; 640 //dprintf(("CNV_8_U_TO_16_U_ST_MN")); 641 break; 642 643 case CONVERT_8_UNSIGNED_TO_16_SIGNED_STEREO_MONO: 644 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 645 pConfigInfo->pfnConvert = Convert8UnsignedTo16SignedStereoMono; 646 //dprintf(("CNV_8_U_TO_16_S_ST_MN")); 647 break; 648 649 case CONVERT_8_SIGNED_TO_16_SIGNED_STEREO_MONO: 650 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 651 pConfigInfo->pfnConvert = Convert8SignedTo16SignedStereoMono; 652 //dprintf(("CNV_8_S_TO_16_S_ST_MN")); 653 break; 654 655 case CONVERT_8_SIGNED_TO_16_UNSIGNED_STEREO_MONO: 656 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 657 pConfigInfo->pfnConvert = Convert8SignedTo16UnsignedStereoMono; 658 //dprintf(("CNV_8_S_TO_16_U_ST_MN")); 659 break; 660 661 case CONVERT_16_UNSIGNED_TO_16_SIGNED: 662 case CONVERT_16_SIGNED_TO_16_UNSIGNED: 663 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 664 pConfigInfo->pfnConvert = Convert16To16SignChange; 665 //dprintf(("CNV_16_U_TO_16_S/CNV_16_S_TO_16_U")); 666 break; 667 668 case CONVERT_16_UNSIGNED_TO_8_UNSIGNED: 669 case CONVERT_16_SIGNED_TO_8_SIGNED: 670 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 671 pConfigInfo->pfnConvert = Convert16To8; 672 //dprintf(("CNV_16_U_TO_8_U/CNV_16_S_TO_8_S")); 673 break; 674 675 case CONVERT_16_UNSIGNED_TO_8_SIGNED: 676 case CONVERT_16_SIGNED_TO_8_UNSIGNED: 677 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 678 pConfigInfo->pfnConvert = Convert16To8SignChange; 679 //dprintf(("CNV_16_U_TO_8_S/CNV_16_S_TO_8_U")); 680 break; 681 682 case CONVERT_16_UNSIGNED_TO_16_UNSIGNED_MONO_STEREO: 683 case CONVERT_16_SIGNED_TO_16_SIGNED_MONO_STEREO: 684 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0); //factor 2 685 pConfigInfo->pfnConvert = Convert16MonoTo16Stereo; 686 //dprintf(("CNV_16_U_TO_16_U_MN_ST/CNV_16_S_TO_16_S_MN_ST")); 687 break; 688 689 case CONVERT_16_UNSIGNED_TO_16_SIGNED_MONO_STEREO: 690 case CONVERT_16_SIGNED_TO_16_UNSIGNED_MONO_STEREO: 691 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0); //factor 2 692 pConfigInfo->pfnConvert = Convert16MonoTo16StereoSignChange; 693 //dprintf(("CNV_16_U_TO_16_S_MN_ST/CNV_16_S_TO_16_U_MN_ST")); 694 break; 695 696 case CONVERT_16_UNSIGNED_TO_8_UNSIGNED_MONO_STEREO: 697 case CONVERT_16_SIGNED_TO_8_UNSIGNED_MONO_STEREO: 698 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 699 pConfigInfo->pfnConvert = Convert16MonoTo8Stereo; 700 //dprintf(("CNV_16_U_TO_8_U_MONO_ST/CNV_16_S_TO_8_U_MN_ST")); 701 break; 702 703 case CONVERT_16_UNSIGNED_TO_8_SIGNED_MONO_STEREO: 704 case CONVERT_16_SIGNED_TO_8_SIGNED_MONO_STEREO: 705 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 706 pConfigInfo->pfnConvert = Convert16MonoTo8StereoSignChange; 707 //dprintf(("CNV_16_U_TO_8_S_MN_ST/CNV_16_S_TO_8_S_MN_ST")); 708 break; 709 710 case CONVERT_16_UNSIGNED_TO_16_SIGNED_STEREO_MONO: 711 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 712 pConfigInfo->pfnConvert = Convert16UnsignedTo16SignedStereoMono; 713 //dprintf(("CNV_16_U_TO_16_S_ST_MN")); 714 break; 715 716 case CONVERT_16_UNSIGNED_TO_16_UNSIGNED_STEREO_MONO: 717 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 718 pConfigInfo->pfnConvert = Convert16UnsignedTo16UnsignedStereoMono; 719 //dprintf(("CNV_16_U_TO_16_U_ST_MN")); 720 break; 721 722 case CONVERT_16_SIGNED_TO_16_SIGNED_STEREO_MONO: 723 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 724 pConfigInfo->pfnConvert = Convert16SignedTo16SignedStereoMono; 725 //dprintf(("CNV_16_S_TO_16_S_ST_MN")); 726 break; 727 728 case CONVERT_16_SIGNED_TO_16_UNSIGNED_STEREO_MONO: 729 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1); //factor 0.5 730 pConfigInfo->pfnConvert = Convert16SignedTo16UnsignedStereoMono; 731 //dprintf(("CNV_16_S_TO_16_U_ST_MN")); 732 break; 733 734 case CONVERT_16_UNSIGNED_TO_8_UNSIGNED_STEREO_MONO: 735 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2); //factor 0.25 736 pConfigInfo->pfnConvert = Convert16UnsignedTo8UnsignedStereoMono; 737 //dprintf(("CNV_16_U_TO_8_U_ST_MN")); 738 break; 739 740 case CONVERT_16_UNSIGNED_TO_8_SIGNED_STEREO_MONO: 741 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2); //factor 0.25 742 pConfigInfo->pfnConvert = Convert16UnsignedTo8SignedStereoMono; 743 //dprintf(("CNV_16_U_TO_8_S_ST_MN")); 744 break; 745 746 case CONVERT_16_SIGNED_TO_8_SIGNED_STEREO_MONO: 747 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2); //factor 0.25 748 pConfigInfo->pfnConvert = Convert16SignedTo8SignedStereoMono; 749 //dprintf(("CNV_16_S_TO_8_S_ST_MN")); 750 break; 751 752 case CONVERT_16_SIGNED_TO_8_UNSIGNED_STEREO_MONO: 753 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2); //factor 0.25 754 pConfigInfo->pfnConvert = Convert16SignedTo8UnsignedStereoMono; 755 //dprintf(("CNV_16_S_TO_8_U_ST_MN")); 756 break; 757 758 default: 759 pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0); //factor 1 760 pConfigInfo->pfnConvert = NULL; 761 DebugInt3(); 762 return FALSE; 763 } 764 765 dprintf(("Cnv factor %lx", pConfigInfo->ulConversionFactor)); 766 767 //Some hardware can't do full duplex with different sample rates (e.g. ALS4000) 768 //NOTE: This isn't going to be pretty if the other active stream has a much lower 769 // sample rate... 770 if(pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_HALFDUPLEX) { 771 WAVESTREAM *pWaveStream; 772 773 pWaveStream = (WAVESTREAM *)FindActiveStream((ulOperation == OPERATION_PLAY) ? STREAM_WAVE_CAPTURE : STREAM_WAVE_PLAY); 774 if(pWaveStream != NULL) { 775 pConfigInfo->ulFixedSampleRate = pWaveStream->GetProperty(PROPERTY_FREQUENCY); 776 pConfigInfo->fSampleRateConversion = TRUE; 777 dprintf(("Force sample rate cnv for legacy hardware -> %d", pConfigInfo->ulFixedSampleRate)); 778 } 779 } 780 781 if(pConfigInfo->fSampleRateConversion) 782 { 783 if(QuerySampleFormat(ulOperation, pConfigInfo) == TRUE) 784 { 785 if(pConfigInfo->ulHwBitsPerSample == 8) { 786 if(pConfigInfo->ulHwNumChannels == 2) { 787 pConfigInfo->pfnSRateConv = SRateConvert8Stereo; 788 } 789 else pConfigInfo->pfnSRateConv = SRateConvert8Mono; 790 } 791 else 792 if(pConfigInfo->ulHwBitsPerSample == 16) { 793 if(pConfigInfo->ulHwNumChannels == 2) { 794 pConfigInfo->pfnSRateConv = SRateConvert16Stereo; 795 } 796 else pConfigInfo->pfnSRateConv = SRateConvert16Mono; 797 } 798 else { 799 pConfigInfo->pfnSRateConv = NULL; 800 DebugInt3(); 801 } 802 pConfigInfo->ulSRatePosition = 0; 803 if(ulOperation == OPERATION_PLAY) { 804 pConfigInfo->ulSRateIncrement = SRATE_CALC_INCREMENT(pConfigInfo->ulFixedSampleRate, pConfigInfo->ulSampleRate); 805 } 806 else pConfigInfo->ulSRateIncrement = SRATE_CALC_INCREMENT_INVERT(pConfigInfo->ulFixedSampleRate, pConfigInfo->ulSampleRate); 807 808 dprintf(("Sample rate cnv: increment %ld", pConfigInfo->ulSRateIncrement)); 809 } 810 else { 811 pConfigInfo->pfnSRateConv = NULL; 812 DebugInt3(); 813 return FALSE; 814 } 815 } 816 return TRUE; 817 817 } 818 818 //****************************************************************************** … … 822 822 BOOL WAVEAUDIO::QuerySampleFormat(ULONG ulOperation, PWAVECONFIGINFO pConfigInfo) 823 823 { 824 825 826 827 828 829 830 824 if(pConfigInfo->ulHwBitsPerSample) { 825 //already determined; 826 return TRUE; 827 } 828 if(pConfigInfo->fSampleRateConversion) 829 { 830 pConfigInfo->ulHwSampleRate = pConfigInfo->ulFixedSampleRate; 831 831 #ifdef DEBUG 832 832 dprintf(("WA::QuerySampleFormat: SampleRate1 %d", pConfigInfo->ulHwSampleRate)); 833 833 #endif 834 835 836 837 834 } 835 else 836 { 837 pConfigInfo->ulHwSampleRate = pConfigInfo->ulSampleRate; 838 838 #ifdef DEBUG 839 839 dprintf(("WA::QuerySampleFormat: SampleRate2 %d", pConfigInfo->ulHwSampleRate)); 840 840 #endif 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 841 } 842 843 pConfigInfo->ulHwBitsPerSample = pConfigInfo->ulBitsPerSample; 844 pConfigInfo->ulHwNumChannels = pConfigInfo->ulNumChannels; 845 846 switch(pConfigInfo->usConversion) { 847 case CONVERT_NONE: 848 case CONVERT_8_UNSIGNED_TO_8_SIGNED: 849 case CONVERT_8_SIGNED_TO_8_UNSIGNED: 850 case CONVERT_16_UNSIGNED_TO_16_SIGNED: 851 case CONVERT_16_SIGNED_TO_16_UNSIGNED: 852 //no change 853 break; 854 855 case CONVERT_8_UNSIGNED_TO_8_SIGNED_MONO_STEREO: 856 case CONVERT_8_SIGNED_TO_8_UNSIGNED_MONO_STEREO: 857 case CONVERT_8_UNSIGNED_TO_8_UNSIGNED_MONO_STEREO: 858 case CONVERT_8_SIGNED_TO_8_SIGNED_MONO_STEREO: 859 case CONVERT_16_UNSIGNED_TO_16_SIGNED_MONO_STEREO: 860 case CONVERT_16_SIGNED_TO_16_UNSIGNED_MONO_STEREO: 861 case CONVERT_16_UNSIGNED_TO_16_UNSIGNED_MONO_STEREO: 862 case CONVERT_16_SIGNED_TO_16_SIGNED_MONO_STEREO: 863 if(ulOperation == OPERATION_PLAY) { 864 pConfigInfo->ulHwNumChannels = 2; 865 } 866 else pConfigInfo->ulHwNumChannels = 1; 867 break; 868 869 case CONVERT_8_UNSIGNED_TO_8_SIGNED_STEREO_MONO: 870 case CONVERT_8_SIGNED_TO_8_UNSIGNED_STEREO_MONO: 871 case CONVERT_8_UNSIGNED_TO_8_UNSIGNED_STEREO_MONO: 872 case CONVERT_8_SIGNED_TO_8_SIGNED_STEREO_MONO: 873 case CONVERT_16_UNSIGNED_TO_16_UNSIGNED_STEREO_MONO: 874 case CONVERT_16_SIGNED_TO_16_SIGNED_STEREO_MONO: 875 case CONVERT_16_UNSIGNED_TO_16_SIGNED_STEREO_MONO: 876 case CONVERT_16_SIGNED_TO_16_UNSIGNED_STEREO_MONO: 877 if(ulOperation == OPERATION_PLAY) { 878 pConfigInfo->ulHwNumChannels = 1; 879 } 880 else pConfigInfo->ulHwNumChannels = 2; 881 break; 882 883 case CONVERT_8_UNSIGNED_TO_16_UNSIGNED: 884 case CONVERT_8_UNSIGNED_TO_16_SIGNED: 885 case CONVERT_8_SIGNED_TO_16_SIGNED: 886 case CONVERT_8_SIGNED_TO_16_UNSIGNED: 887 if(ulOperation == OPERATION_PLAY) { 888 pConfigInfo->ulHwBitsPerSample = 16; 889 } 890 else pConfigInfo->ulHwBitsPerSample = 8; 891 break; 892 893 case CONVERT_8_UNSIGNED_TO_16_UNSIGNED_STEREO_MONO: 894 case CONVERT_8_UNSIGNED_TO_16_SIGNED_STEREO_MONO: 895 case CONVERT_8_SIGNED_TO_16_SIGNED_STEREO_MONO: 896 case CONVERT_8_SIGNED_TO_16_UNSIGNED_STEREO_MONO: 897 if(ulOperation == OPERATION_PLAY) { 898 pConfigInfo->ulHwBitsPerSample = 16; 899 pConfigInfo->ulHwNumChannels = 1; 900 } 901 else { 902 pConfigInfo->ulHwBitsPerSample = 8; 903 pConfigInfo->ulHwNumChannels = 2; 904 } 905 break; 906 907 case CONVERT_8_UNSIGNED_TO_16_UNSIGNED_MONO_STEREO: 908 case CONVERT_8_UNSIGNED_TO_16_SIGNED_MONO_STEREO: 909 case CONVERT_8_SIGNED_TO_16_SIGNED_MONO_STEREO: 910 case CONVERT_8_SIGNED_TO_16_UNSIGNED_MONO_STEREO: 911 if(ulOperation == OPERATION_PLAY) { 912 pConfigInfo->ulHwBitsPerSample = 16; 913 pConfigInfo->ulHwNumChannels = 2; 914 } 915 else { 916 pConfigInfo->ulHwBitsPerSample = 8; 917 pConfigInfo->ulHwNumChannels = 1; 918 } 919 break; 920 921 case CONVERT_16_UNSIGNED_TO_8_UNSIGNED: 922 case CONVERT_16_UNSIGNED_TO_8_SIGNED: 923 case CONVERT_16_SIGNED_TO_8_SIGNED: 924 case CONVERT_16_SIGNED_TO_8_UNSIGNED: 925 if(ulOperation == OPERATION_PLAY) { 926 pConfigInfo->ulHwBitsPerSample = 8; 927 } 928 else pConfigInfo->ulHwBitsPerSample = 16; 929 break; 930 931 case CONVERT_16_UNSIGNED_TO_8_UNSIGNED_MONO_STEREO: 932 case CONVERT_16_UNSIGNED_TO_8_SIGNED_MONO_STEREO: 933 case CONVERT_16_SIGNED_TO_8_SIGNED_MONO_STEREO: 934 case CONVERT_16_SIGNED_TO_8_UNSIGNED_MONO_STEREO: 935 if(ulOperation == OPERATION_PLAY) { 936 pConfigInfo->ulHwBitsPerSample = 8; 937 pConfigInfo->ulHwNumChannels = 2; 938 } 939 else { 940 pConfigInfo->ulHwBitsPerSample = 16; 941 pConfigInfo->ulHwNumChannels = 1; 942 } 943 break; 944 945 case CONVERT_16_UNSIGNED_TO_8_UNSIGNED_STEREO_MONO: 946 case CONVERT_16_UNSIGNED_TO_8_SIGNED_STEREO_MONO: 947 case CONVERT_16_SIGNED_TO_8_SIGNED_STEREO_MONO: 948 case CONVERT_16_SIGNED_TO_8_UNSIGNED_STEREO_MONO: 949 if(ulOperation == OPERATION_PLAY) { 950 pConfigInfo->ulHwBitsPerSample = 8; 951 pConfigInfo->ulHwNumChannels = 1; 952 } 953 else { 954 pConfigInfo->ulHwBitsPerSample = 16; 955 pConfigInfo->ulHwNumChannels = 2; 956 } 957 break; 958 959 default: 960 DebugInt3(); 961 return FALSE; 962 } 963 964 pConfigInfo->ulHwSampleSize = (pConfigInfo->ulHwBitsPerSample * pConfigInfo->ulHwNumChannels) / 8; 965 return TRUE; 966 966 } 967 967 //****************************************************************************** … … 969 969 //****************************************************************************** 970 970 ULONG WAVEAUDIO::FindMatchingSampleRate(ULONG ulSampleRate, ULONG ulOSSSRateFlags, 971 972 { 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 971 ULONG FAR *pulNrSampleRates, ULONG FAR *pulFixedSampleRate) 972 { 973 ULONG sampleRates[31]; 974 int nrSampleRates = 0; 975 976 if(pulFixedSampleRate) { 977 *pulFixedSampleRate = -1; 978 } 979 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_5512) { 980 sampleRates[nrSampleRates++] = 5512; 981 } 982 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_8000) { 983 sampleRates[nrSampleRates++] = 8000; 984 } 985 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_11025) { 986 sampleRates[nrSampleRates++] = 11025; 987 } 988 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_16000) { 989 sampleRates[nrSampleRates++] = 16000; 990 } 991 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_22050) { 992 sampleRates[nrSampleRates++] = 22050; 993 } 994 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_32000) { 995 sampleRates[nrSampleRates++] = 32000; 996 } 997 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_44100) { 998 sampleRates[nrSampleRates++] = 44100; 999 } 1000 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_48000) { 1001 sampleRates[nrSampleRates++] = 48000; 1002 } 1003 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_64000) { 1004 sampleRates[nrSampleRates++] = 64000; 1005 } 1006 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_88200) { 1007 sampleRates[nrSampleRates++] = 88200; 1008 } 1009 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_96000) { 1010 sampleRates[nrSampleRates++] = 96000; 1011 } 1012 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_176400) { 1013 sampleRates[nrSampleRates++] = 176400; 1014 } 1015 if(ulOSSSRateFlags & OSS32_CAPS_PCM_RATE_192000) { 1016 sampleRates[nrSampleRates++] = 192000; 1017 } 1018 if(nrSampleRates > 2) { 1019 _usfind_matching_sample_rate(&ulSampleRate, nrSampleRates, (ULONG FAR *)sampleRates); 1020 } 1021 else { 1022 //fixed rate -> we support all sample rates by manually performing sample rate conversion 1023 if(nrSampleRates <= 2 && pulFixedSampleRate) { 1024 //sampleRates[0] = 44100; /* hardware set to 44100 */ 1025 *pulFixedSampleRate = sampleRates[0]; 1026 nrSampleRates = 1; 1027 } 1028 } 1029 1030 *pulNrSampleRates = nrSampleRates; 1031 return ulSampleRate; 1032 1032 } 1033 1033 … … 1040 1040 void WAVEAUDIO::DevCaps(PAUDIO_CAPS pCaps) 1041 1041 { 1042 USHORT usSampleRateIndex; 1043 ULONG ulSampleRate; 1044 PWAVE_CAPS pWaveCaps; 1045 1042 USHORT usSampleRateIndex; 1043 ULONG ulSampleRate; 1044 PWAVE_CAPS pWaveCaps; 1045 1046 dprintf(("WAVEAUDIO::DevCaps1")); 1047 1048 pCaps->ulFlags = 0; 1049 1050 // This device driver supports Playback or Record Operations 1051 // anything else makes no sence. Note: This a per stream operation so 1052 // even if this sevice can do full-duplex, it can not do PLAY_AND_RECORD 1053 1054 if ( pCaps->ulOperation != OPERATION_PLAY && 1055 pCaps->ulOperation != OPERATION_RECORD ) 1056 { 1057 dprintf(("DevCaps1 not play/record")); 1058 pCaps->ulSupport = UNSUPPORTED_OPERATION; 1059 return; 1060 } 1061 1062 if(pCaps->ulOperation == OPERATION_PLAY) 1063 { 1064 pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps; 1065 } 1066 else pWaveCaps = &devCaps[ulDeviceNr].waveInCaps; 1067 1068 // We always support stereo and mono 1069 if (pCaps->ulChannels != 1 && pCaps->ulChannels != 2) 1070 { 1071 if(pCaps->ulChannels > pWaveCaps->ulMaxChannels) 1072 { 1073 dprintf(("DevCaps1 not channel")); 1074 pCaps->ulSupport = UNSUPPORTED_CHANNELS; 1075 return; 1076 } 1077 } 1078 if (pCaps->ulSamplingRate == 0) 1079 { 1080 dprintf(("DevCaps1 not rate")); 1081 pCaps->ulSupport = UNSUPPORTED_RATE; 1082 return; 1083 } 1084 1085 //Determine supported rates 1086 ulSampleRate = pCaps->ulSamplingRate; //save the sampling rate called with 1087 1088 if(pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_CONTINUOUS) 1089 {//supports all sample rates from min to max 1090 if (ulSampleRate < pWaveCaps->ulMinRate) { 1091 ulSampleRate = pWaveCaps->ulMinRate; 1092 } 1093 else 1094 if(ulSampleRate > pWaveCaps->ulMaxRate) { 1095 ulSampleRate = pWaveCaps->ulMaxRate; 1096 } 1097 } 1098 else { 1099 ULONG ulNrSampleRates; 1100 1101 ulSampleRate = FindMatchingSampleRate(ulSampleRate, pWaveCaps->ulRateFlags, &ulNrSampleRates); 1102 } 1103 1104 // If we don't support the requested samplerate, then fill in the best fit flag. 1105 if (ulSampleRate != pCaps->ulSamplingRate) 1106 pCaps->ulFlags |= BESTFIT_PROVIDED; 1107 1108 // find out the closest sampling rate (may or may not be the same ) 1109 // from one of the following: 11025Hz, 22050Hz, 44100Hz and 8000Hz 1110 // _usfind_matching_sample_rate will update pCaps->ulSamplingRate if there 1111 // is not an exact match. 1112 usSampleRateIndex = _usfind_matching_sample_rate(&pCaps->ulSamplingRate); 1113 1114 //query flags for this wave data format 1115 pCaps->ulFlags |= QueryDataFlags(pCaps->ulOperation, pCaps->ulDataType, pCaps->ulBitsPerSample); 1116 1117 // Determine the ulDataSubType and update any format specific flags 1118 // Note: All data types have more than one value. 1119 switch ( pCaps->ulDataType ) 1120 { 1121 case DATATYPE_NULL: //Warp 3 buggy data type 1122 case DATATYPE_WAVEFORM: 1123 case PCM: 1124 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1125 // and 16 (for 2's complement PCM) 1126 switch(pCaps->ulBitsPerSample) { 1127 case 8: 1128 case 16: 1129 //NOTE: We always support 8 & 16 bits playback & recording; if the card 1130 // can't handle one of these formats, then we'll convert the 1131 // wave data ourselves (same for mono/stereo). 1132 break; 1133 case 24: 1134 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS)) 1135 { 1136 dprintf(("DevCaps1 not 24BPS")); 1137 pCaps->ulSupport = UNSUPPORTED_BPS; 1138 return; 1139 } 1140 break; 1141 case 32: 1142 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS)) 1143 { 1144 pCaps->ulSupport = UNSUPPORTED_BPS; 1145 dprintf(("DevCaps1 not 32BPS")); 1146 return; 1147 } 1148 break; 1149 default: 1150 dprintf(("DevCaps1 not BPS %d",(USHORT)pCaps->ulBitsPerSample)); 1151 pCaps->ulSupport = UNSUPPORTED_BPS; 1152 return; 1153 } 1154 1155 // determine subtype for PCM: 1156 pCaps->ulDataSubType = aaulWave[usSampleRateIndex] 1157 [(pCaps->ulBitsPerSample-8)/8] 1158 [pCaps->ulChannels-1]; 1159 break; 1160 1161 case DATATYPE_ALAW: 1162 case DATATYPE_RIFF_ALAW: 1163 case A_LAW: 1164 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW)) 1165 { 1166 dprintf(("DevCaps1 not ALAW")); 1167 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1168 return; 1169 } 1170 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1171 if (pCaps->ulBitsPerSample != 8) 1172 { 1173 dprintf(("DevCaps1 not ALAW BPS8")); 1174 pCaps->ulSupport = UNSUPPORTED_BPS; 1175 return; 1176 } 1177 // determine subtype for A_LAW 1178 pCaps->ulDataSubType = aaulAlaw[usSampleRateIndex][pCaps->ulChannels-1]; 1179 break; 1180 1181 case DATATYPE_MULAW: 1182 case DATATYPE_RIFF_MULAW: 1183 case MU_LAW: 1184 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW)) 1185 { 1186 dprintf(("DevCaps1 not MULAW")); 1187 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1188 return; 1189 } 1190 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1191 if (pCaps->ulBitsPerSample != 8) 1192 { 1193 dprintf(("DevCaps1 not MULAW BPS8")); 1194 pCaps->ulSupport = UNSUPPORTED_BPS; 1195 return; 1196 } 1197 // determine subtype for MU_LAW 1198 pCaps->ulDataSubType = aaulMulaw[usSampleRateIndex][pCaps->ulChannels-1]; 1199 break; 1200 1201 case DATATYPE_ADPCM_AVC: 1202 case DATATYPE_CT_ADPCM: 1203 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM)) 1204 { 1205 dprintf(("DevCaps1 not ADPCM")); 1206 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1207 return; 1208 } 1209 // supported bits per sample are 4 1210 if (pCaps->ulBitsPerSample != 4) 1211 { 1212 dprintf(("DevCaps1 not ADPCM BPS4")); 1213 pCaps->ulSupport = UNSUPPORTED_BPS; 1214 return; 1215 } 1216 // determine subtype for ADPCM 1217 pCaps->ulDataSubType = aaulMulaw[usSampleRateIndex][pCaps->ulChannels-1]; 1218 break; 1219 1220 default: 1221 dprintf(("DevCaps1 not dattype")); 1222 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1223 return; 1224 } // end switch 1225 1226 pCaps->ulFlags |= FIXED | // Fixed length data 1227 LEFT_ALIGNED | // Left align bits on byte bndry 1228 INPUT | // Input select is supported 1229 OUTPUT | // Output select is supported 1230 MONITOR | // Monitor is supported 1231 VOLUME; // Volume control is supported 1232 1233 // Full Duplex Enabling Stuff here !! 1234 // The number of resource units is described in the MMPM2.INI 1235 // This can be thought of the number of active streams the 1236 // driver can manage at one time. We list this number as 2. 1237 // we tell MMPM here how many of these units THIS stream will consume. 1238 // The answer is so simple it's brilliant, (Thanks to Joe Nord at Crystal 1239 // Semi) If we are enabled to do full-duplex this stream will consume 1 1240 // unit, If we are not enabled to do full-duplex this stream will consume 2 1241 // (or all the available units) 1242 // Along with the resource units, we defined 2 resources classes, 1243 // one for playback and one for capture. We tell MMPM (in the MMPM2.INI) 1244 // that we can handle doing 1 playback and 1 capture stream or 1 capture and 1245 // one playback stream at the same time. (Valid Resource combos in the 1246 // MMPM2.INI) check if we are a playback or capture and set the correct 1247 // resource class (Playback = 1, Capture = 2) 1248 1249 if(pCaps->ulOperation == OPERATION_PLAY) 1250 { 1251 if(pWaveCaps->nrStreams) { 1252 pCaps->ulResourceUnits = OSS32_MAX_WAVE_PLAYBACK_STREAMS/pWaveCaps->nrStreams; 1253 } 1254 else { 1255 DebugInt3(); //should never happen! 1256 pCaps->ulResourceUnits = OSS32_MAX_WAVE_PLAYBACK_STREAMS; 1257 } 1258 dprintf(("RU used by playback stream: %d", (int)pCaps->ulResourceUnits)); 1259 } 1260 else { 1261 if(pWaveCaps->nrStreams < OSS32_MAX_WAVE_CAPTURE_STREAMS) { 1262 DebugInt3(); 1263 } 1264 pCaps->ulResourceUnits = 1; 1265 } 1266 1267 if ( pCaps->ulOperation == OPERATION_PLAY) 1268 pCaps->ulResourceClass = 1; 1269 else 1270 pCaps->ulResourceClass = 2; 1271 pCaps->fCanRecord = 1; // Yes Virgina we can record 1272 pCaps->ulBlockAlign = 1; // Block alignment for this mode 1273 1274 //return success 1275 pCaps->ulSupport = SUPPORT_SUCCESS; 1276 dprintf(("WAVEAUDIO::DevCaps %ld %ld %ld ", pCaps->ulBitsPerSample, pCaps->ulSamplingRate, pCaps->ulChannels)); 1277 dprintf(("Op %ld ResourceClass %ld ResourceUnits %ld", pCaps->ulOperation, pCaps->ulResourceClass, pCaps->ulResourceUnits)); 1278 dprintf(("Data type %ld, data subtype %ld", pCaps->ulDataType, pCaps->ulDataSubType)); 1046 1279 #ifdef DEBUG 1047 dprintf(("WAVEAUDIO::DevCaps1")); 1048 #endif 1049 1050 pCaps->ulFlags = 0; 1051 1052 // This device driver supports Playback or Record Operations 1053 // anything else makes no sence. Note: This a per stream operation so 1054 // even if this sevice can do full-duplex, it can not do PLAY_AND_RECORD 1055 1056 if ( pCaps->ulOperation != OPERATION_PLAY && 1057 pCaps->ulOperation != OPERATION_RECORD ) 1058 { 1059 dprintf(("DevCaps1 not play/record")); 1060 pCaps->ulSupport = UNSUPPORTED_OPERATION; 1061 return; 1062 } 1063 1064 if(pCaps->ulOperation == OPERATION_PLAY) 1065 { 1066 pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps; 1067 } 1068 else pWaveCaps = &devCaps[ulDeviceNr].waveInCaps; 1069 1070 // We always support stereo and mono 1071 if (pCaps->ulChannels != 1 && pCaps->ulChannels != 2) 1072 { 1073 if(pCaps->ulChannels > pWaveCaps->ulMaxChannels) 1074 { 1075 dprintf(("DevCaps1 not channel")); 1076 pCaps->ulSupport = UNSUPPORTED_CHANNELS; 1077 return; 1078 } 1079 } 1080 if (pCaps->ulSamplingRate == 0) 1081 { 1082 dprintf(("DevCaps1 not rate")); 1083 pCaps->ulSupport = UNSUPPORTED_RATE; 1084 return; 1085 } 1086 1087 //Determine supported rates 1088 ulSampleRate = pCaps->ulSamplingRate; //save the sampling rate called with 1089 1090 if(pWaveCaps->ulRateFlags & OSS32_CAPS_PCM_RATE_CONTINUOUS) 1091 {//supports all sample rates from min to max 1092 if (ulSampleRate < pWaveCaps->ulMinRate) { 1093 ulSampleRate = pWaveCaps->ulMinRate; 1094 } 1095 else 1096 if(ulSampleRate > pWaveCaps->ulMaxRate) { 1097 ulSampleRate = pWaveCaps->ulMaxRate; 1098 } 1099 } 1100 else { 1101 ULONG ulNrSampleRates; 1102 1103 ulSampleRate = FindMatchingSampleRate(ulSampleRate, pWaveCaps->ulRateFlags, &ulNrSampleRates); 1104 } 1105 1106 // If we don't support the requested samplerate, then fill in the best fit flag. 1107 if (ulSampleRate != pCaps->ulSamplingRate) 1108 pCaps->ulFlags |= BESTFIT_PROVIDED; 1109 1110 // find out the closest sampling rate (may or may not be the same ) 1111 // from one of the following: 11025Hz, 22050Hz, 44100Hz and 8000Hz 1112 // _usfind_matching_sample_rate will update pCaps->ulSamplingRate if there 1113 // is not an exact match. 1114 usSampleRateIndex = _usfind_matching_sample_rate(&pCaps->ulSamplingRate); 1115 1116 //query flags for this wave data format 1117 pCaps->ulFlags |= QueryDataFlags(pCaps->ulOperation, pCaps->ulDataType, pCaps->ulBitsPerSample); 1118 1119 // Determine the ulDataSubType and update any format specific flags 1120 // Note: All data types have more than one value. 1121 switch ( pCaps->ulDataType ) 1122 { 1123 case DATATYPE_NULL: //Warp 3 buggy data type 1124 case DATATYPE_WAVEFORM: 1125 case PCM: 1126 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1127 // and 16 (for 2's complement PCM) 1128 switch(pCaps->ulBitsPerSample) { 1129 case 8: 1130 case 16: 1131 //NOTE: We always support 8 & 16 bits playback & recording; if the card 1132 // can't handle one of these formats, then we'll convert the 1133 // wave data ourselves (same for mono/stereo). 1134 break; 1135 case 24: 1136 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS)) 1137 { 1138 dprintf(("DevCaps1 not 24BPS")); 1139 pCaps->ulSupport = UNSUPPORTED_BPS; 1140 return; 1141 } 1142 break; 1143 case 32: 1144 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS)) 1145 { 1146 pCaps->ulSupport = UNSUPPORTED_BPS; 1147 dprintf(("DevCaps1 not 32BPS")); 1148 return; 1149 } 1150 break; 1151 default: 1152 dprintf(("DevCaps1 not BPS %d",(USHORT)pCaps->ulBitsPerSample)); 1153 pCaps->ulSupport = UNSUPPORTED_BPS; 1154 return; 1155 } 1156 1157 // determine subtype for PCM: 1158 pCaps->ulDataSubType = aaulWave[usSampleRateIndex] 1159 [(pCaps->ulBitsPerSample-8)/8] 1160 [pCaps->ulChannels-1]; 1161 break; 1162 1163 case DATATYPE_ALAW: 1164 case DATATYPE_RIFF_ALAW: 1165 case A_LAW: 1166 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW)) 1167 { 1168 dprintf(("DevCaps1 not ALAW")); 1169 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1170 return; 1171 } 1172 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1173 if (pCaps->ulBitsPerSample != 8) 1174 { 1175 dprintf(("DevCaps1 not ALAW BPS8")); 1176 pCaps->ulSupport = UNSUPPORTED_BPS; 1177 return; 1178 } 1179 // determine subtype for A_LAW 1180 pCaps->ulDataSubType = aaulAlaw[usSampleRateIndex][pCaps->ulChannels-1]; 1181 break; 1182 1183 case DATATYPE_MULAW: 1184 case DATATYPE_RIFF_MULAW: 1185 case MU_LAW: 1186 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW)) 1187 { 1188 dprintf(("DevCaps1 not MULAW")); 1189 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1190 return; 1191 } 1192 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1193 if (pCaps->ulBitsPerSample != 8) 1194 { 1195 dprintf(("DevCaps1 not MULAW BPS8")); 1196 pCaps->ulSupport = UNSUPPORTED_BPS; 1197 return; 1198 } 1199 // determine subtype for MU_LAW 1200 pCaps->ulDataSubType = aaulMulaw[usSampleRateIndex][pCaps->ulChannels-1]; 1201 break; 1202 1203 case DATATYPE_ADPCM_AVC: 1204 case DATATYPE_CT_ADPCM: 1205 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM)) 1206 { 1207 dprintf(("DevCaps1 not ADPCM")); 1208 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1209 return; 1210 } 1211 // supported bits per sample are 4 1212 if (pCaps->ulBitsPerSample != 4) 1213 { 1214 dprintf(("DevCaps1 not ADPCM BPS4")); 1215 pCaps->ulSupport = UNSUPPORTED_BPS; 1216 return; 1217 } 1218 // determine subtype for ADPCM 1219 pCaps->ulDataSubType = aaulMulaw[usSampleRateIndex][pCaps->ulChannels-1]; 1220 break; 1221 1222 default: 1223 dprintf(("DevCaps1 not dattype")); 1224 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1225 return; 1226 } // end switch 1227 1228 pCaps->ulFlags |= FIXED | // Fixed length data 1229 LEFT_ALIGNED | // Left align bits on byte bndry 1230 INPUT | // Input select is supported 1231 OUTPUT | // Output select is supported 1232 MONITOR | // Monitor is supported 1233 VOLUME; // Volume control is supported 1234 1235 // Full Duplex Enabling Stuff here !! 1236 // The number of resource units is described in the MMPM2.INI 1237 // This can be thought of the number of active streams the 1238 // driver can manage at one time. We list this number as 2. 1239 // we tell MMPM here how many of these units THIS stream will consume. 1240 // The answer is so simple it's brilliant, (Thanks to Joe Nord at Crystal 1241 // Semi) If we are enabled to do full-duplex this stream will consume 1 1242 // unit, If we are not enabled to do full-duplex this stream will consume 2 1243 // (or all the available units) 1244 // Along with the resource units, we defined 2 resources classes, 1245 // one for playback and one for capture. We tell MMPM (in the MMPM2.INI) 1246 // that we can handle doing 1 playback and 1 capture stream or 1 capture and 1247 // one playback stream at the same time. (Valid Resource combos in the 1248 // MMPM2.INI) check if we are a playback or capture and set the correct 1249 // resource class (Playback = 1, Capture = 2) 1250 1251 if(pCaps->ulOperation == OPERATION_PLAY) 1252 { 1253 if(pWaveCaps->nrStreams) { 1254 pCaps->ulResourceUnits = OSS32_MAX_WAVE_PLAYBACK_STREAMS/pWaveCaps->nrStreams; 1255 } 1256 else { 1257 DebugInt3(); //should never happen! 1258 pCaps->ulResourceUnits = OSS32_MAX_WAVE_PLAYBACK_STREAMS; 1259 } 1260 dprintf(("RU used by playback stream: %d", (int)pCaps->ulResourceUnits)); 1261 } 1262 else { 1263 if(pWaveCaps->nrStreams < OSS32_MAX_WAVE_CAPTURE_STREAMS) { 1264 DebugInt3(); 1265 } 1266 pCaps->ulResourceUnits = 1; 1267 } 1268 1269 if ( pCaps->ulOperation == OPERATION_PLAY) 1270 pCaps->ulResourceClass = 1; 1271 else 1272 pCaps->ulResourceClass = 2; 1273 pCaps->fCanRecord = 1; // Yes Virgina we can record 1274 pCaps->ulBlockAlign = 1; // Block alignment for this mode 1275 1276 //return success 1277 pCaps->ulSupport = SUPPORT_SUCCESS; 1278 dprintf(("WAVEAUDIO::DevCaps %ld %ld %ld ", pCaps->ulBitsPerSample, pCaps->ulSamplingRate, pCaps->ulChannels)); 1279 dprintf(("Op %ld ResourceClass %ld ResourceUnits %ld", pCaps->ulOperation, pCaps->ulResourceClass, pCaps->ulResourceUnits)); 1280 dprintf(("Data type %ld, data subtype %ld", pCaps->ulDataType, pCaps->ulDataSubType)); 1281 #ifdef DEBUG 1282 dprintf(("Flags:")); 1283 1284 for(int i=0;i<32;i++) { 1285 if(pCaps->ulFlags & (1UL << (ULONG)i)) { 1286 dprintf(("%s", szCapsFlags[i])); 1287 } 1288 } 1280 dprintf(("Flags:")); 1281 1282 for(int i=0;i<32;i++) { 1283 if(pCaps->ulFlags & (1UL << (ULONG)i)) { 1284 dprintf(("%s", szCapsFlags[i])); 1285 } 1286 } 1289 1287 #endif 1290 1288 } … … 1297 1295 void WAVEAUDIO::DevCaps(LPOSS32_DEVCAPS lpCaps) 1298 1296 { 1299 #ifdef DEBUG 1300 dprintf(("WAVEAUDIO::DevCaps")); 1301 #endif 1302 ddmemmov(lpCaps, &devCaps[current_device], sizeof(OSS32_DEVCAPS)); 1297 //dprintf(("WAVEAUDIO::DevCaps")); 1298 ddmemmov(lpCaps, &devCaps[current_device], sizeof(OSS32_DEVCAPS)); 1303 1299 } 1304 1300 … … 1313 1309 #pragma on (unreferenced) 1314 1310 { 1315 ULONG ulBytesPerIRQ; 1316 1317 #ifdef DEBUG 1318 //dprintf(("WAVEAUDIO::ConfigDev")); 1319 #endif 1320 //Reset sample rate conversion position 1321 pConfigInfo->ulSRatePosition = 0; 1322 1323 // Set the clock select bits (_ucClockData) 1324 1325 // Set up _ucFormatData and write usSilence for the WAVESTREAM 1326 switch (pConfigInfo->ulDataType) { 1327 case DATATYPE_NULL: //Warp 3 buggy data type 1328 case DATATYPE_WAVEFORM: 1329 case PCM: 1330 if (pConfigInfo->ulBitsPerSample == 16) { 1331 pConfigInfo->usSilence = 0x0000; 1332 } 1333 else { 1334 pConfigInfo->usSilence = 0x8080; 1335 } 1336 break; 1337 1338 case DATATYPE_ALAW: 1339 case DATATYPE_RIFF_ALAW: 1340 case A_LAW: 1341 pConfigInfo->usSilence = 0x5555; 1342 break; 1343 1344 case DATATYPE_MULAW: 1345 case DATATYPE_RIFF_MULAW: 1346 case MU_LAW: 1347 pConfigInfo->usSilence = 0x7F7F; 1348 break; 1349 } /* endswitch */ 1350 1351 // Calculate the PCMConsumeRate 1352 // The consume rate is the number of bytes consumed by this data format 1353 // per second. It calculated by taking the following equation: 1354 // sampling rate * (BitsPerSample/8) * NumChannels 1355 // This info is returned to the WAVESTREAM and used to calculate stream time 1356 1357 pConfigInfo->ulSampleSize = (pConfigInfo->ulBitsPerSample*pConfigInfo->ulNumChannels)/8; 1358 pConfigInfo->ulPCMConsumeRate = pConfigInfo->ulSampleRate * pConfigInfo->ulSampleSize; 1359 1360 // Calculate the BytesPerIRQ 1361 // The BytesPerIRQ is the number of bytes consumed by this data format 1362 // for every interrupt generated by the codec. 1363 // This information is returned to the WAVESTREAM which uses it in 1364 // buffer management decisions.... 1365 // basic formula is (sampling rate * ((BitsPerSample * NumChannels) /8) / Number of Interrupts per Second 1366 // or pConfigInfo->ulPCMConsumeRate / Number of Interrupts Per Second 1367 // rjj Fix for Bug #18 28082008 1368 1369 //ulBytesPerIRQ = pConfigInfo->ulPCMConsumeRate >> 5; // 32 interrupts per second 1370 ulBytesPerIRQ = pConfigInfo->ulPCMConsumeRate >> 6; // 64 interrupts per second 1371 // we can tweak this as needed but generally this should do rjj 1372 // make sure it's an even multiple of 64 1373 ulBytesPerIRQ += 0x00000040; 1374 ulBytesPerIRQ &= 0xFFFFFFC0; 1375 1376 if (ulBytesPerIRQ > 0x800) { 1377 ulBytesPerIRQ = 0x800; 1378 } 1379 pConfigInfo->ulBytesPerIRQ = ulBytesPerIRQ; 1380 dprintf4(("WAVEAUDIO::ConfigDev BytesPerIRQ:%ld",ulBytesPerIRQ)); 1381 1382 1383 return TRUE; 1311 ULONG ulBytesPerIRQ; 1312 1313 //dprintf(("WAVEAUDIO::ConfigDev")); 1314 //Reset sample rate conversion position 1315 pConfigInfo->ulSRatePosition = 0; 1316 1317 // Set the clock select bits (_ucClockData) 1318 1319 // Set up _ucFormatData and write usSilence for the WAVESTREAM 1320 switch (pConfigInfo->ulDataType) { 1321 case DATATYPE_NULL: //Warp 3 buggy data type 1322 case DATATYPE_WAVEFORM: 1323 case PCM: 1324 if (pConfigInfo->ulBitsPerSample == 16) { 1325 pConfigInfo->usSilence = 0x0000; 1326 } 1327 else { 1328 pConfigInfo->usSilence = 0x8080; 1329 } 1330 break; 1331 1332 case DATATYPE_ALAW: 1333 case DATATYPE_RIFF_ALAW: 1334 case A_LAW: 1335 pConfigInfo->usSilence = 0x5555; 1336 break; 1337 1338 case DATATYPE_MULAW: 1339 case DATATYPE_RIFF_MULAW: 1340 case MU_LAW: 1341 pConfigInfo->usSilence = 0x7F7F; 1342 break; 1343 } /* endswitch */ 1344 1345 // Calculate the PCMConsumeRate 1346 // The consume rate is the number of bytes consumed by this data format 1347 // per second. It calculated by taking the following equation: 1348 // sampling rate * (BitsPerSample/8) * NumChannels 1349 // This info is returned to the WAVESTREAM and used to calculate stream time 1350 1351 pConfigInfo->ulSampleSize = (pConfigInfo->ulBitsPerSample*pConfigInfo->ulNumChannels)/8; 1352 pConfigInfo->ulPCMConsumeRate = pConfigInfo->ulSampleRate * pConfigInfo->ulSampleSize; 1353 1354 // Calculate the BytesPerIRQ 1355 // The BytesPerIRQ is the number of bytes consumed by this data format 1356 // for every interrupt generated by the codec. 1357 // This information is returned to the WAVESTREAM which uses it in 1358 // buffer management decisions.... 1359 // basic formula is (sampling rate * ((BitsPerSample * NumChannels) /8) / Number of Interrupts per Second 1360 // or pConfigInfo->ulPCMConsumeRate / Number of Interrupts Per Second 1361 // rjj Fix for Bug #18 28082008 1362 1363 //ulBytesPerIRQ = pConfigInfo->ulPCMConsumeRate >> 5; // 32 interrupts per second 1364 ulBytesPerIRQ = pConfigInfo->ulPCMConsumeRate >> 6; // 64 interrupts per second 1365 // we can tweak this as needed but generally this should do rjj 1366 // make sure it's an even multiple of 64 1367 ulBytesPerIRQ += 0x00000040; 1368 ulBytesPerIRQ &= 0xFFFFFFC0; 1369 1370 if (ulBytesPerIRQ > 0x800) { 1371 ulBytesPerIRQ = 0x800; 1372 } 1373 pConfigInfo->ulBytesPerIRQ = ulBytesPerIRQ; 1374 dprintf4(("WAVEAUDIO::ConfigDev BytesPerIRQ:%ld",ulBytesPerIRQ)); 1375 1376 1377 return TRUE; 1384 1378 } 1385 1379 /**@internal Pause 1386 * @param 1387 * @return 1380 * @param None 1381 * @return int 1 1388 1382 * @notes 1389 1383 * stub function pause is implemented as a stop by the stream … … 1396 1390 } 1397 1391 /**@internal Resume 1398 * @param 1399 * @return 1392 * @param None 1393 * @return int 1 1400 1394 * @notes 1401 1395 * stub function resume is implemented as a start by the stream … … 1405 1399 #pragma on (unreferenced) 1406 1400 { 1407 1401 return 1; 1408 1402 } 1409 1403 /******************************************************************************/ 1410 /* WAVEAUDIO::Start(void) 1411 /* 1404 /* WAVEAUDIO::Start(void) */ 1405 /* */ 1412 1406 /******************************************************************************/ 1413 1407 int WAVEAUDIO::Start(OSSSTREAMID StreamId) 1414 1408 { 1415 #ifdef DEBUG 1416 // dprintf(("WAVEAUDIO::Start")); 1417 #endif 1418 1419 return OSS16_WaveStart(StreamId) == OSSERR_SUCCESS; 1409 //dprintf(("WAVEAUDIO::Start")); 1410 1411 return OSS16_WaveStart(StreamId) == OSSERR_SUCCESS; 1420 1412 } 1421 1413 1422 1414 /******************************************************************************/ 1423 /* WAVEAUDIO::Stop(void) 1424 /* 1415 /* WAVEAUDIO::Stop(void) */ 1416 /* */ 1425 1417 /******************************************************************************/ 1426 1418 int WAVEAUDIO::Stop(OSSSTREAMID StreamId) 1427 1419 { 1428 #ifdef DEBUG 1429 // dprintf(("WAVEAUDIO::Stop")); 1430 #endif 1431 1432 if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS) 1433 { 1434 DebugInt3(); 1435 return FALSE; 1436 } 1437 //Reset cleans up waveout instance 1438 if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS) 1439 { 1440 DebugInt3(); 1441 return FALSE; 1442 } 1443 return TRUE; 1420 //dprintf(("WAVEAUDIO::Stop")); 1421 1422 if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS) 1423 { 1424 DebugInt3(); 1425 return FALSE; 1426 } 1427 //Reset cleans up waveout instance 1428 if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS) 1429 { 1430 DebugInt3(); 1431 return FALSE; 1432 } 1433 return TRUE; 1444 1434 } 1445 1435 /******************************************************************************/ 1446 /* WAVEAUDIO::Prepare(void) 1447 /* 1436 /* WAVEAUDIO::Prepare(void) */ 1437 /* */ 1448 1438 /******************************************************************************/ 1449 1439 int WAVEAUDIO::Prepare(OSSSTREAMID StreamId) 1450 1440 { 1451 #ifdef DEBUG 1452 // dprintf(("WAVEAUDIO::Prepare")); 1453 #endif 1454 1455 if(OSS16_WavePrepare(StreamId) != OSSERR_SUCCESS) { 1456 DebugInt3(); 1457 return FALSE; 1458 } 1459 return TRUE; 1441 //dprintf(("WAVEAUDIO::Prepare")); 1442 1443 if(OSS16_WavePrepare(StreamId) != OSSERR_SUCCESS) { 1444 DebugInt3(); 1445 return FALSE; 1446 } 1447 return TRUE; 1460 1448 } 1461 1449 //****************************************************************************** … … 1463 1451 ULONG WAVEAUDIO::ConvertPosition(ULONG length, PWAVECONFIGINFO pConfigInfo) 1464 1452 { 1465 1466 1467 1468 1469 1470 1471 1472 1453 ULONG newlen; 1454 1455 newlen = CONVERT_LENGTH(length, pConfigInfo->ulConversionFactor); 1456 1457 if(newlen && pConfigInfo->fSampleRateConversion) { 1458 newlen = SRATE_CONVERT_POSITION(newlen, pConfigInfo->ulSampleRate, pConfigInfo->ulHwSampleRate); 1459 } 1460 return newlen; 1473 1461 } 1474 1462 //****************************************************************************** … … 1476 1464 ULONG WAVEAUDIO::ConvertPositionInvert(ULONG length, PWAVECONFIGINFO pConfigInfo) 1477 1465 { 1478 1479 1480 1481 1482 1483 1484 1485 1466 ULONG newlen; 1467 1468 newlen = CONVERT_LENGTH(length, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 1469 1470 if(newlen && pConfigInfo->fSampleRateConversion) { 1471 newlen = SRATE_CONVERT_POSITION(newlen, pConfigInfo->ulSampleRate, pConfigInfo->ulHwSampleRate); 1472 } 1473 return newlen; 1486 1474 } 1487 1475 //****************************************************************************** … … 1490 1478 ULONG WAVEAUDIO::ConvertLength(ULONG length, PWAVECONFIGINFO pConfigInfo) 1491 1479 { 1492 1493 1494 1480 ULONG newlen; 1481 1482 newlen = CONVERT_LENGTH(length, pConfigInfo->ulConversionFactor); 1495 1483 1496 1484 //PS+++ 1497 1485 #ifdef WhatIsIt 1498 1499 1500 DebugInt3();//this shouldn't happen!!1501 1502 1486 if(newlen >= 4UL*1024UL*1024UL) { 1487 //oh, oh 1488 DebugInt3(); //this shouldn't happen!! 1489 return newlen; 1490 } 1503 1491 #endif 1504 1505 1506 1507 1508 1509 } 1510 1511 #define CONVERT_POSITION_INVERT(pos, ulFactor) 1512 #define CONVERT_LENGTH_INVERT(pos, ulFactor) 1492 if(newlen && pConfigInfo->fSampleRateConversion) { 1493 newlen = SRATE_CONVERT_LENGTH(newlen, pConfigInfo->ulSRatePosition, 1494 pConfigInfo->ulSRateIncrement); 1495 } 1496 return newlen; 1497 } 1498 1499 #define CONVERT_POSITION_INVERT(pos, ulFactor) ( ( pos << CONVERSION_RSHIFT(ulFactor)) >> CONVERSION_LSHIFT(ulFactor) ) 1500 #define CONVERT_LENGTH_INVERT(pos, ulFactor) CONVERT_POSITION_INVERT(pos, ulFactor) 1513 1501 //****************************************************************************** 1514 1502 //NOTE: Can only be used for small numbers (up to about 4mb)!! (overflow) … … 1516 1504 ULONG WAVEAUDIO::ConvertLengthInvert(ULONG length, PWAVECONFIGINFO pConfigInfo) 1517 1505 { 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 // 1545 1546 // 1547 1548 } 1549 //****************************************************************************** 1550 //****************************************************************************** 1551 1506 ULONG newlen,tmp,len; 1507 1508 if (!length) return 0; 1509 1510 len = length; 1511 1512 if (pConfigInfo->fSampleRateConversion) 1513 { 1514 tmp = SRATE_CONVERT_LENGTH_INVERT(len, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 1515 if (tmp && (len != SRATE_CONVERT_LENGTH (tmp, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement))) 1516 tmp--; 1517 } 1518 else 1519 tmp = len; 1520 1521 if (!tmp) return 0; 1522 1523 if (pConfigInfo->usConversion != CONVERT_NONE) 1524 { 1525 newlen = CONVERT_LENGTH_INVERT (tmp, pConfigInfo->ulConversionFactor); 1526 if (newlen && (tmp != CONVERT_LENGTH (newlen, pConfigInfo->ulConversionFactor)) ) 1527 newlen--; 1528 } 1529 else 1530 newlen = tmp; 1531 1532 // if ( newlen > length ) dprintf(("!!!!Back len %ld tmp %ld new %ld",length,tmp,newlen )); 1533 1534 // dprintf(("Overflow len %ld in:%ld inc:%ld pos:%lx",length, len, pConfigInfo->ulSRateIncrement, pConfigInfo->ulSRatePosition)); 1535 return newlen; 1536 } 1537 //****************************************************************************** 1538 //****************************************************************************** 1539 -
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 -
OCO/branches/DAZ/drv16/wavestrm.cpp
r512 r513 42 42 extern "C" ULONG __cdecl __saveregs OSSIDC_EntryPoint(ULONG cmd, ULONG param1, ULONG param2); 43 43 44 #define SNDRV_PCM_STATE_XRUN 4 /* stream reached an xrun */ 44 45 45 46 //****************************************************************************** … … 148 149 { 149 150 if (ulStreamState == STREAM_STOPPED) return; 150 rprintf(("%s: BufferUnderrun-stop", pchStr));151 pahw->SetVolume(StreamId, getMixerStreamId(), 0);151 rprintf(("%s: Underrun-stop", pchStr)); 152 //pahw->SetVolume(StreamId, getMixerStreamId(), 0); 152 153 pahw->Stop(StreamId); 153 154 ulStreamState = STREAM_STOPPED; … … 160 161 { 161 162 if (ulStreamState == STREAM_STREAMING) return 0; 163 rprintf(("Underrun-start")); 162 164 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 163 if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE) { 164 rprintf(("WS::Write: ConfigDev failed")); 165 return ERROR_INSUFF_BUFFER; 166 } 165 // if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE) { 166 // rprintf(("WS::Write: ConfigDev failed")); 167 // return ERROR_INSUFF_BUFFER; 168 // } 169 _configinfo.ulSRatePosition = 0; 167 170 // prepare wave device for playback/recording 168 171 if(pahw->Prepare(StreamId) == FALSE) { 169 rprintf(("WS:: Write: Prepare failed"));172 rprintf(("WS::UR Start: Prepare failed")); 170 173 return ERROR_START_STREAM; 171 174 } … … 175 178 ulStreamState = STREAM_STREAMING; 176 179 fUnderrun = FALSE; 177 if (ulStreamType == STREAM_WAVE_PLAY) pahw->SetVolume(StreamId, getMixerStreamId(), volume);180 //if (ulStreamType == STREAM_WAVE_PLAY) pahw->SetVolume(StreamId, getMixerStreamId(), volume); 178 181 return 0; 179 182 } … … 185 188 // if this is a write stream call _vFillAudioBuf 186 189 //****************************************************************************** 190 short sDbgInProcess = 0; 191 short sDbgSave; 187 192 #pragma off (unreferenced) 188 void WAVESTREAM::AddBuffers( BOOL fFirst)193 void WAVESTREAM::AddBuffers(SHORT sFirst) 189 194 #pragma on (unreferenced) 190 195 { … … 193 198 ULONG ulStatus; 194 199 195 //dprintf(("WS:AddBuffers First=%d, SampleSize=%lx", fFirst, _configinfo.ulSampleSize)); 200 //dprintf(("WS:AddBuffers First=%d, SampleSize=%lx", sFirst, _configinfo.ulSampleSize)); 201 202 if (sDbgInProcess) { 203 rprintf(("WS::ABS InProcess Now=%x Save=%x", sFirst, sDbgSave)); 204 return; 205 } 206 sDbgInProcess++; 207 sDbgSave = sFirst; 196 208 197 209 ulBytesWritten = 0; … … 204 216 // In extream cases we will stay stuck in this loop long enough to casue a trap rjj 205 217 if (pahw->GetSpace(StreamId, &_configinfo, &ulSpace) == FALSE) { 206 rprintf(("W AVESTREAM::AddBuffersGetSpace failed"));218 rprintf(("WS::ABS GetSpace failed")); 207 219 return; 208 220 } 209 221 ulSpace &= (~(_configinfo.ulSampleSize - 1)); 210 222 #if 1 223 /* DAZ testing -- underrun detection */ 211 224 if (ulSpace == 0) { 212 225 OSS16_WaveGetStatus(StreamId, &ulStatus); 213 rprintf(("W AVESTREAM::AddBuffers ulSpace=0, u32status=%lx", ulStatus));214 215 _vUnderrunStop("WS:AB ");226 rprintf(("WS::ABS ulSpace=0 state=%lx u32status=%lx", ulStreamState, ulStatus)); 227 228 _vUnderrunStop("WS:ABS"); 216 229 _vUnderrunStart(); 217 230 218 231 if (pahw->GetSpace(StreamId, &_configinfo, &ulSpace) == FALSE) { 219 rprintf(("WS::AB GetSpace failed"));232 rprintf(("WS::ABS GetSpace failed")); 220 233 return; 221 234 } 222 235 ulSpace &= (~(_configinfo.ulSampleSize - 1)); 236 if (ulSpace ==0) rprintf(("WS::ABS still no space")); 223 237 } 224 238 #endif … … 227 241 { 228 242 if (ulDAZ++ > 20) { 229 rprintf(("W AVESTREAM::AddBuffersDAZ break")); // Temporary hack to prevent lockups when uniaud32 stops (underrun)243 rprintf(("WS::ABS DAZ break")); // Temporary hack to prevent lockups when uniaud32 stops (underrun) 230 244 int3(); /* should never happen */ 231 245 break; 232 246 } 233 #if 0234 //DAZ move the ProcBlock to the start stream code, if really needed235 // First time is in task time. For I7 need to give time for interrupt time236 if (fFirst == TRUE) //PS+++237 {238 //cli();239 DevHelp_ProcBlock (0x5541, 20, 0); // ok since the first call is at task time240 ulBytesWritten = AddBuffer(ulSpace);241 return;242 }243 #endif244 247 ulBytesWritten = AddBuffer(ulSpace); 245 248 if (ulBytesWritten == (ULONG)-1) { 246 249 OSS16_WaveGetStatus(StreamId, &ulStatus); 247 rprintf(("W AVESTREAM::AddBuffersAddBuffer returns -1 u32Status=%lx", ulStatus));250 rprintf(("WS::ABS AddBuffer returns -1 u32Status=%lx", ulStatus)); 248 251 break; 249 252 } … … 255 258 // } 256 259 } 260 sDbgInProcess--; 257 261 } 258 262 … … 296 300 if (pahw->Transfer(StreamId, &_configinfo, pDataBuf, ulBuffLeft, &ulBytesWritten) == FALSE) { 297 301 // This could mean that the hardware has underrun TODO: implement underrun logic 298 rprintf(("WS::A ddBuffer: pahw->Transfer failed"));302 rprintf(("WS::AB: pahw->Transfer failed")); 299 303 return (ULONG)-1; 300 304 } 305 //dprintf(("WS::AB: %lx of %lx bytes written", ulBytesWritten, ulBuffLeft)); 301 306 if (ulBytesWritten == 0) { 302 307 // This could mean that the hardware has underrun TODO: implement underrun logic 303 rprintf(("WS::AddBuffer: 0 of %lx bytes written by transfer", ulBuffLeft));308 //rprintf(("WS::AddBuffer: 0 of %lx bytes written by transfer", ulBuffLeft)); 304 309 return (ULONG)-1; 305 310 } … … 396 401 break; 397 402 } 398 if (qhInProcess.IsElements()) AddBuffers( FALSE);403 if (qhInProcess.IsElements()) AddBuffers(1); 399 404 // Return any buffers that have been completely written to uniaud32 400 405 //dprintf(("WS::Process usBufferMode=%x", usBufferMode)); … … 418 423 while(_vReadAudioBuf()) { 419 424 if (ulDAZ++ > 20) { /* temporary hack to prevent hangs when uniaud32 stops (overruns) */ 420 rprintf(("W AVESTREAM::Process Read DAZ Break"));425 rprintf(("WS::Process Read DAZ Break")); 421 426 break; 422 427 } … … 442 447 //****************************************************************************** 443 448 //****************************************************************************** 444 #define SNDRV_PCM_STATE_XRUN 4 /* stream reached an xrun */445 449 ULONG WAVESTREAM::Write(PSTREAMBUFFER pStreamBuf) 446 450 { … … 457 461 fUnderrun = TRUE; 458 462 } 459 #else460 if (!fUnderrun && !qhInProcess.IsElements()) {461 rprintf(("WS::Write: Buffer Underrun detect"));462 fUnderrun = TRUE;463 }464 463 #endif 465 464 qhInProcess.PushOnTail((PQUEUEELEMENT)pStreamBuf); 466 //dprintf(("WS::Write: sz=%lx IRQ=%lx", pStreamBuf->ulBuffsz, _configinfo.ulBytesPerIRQ));467 // if (pStreamBuf->ulBuffsz < (_configinfo.ulBytesPerIRQ*2)) {468 // dprintf(("WS::Write: BufferMode=1"));469 // usBufferMode = 1;470 // }471 465 if (fUnderrun) { 472 466 _vUnderrunStart(); 473 AddBuffers( FALSE);467 AddBuffers(2); 474 468 } 475 469 return 0; … … 614 608 if (ulStreamType == STREAM_WAVE_PLAY) 615 609 { 610 //DAZ moved from AddBuffers, for I7, might not be needed 611 //DevHelp_ProcBlock (0x5541, 20, 0); 616 612 pahw->SetVolume(StreamId, getMixerStreamId(), volume); //PS 617 AddBuffers( TRUE);613 AddBuffers(3); 618 614 } 619 615 else … … 641 637 { 642 638 if(ulStreamState == STREAM_STOPPED) { 643 dprintf(("WAVESTREAM::StopStream %lx (already stopped)", StreamId));639 //dprintf(("WS::StopStream %lx (already stopped)", StreamId)); 644 640 fUnderrun = FALSE; 645 641 pControl->ulTime = GetCurrentTime(); … … 676 672 677 673 if(ulStreamState == STREAM_PAUSED) { 678 dprintf(("W AVESTREAM::PauseStream %lx (already paused)", StreamId));674 dprintf(("WS::PauseStream %lx (already paused)", StreamId)); 679 675 fUnderrun = FALSE; 680 676 pControl->ulTime = GetCurrentTime(); … … 691 687 if (pahw->GetPosition(StreamId, &_configinfo, &ulEndPos2) == FALSE) ulEndPos2 = 0; 692 688 if (ulEndPos2 != ulEndPos) { 693 dprintf(("W AVESTREAM::PauseStream %lx!=%lx", ulEndPos, ulEndPos2));689 dprintf(("WS::PauseStream %lx!=%lx", ulEndPos, ulEndPos2)); 694 690 if (ulEndPos2) ulEndPos = ulEndPos2; 695 691 } … … 699 695 ulStreamState = STREAM_PAUSED; 700 696 701 dprintf(("W AVESTREAM::PauseStream %lx", StreamId));697 dprintf(("WS::PauseStream %lx", StreamId)); 702 698 703 699 _ulBytesProcessed = ulEndPos; … … 717 713 ULONG WAVESTREAM::ResumeStream(void) 718 714 { 719 #ifdef DEBUG720 715 //dprintf(("WAVESTREAM::ResumeStream %lx", StreamId)); 721 #endif722 716 return StartStream(); 723 717 } … … 729 723 case PROPERTY_VOLUME: 730 724 volume = value; 731 dprintf(("W AVESTREAM::SetProperty() Vol: %0lx",value));725 dprintf(("WS::SetProperty() Vol: %0lx",value)); 732 726 if(ulStreamState == STREAM_STREAMING && ulStreamType == STREAM_WAVE_PLAY) { 733 727 MixerSetWaveVolume(getMixerStreamId(), StreamId, volume); -
OCO/branches/DAZ/drv16/wavestrm.hpp
r512 r513 58 58 protected: 59 59 60 virtual void AddBuffers( BOOL fFirst); // Initialize the audio buffer object60 virtual void AddBuffers(SHORT sFirst); // Initialize the audio buffer object 61 61 62 62 WaveConfigInfo _configinfo; // configuration info shared with the hardware -
OCO/branches/DAZ/include/dbgos2.h
r507 r513 24 24 /* dprintf is used to output info into the log for the debug version */ 25 25 #ifdef DEBUG 26 #define DBGCALLCONV FAR 27 26 28 #define dprintf(a) PrintfOut a 27 29 #define dprintf1(a) if(dbglevel >= 1) PrintfOut a … … 29 31 #define dprintf3(a) if(dbglevel >= 3) PrintfOut a 30 32 #define dprintf4(a) if(dbglevel >= 4) PrintfOut a 33 34 #define DebugInt3() //_asm int 3 DAZ temporarily taken out of debug build to prevent traps 35 31 36 #else 37 // notdef DEBUG 38 #define DBGCALLCONV NEAR 39 32 40 #define dprintf(a) // 33 41 #define dprintf1(a) // … … 35 43 #define dprintf3(a) // 36 44 #define dprintf4(a) // 37 #endif38 45 39 #ifdef DEBUG40 #define DebugInt3() //_asm int 3 DAZ temporarily taken out of debug build to prevent traps41 #else42 46 #define DebugInt3() //_asm int 3 43 #endif44 47 45 #ifdef DEBUG46 #define DBGCALLCONV FAR47 #else48 #define DBGCALLCONV NEAR49 48 #endif 50 49 -
OCO/branches/DAZ/install/control.scr
r512 r513 25 25 ssgroup=0 26 26 ssname="mmbase" 27 ssversion="1.9.3- SVNr511"27 ssversion="1.9.3-BETA SVNr512" 28 28 sstermdll="ITERM.DLL" 29 29 sstermdllentry="ITermEntry" … … 43 43 ssgroup=17 44 44 ssname="OS/2 Universal Audio: Wave" 45 ssversion="1.9.3- SVNr511"45 ssversion="1.9.3-BETA SVNr512" 46 46 sssize=680 47 47 ssdll="genin.dll" -
OCO/branches/DAZ/uniaud.inc
r512 r513 13 13 # ex RC3 GA FIXPACK2 beta_47 14 14 # Comment out to avoid a fixpack line in bldlevel 15 FIXPACK = SVNr51115 FIXPACK = BETA SVNr513 16 16 17 17 # ALSA BUILD VERSION
Note:
See TracChangeset
for help on using the changeset viewer.