Changeset 468
- Timestamp:
- Nov 4, 2009, 4:21:24 PM (16 years ago)
- Location:
- OCO/trunk
- Files:
-
- 24 edited
-
drv16/apmevent.cpp (modified) (5 diffs)
-
drv16/commdbg.c (modified) (1 diff)
-
drv16/convert.asm (modified) (33 diffs)
-
drv16/dwavestrm.cpp (modified) (9 diffs)
-
drv16/fmsynth.cpp (modified) (1 diff)
-
drv16/ioctl.cpp (modified) (24 diffs)
-
drv16/irq.hpp (modified) (2 diffs)
-
drv16/malloc.c (modified) (1 diff)
-
drv16/maudio.cpp (modified) (9 diffs)
-
drv16/memutil.asm (modified) (9 diffs)
-
drv16/midistrm.cpp (modified) (6 diffs)
-
drv16/mixer.cpp (modified) (1 diff)
-
drv16/ossidc16.cpp (modified) (1 diff)
-
drv16/parse.c (modified) (2 diffs)
-
drv16/queue.cpp (modified) (4 diffs)
-
drv16/ssm_idc.cpp (modified) (7 diffs)
-
drv16/strategy.cpp (modified) (2 diffs)
-
drv16/stream.cpp (modified) (5 diffs)
-
drv16/timer.cpp (modified) (2 diffs)
-
drv16/waudio.cpp (modified) (14 diffs)
-
drv16/waveplay.cpp (modified) (26 diffs)
-
drv16/waverec.cpp (modified) (1 diff)
-
drv16/wavestrm.cpp (modified) (25 diffs)
-
include/dbgos2.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
OCO/trunk/drv16/apmevent.cpp
r221 r468 28 28 USHORT far APMEvent(APM_EVENT_MSG far *peventmsg) 29 29 { 30 #ifdef DEBUG 30 #ifdef DEBUG_APM 31 31 dprintf(("APM_event parm 1 %d, parm 2 %d", peventmsg->parm1, peventmsg->parm2)); 32 32 #endif … … 80 80 USHORT DBGCALLCONV APM_suspend(USHORT state) 81 81 { 82 #ifdef DEBUG 82 #ifdef DEBUG_APM 83 83 dprintf(("APM_suspend %d", state)); 84 84 #endif … … 112 112 USHORT DBGCALLCONV APM_resume(USHORT state) 113 113 { 114 #ifdef DEBUG 114 #ifdef DEBUG_APM 115 115 dprintf(("APM_resume %d", state)); 116 116 #endif … … 163 163 if((ret = APM_COMMAND(&APM_Reg_Req)) != 0) 164 164 { 165 #ifdef DEBUG 165 #ifdef DEBUG_APM 166 166 dprintf(("APM_Init: cant register at APM.SYS: %d", ret)); 167 167 #endif … … 172 172 { 173 173 APM_Enabled = 0; 174 #ifdef DEBUG 174 #ifdef DEBUG_APM 175 175 dprintf(("APM_Init: cant attach to APM.SYS")); 176 176 #endif 177 177 } 178 178 179 #ifdef DEBUG 179 #ifdef DEBUG_APM 180 180 dprintf(("APM_enabled %d", APM_Enabled)); 181 181 #endif -
OCO/trunk/drv16/commdbg.c
r288 r468 339 339 } 340 340 341 #ifdef DEBUG 341 #ifdef DEBUG_COM 342 342 343 343 void StringOut(char far *DbgStr) -
OCO/trunk/drv16/convert.asm
r466 r468 1 .3862 .seq1 .586 2 .seq 3 3 4 4 EXTRN DOS32FLATDS:ABS 5 5 6 6 7 SetupParameters MACRO … … 37 38 pop bp 38 39 ENDM 39 40 ;****************************************************************************** 41 ; PS 27.20.2009 42 ; Check len for zero 43 ;****************************************************************************** 44 CheckLenZero Macro ; 45 Local RightPar ; 46 test ecx,ecx ; be sure 4gb we don't want to convert 47 jnz short RightPar ; 48 PopRegs ; 49 ret ; 50 RightPar: ; 51 EndM ; 52 ;****************************************************************************** 53 ; Check ecx to 1 54 ;****************************************************************************** 55 CheckLenOne Macro ; 56 Local RightPar ; 57 cmp ecx, 1 ; Here 1, we have hext shr 58 jg short RightPar ; 59 PopRegs ; 60 ret ; 61 RightPar: ; 62 EndM ; 63 ;****************************************************************************** 64 ; Check ecx to 3 65 ;****************************************************************************** 66 CheckLenThree Macro ; 67 Local RightPar ; 68 cmp ecx, 3 ; Here 1, we have hext shr 69 jg short RightPar ; 70 PopRegs ; 71 ret ; 72 RightPar: ; 73 EndM ; 74 ;****************************************************************************** 40 75 _HEADER segment dword public use16 'DATA' 41 76 _HEADER ends … … 119 154 PUBLIC _Convert16SignedTo8UnsignedStereoMono 120 155 PUBLIC _Convert16UnsignedTo8SignedStereoMono 121 122 156 pSrc EQU DWORD PTR [bp+4] 123 157 ulSrcBytes EQU DWORD PTR [bp+8] … … 127 161 ;void NEAR CDECL ConvertNone(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest); 128 162 ;******************************************************************************* 129 _ConvertNone PROC NEAR 130 ret 131 _ConvertNone ENDP 132 163 _ConvertNone PROC NEAR ; 164 ret ; 165 _ConvertNone ENDP ; 133 166 ;****************************************************************************** 134 167 ;****************************************************************************** … … 145 178 PushRegs 146 179 SetupParameters 147 180 CheckLenZero ; PS 148 181 xor ax, ax 149 182 ;unoptimized … … 169 202 PushRegs 170 203 SetupParameters 204 CheckLenZero ; PS 171 205 172 206 xor ax, ax … … 192 226 PushRegs 193 227 SetupParameters 228 CheckLenZero ; PS 194 229 195 230 xor ax, ax … … 216 251 PushRegs 217 252 SetupParameters 253 CheckLenZero ; PS 218 254 219 255 ;unoptimized … … 241 277 PushRegs 242 278 SetupParameters 279 CheckLenZero ; PS 243 280 244 281 ;unoptimized … … 267 304 PushRegs 268 305 SetupParameters 306 CheckLenZero ; PS 269 307 270 308 ;unoptimized … … 294 332 ;void NEAR CDECL Convert8MonoTo16StereoSignChange(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest); 295 333 ;******************************************************************************* 296 _Convert8MonoTo16StereoSignChange PROC NEAR 297 PushRegs 298 SetupParameters 299 ;;PS+++ 20090927 300 test ecx,ecx ; be sure 4gb we don't want to convert 301 jnz short RightPar 302 ;; int 3 303 jmp short ExitCon8MT16SC 304 RightPar: 305 ;;End PS 306 307 ;unoptimized 308 xor eax, eax 309 loopm8st16signchange: 310 ;;PS+++ optimizations 20090927 311 db 67h 312 lodsb 313 xor al,80h 314 ;; mov ah, byte ptr [esi] ; stereo_sample = ((mono_sample8 ^ 0x80) << 24) | ((mono_sample8 ^ 0x80) << 8) 315 ;; xor ah, 80h 316 mov bx, ax 317 ;; shl eax, 16 318 shl eax, 16+8 319 ;; mov ax, bx 320 mov ah, bl 321 322 ;; dec ecx 323 324 ;; mov dword ptr [edi], eax 325 db 67h 326 stosd 327 ;; inc esi 328 ;; add edi, 4 329 330 ;; cmp ecx, 0 331 ;; jnz loopm8st16signchange 332 loop short loopm8st16signchange 333 ;;PS End optimiztions 334 ExitCon8MT16SC: 335 PopRegs 336 ret 337 _Convert8MonoTo16StereoSignChange ENDP 334 _Convert8MonoTo16StereoSignChange PROC NEAR ; 335 PushRegs ; 336 SetupParameters ; 337 CheckLenZero ; PS 338 xor eax, eax ; 339 loopm8st16signchange: ; 340 db 67h ; load byte from ds:esi 341 lodsb ; esi++ 342 xor al,80h ; stereo_sample = ((mono_sample8 ^ 0x80) << 24) | ((mono_sample8 ^ 0x80) << 8) 343 mov bx, ax ; 344 shl eax, 16+8 ; 345 mov ah, bl ; 346 db 67h ; save byte to es:edi 347 stosd ; edi++ 348 db 67h ; 349 loop short loopm8st16signchange ; ecx-- 350 PopRegs ; 351 ret ; 352 _Convert8MonoTo16StereoSignChange ENDP ; 338 353 339 354 ;******************************************************************************* … … 343 358 PushRegs 344 359 SetupParameters 360 361 CheckLenOne ; PS 345 362 shr ecx, 1 ;sample size = 2 bytes 346 363 … … 374 391 PushRegs 375 392 SetupParameters 393 CheckLenOne ; PS 376 394 shr ecx, 1 ;sample size = 2 bytes 377 395 … … 403 421 PushRegs 404 422 SetupParameters 423 CheckLenOne ; PS 405 424 shr ecx, 1 ;sample size = 2 bytes 406 425 … … 435 454 PushRegs 436 455 SetupParameters 456 CheckLenOne ; PS 437 457 shr ecx, 1 ;sample size = 2 bytes 438 458 … … 465 485 PushRegs 466 486 SetupParameters 487 CheckLenOne ; PS 467 488 shr ecx, 1 ;sample size = 2 bytes 468 489 … … 496 517 PushRegs 497 518 SetupParameters 519 CheckLenOne ; PS 498 520 shr ecx, 1 ;sample size = 2 bytes 499 521 … … 527 549 PushRegs 528 550 SetupParameters 551 CheckLenOne ; PS 529 552 shr ecx, 1 ;sample size = 2 bytes 530 553 … … 558 581 PushRegs 559 582 SetupParameters 583 CheckLenOne ; PS 560 584 shr ecx, 1 ;sample size = 2 bytes 561 585 … … 601 625 PushRegs 602 626 SetupParameters 627 CheckLenOne ; PS 603 628 604 629 shr ecx, 1 ;sample size = 2 … … 626 651 PushRegs 627 652 SetupParameters 653 CheckLenOne ; PS 628 654 629 655 shr ecx, 1 ;sample size = 2 … … 650 676 PushRegs 651 677 SetupParameters 678 CheckLenOne ; PS 652 679 653 680 shr ecx, 1 ;sample size = 2 … … 673 700 ;void NEAR cdecl Convert16MonoTo16Stereo(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest); 674 701 ;******************************************************************************* 675 _Convert16MonoTo16Stereo PROC NEAR 676 PushRegs 677 SetupParameters 678 679 shr ecx, 1 ;sample size = 2 680 ;;PS+++ 20090927 681 test ecx,ecx ; be sure 4gb we don't want to convert 682 jnz short RightParC16MT16S 683 ;; int 3 684 jmp short ExitCon16MT16S 685 RightParC16MT16S: 686 687 ;unoptimized 688 loopm16m16st: 689 mov ax, word ptr [esi] ; stereo_sample = (mono_sample16 << 16) | mono_sample8 690 mov bx, ax 691 shl eax, 16 692 mov ax, bx 693 694 dec ecx 695 696 mov dword ptr [edi], eax 697 add esi, 2 698 add edi, 4 699 700 cmp ecx, 0 701 jnz loopm16m16st 702 ExitCon16MT16S: 703 704 PopRegs 705 ret 706 _Convert16MonoTo16Stereo ENDP 707 702 _Convert16MonoTo16Stereo PROC NEAR ; 703 PushRegs ; 704 SetupParameters ; 705 CheckLenOne ; 706 shr ecx, 1 ; sample size = 2 707 loopm16m16st: ; 708 db 67h ; use esi instead si 709 lodsw ; stereo_sample = (mono_sample16 << 16) | mono_sample8 710 mov bx, ax ; 711 shl eax, 16 ; 712 mov ax, bx ; 713 db 67h ; use edi instead di 714 stosd ; 715 db 67h ; use ecx instead cx 716 loop short loopm16m16st ; 717 PopRegs ; 718 ret ; 719 _Convert16MonoTo16Stereo ENDP ; 708 720 ;******************************************************************************* 709 721 ;void NEAR cdecl Convert16MonoTo16StereoSignChange(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest); 710 722 ;******************************************************************************* 711 _Convert16MonoTo16StereoSignChange PROC NEAR 712 PushRegs 713 SetupParameters 714 715 shr ecx, 1 ;sample size = 2 716 717 ;unoptimized 718 loopm16m16stsignchange: 719 mov ax, word ptr [esi] ; stereo_sample = ((mono_sample16 ^ 0x8000) << 16) | (mono_sample16 ^ 0x8000) 720 xor ax, 8000h 721 722 mov bx, ax 723 shl eax, 16 724 mov ax, bx 725 726 dec ecx 727 728 mov dword ptr [edi], eax 729 add esi, 2 730 add edi, 4 731 732 cmp ecx, 0 733 jnz loopm16m16stsignchange 734 735 PopRegs 736 ret 737 _Convert16MonoTo16StereoSignChange ENDP 738 723 _Convert16MonoTo16StereoSignChange PROC NEAR ; 724 PushRegs ; 725 SetupParameters ; 726 CheckLenOne ; PS 727 shr ecx, 1 ; sample size = 2 728 loopm16m16stsignchange: ; 729 db 67h ; 730 lodsw ; stereo_sample = ((mono_sample16 ^ 0x8000) << 16) | (mono_sample16 ^ 0x8000) 731 xor ax, 8000h ; 732 mov bx, ax ; 733 shl eax, 16 ; 734 mov ax, bx ; 735 db 67h ; 736 stosd ; 737 db 67h ; 738 loop short loopm16m16stsignchange ; 739 PopRegs ; 740 ret ; 741 _Convert16MonoTo16StereoSignChange ENDP ; 739 742 ;******************************************************************************* 740 743 ;void NEAR cdecl Convert16MonoTo8Stereo(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest); … … 743 746 PushRegs 744 747 SetupParameters 748 CheckLenOne ; PS 745 749 shr ecx, 1 ;sample = 2 bytes 746 750 … … 771 775 PushRegs 772 776 SetupParameters 777 CheckLenOne ; PS 773 778 shr ecx, 1 ;sample = 2 bytes 774 779 … … 801 806 PushRegs 802 807 SetupParameters 808 CheckLenThree ; PS 809 803 810 shr ecx, 2 ;sample size = 4 bytes 804 811 … … 832 839 PushRegs 833 840 SetupParameters 841 CheckLenThree ; PS 834 842 shr ecx, 2 ;sample size = 4 bytes 835 843 … … 860 868 PushRegs 861 869 SetupParameters 870 CheckLenThree ; PS 862 871 shr ecx, 2 ;sample size = 4 bytes 863 872 … … 891 900 PushRegs 892 901 SetupParameters 902 CheckLenThree ; PS 893 903 shr ecx, 2 ;sample size = 4 bytes 894 904 … … 920 930 PushRegs 921 931 SetupParameters 932 CheckLenThree ; PS 922 933 shr ecx, 2 ;sample size = 4 bytes 923 934 … … 951 962 PushRegs 952 963 SetupParameters 964 CheckLenThree ; PS 953 965 shr ecx, 2 ;sample size = 4 bytes 954 966 … … 982 994 PushRegs 983 995 SetupParameters 996 CheckLenThree ; PS 984 997 shr ecx, 2 ;sample size = 4 bytes 985 998 … … 1010 1023 PushRegs 1011 1024 SetupParameters 1025 CheckLenThree ; PS 1012 1026 shr ecx, 2 ;sample size = 4 bytes 1013 1027 -
OCO/trunk/drv16/dwavestrm.cpp
r33 r468 44 44 45 45 pStream = (PDWAVESTREAM)FindStream_fromFile(ulSysFileNum); 46 if(pStream == NULL) { 46 if (pStream == NULL) 47 { 47 48 dprintf(("HookHandler stream %lx not found!", (ULONG) ulSysFileNum)); 48 49 DebugInt3(); … … 79 80 pStreamBuf = new STREAMBUFFER(uLength, (PSTREAMBUF)0, fLooping); 80 81 if(pStreamBuf == NULL) { 82 dprintf(("DWAVESTREAM::Write StreamBuf")); 81 83 DebugInt3(); 82 84 return 1; … … 87 89 rc = DevHelp_VirtToLin(SELECTOROF(pLock), OFFSETOF(pLock), &linLock); 88 90 if(rc) { 91 dprintf(("DWAVESTREAM::Write VirtToLin")); 89 92 DebugInt3(); 90 93 delete pStreamBuf; … … 94 97 rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE, (LIN)pbuf, uLength, -1L, linLock, (PULONG)&PageListCount); 95 98 if(rc) { 99 dprintf(("DWAVESTREAM::Write VMLock")); 96 100 DebugInt3(); 97 101 delete pStreamBuf; … … 101 105 rc = DevHelp_VMProcessToGlobal(VMDHGP_WRITE, (LIN)pbuf, uLength, (PLIN)&linAddr); 102 106 if(rc) { 107 dprintf(("DWAVESTREAM::Write ProcToGlob")); 103 108 DebugInt3(); 104 109 DevHelp_VMUnLock(linLock); … … 119 124 if(temp) 120 125 { 121 if(ulStreamState == STREAM_STREAMING) {//means we're called during an interrupt 126 if(ulStreamState == STREAM_STREAMING) 127 {//means we're called during an interrupt 122 128 qhReturn.PushOnTail((PQUEUEELEMENT)temp); 123 129 DevHelp_ArmCtxHook(ulSysFileNum, hCtxHook); 124 130 } 125 else { 131 else 132 { 126 133 DevHelp_VMFree((LIN)temp->pBuffptr); 127 134 DevHelp_VMUnLock(temp->linLock); … … 136 143 hSem = pReg->hStream; 137 144 145 dprintf(("DWAVESTREAM::Register")); 138 146 if(DevHelp_OpenEventSem(hSem) != 0) { 139 147 dprintf(("DevHlp_OpenEventSem %lx failed!", hSem)); … … 173 181 Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos; 174 182 175 if(pahw->GetPosition(StreamId, &_configinfo, &space) != OSSERR_SUCCESS) { 176 DebugInt3(); 177 return; 178 } 183 if (pahw->GetPosition(StreamId, &_configinfo, &space) != OSSERR_SUCCESS) 184 { 185 dprintf(("DWAVESTREAM::AddBuffers GetPositions")); 186 DebugInt3(); 187 return; 188 } 179 189 if(fFirst) { 180 190 space = min(space, 4*_configinfo.ulFragsize); … … 255 265 WAVESTREAM(streamtype, pinit, filesysnum, mixerStreamId), fError(FALSE), hCtxHook(0), hSem(0) 256 266 { 257 if(DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook)) { 267 if (DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook)) 268 { 269 dprintf(("DWAVESTREAM::DWAVESTREAM AllocCtx")); 258 270 DebugInt3(); 259 271 fError = TRUE; -
OCO/trunk/drv16/fmsynth.cpp
r252 r468 95 95 int FMSYNTH::readByte(OSSSTREAMID StreamId) 96 96 { 97 dprintf(("FMSYNTH::readByte")); 97 98 DebugInt3(); 98 99 return -1; -
OCO/trunk/drv16/ioctl.cpp
r33 r468 72 72 // stream idle bit in the stream state then write the sysfilenum 73 73 // into the request packet, set rc = 0 and return 74 if (p->sMode == IDLE) { 75 pstream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 76 if (pstream) 77 pstream->ulStreamState |= STREAM_IDLE; 78 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum; 79 p->sReturnCode = 0; 80 return; 74 if (p->sMode == IDLE) 75 { 76 pstream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 77 if (pstream) 78 pstream->ulStreamState |= STREAM_IDLE; 79 p->pvReserved = (VOID FAR *) (ULONG)prp->s.ioctl.usSysFileNum; 80 p->sReturnCode = 0; 81 return; 81 82 } 82 83 // call FindStream_fromFile to see if there is already a stream … … 182 183 //HACK BEGIN 183 184 if(pfnSHD) { 184 dprintf(("Stream was previously registered; reregister it"));185 // dprintf(("Stream was previously registered; reregister it")); 185 186 pstream->pfnSHD = pfnSHD; 186 187 pstream->hstream = hstream; … … 201 202 ULONG ulDevicetype; 202 203 204 #ifdef DEBUG 205 // dprintf(("IACapability: src type: %d, op %d",(USHORT)p->ulDataType, (USHORT)p->ulOperation)); 206 #endif 207 203 208 // get the hardware device type based on the datatype and operation 204 209 ulDevicetype = GetHardwareType((USHORT)p->ulDataType,(USHORT)p->ulOperation,LDev); 205 210 206 211 #ifdef DEBUG 207 // dprintf((" dev type: %d, ldev %d",ulDevicetype, LDev));212 // dprintf(("IACapability: dev type: %d, ldev %d",ulDevicetype, LDev)); 208 213 #endif 209 214 … … 215 220 // bailout if no hardware object is returned.. 216 221 pHWobj = GetHardwareDevice(ulDevicetype); 217 if (pHWobj) { 222 if (pHWobj) 223 { 218 224 pHWobj->DevCaps(p); 219 225 if (p->ulSupport != SUPPORT_SUCCESS) { 226 dprintf(("IACapability: Error support")); 220 227 prp->usStatus |= RPERR; 221 228 } … … 223 230 else { 224 231 #ifdef DEBUG 225 dprintf((" Error getting hardware object"));232 dprintf(("IACapability: Error get HW obj")); 226 233 #endif 227 234 p->ulSupport = UNSUPPORTED_DATATYPE; … … 248 255 ULONG addr; 249 256 250 if (p->usIOCtlRequest != AUDIO_CHANGE) { 257 if (p->usIOCtlRequest != AUDIO_CHANGE) 258 { 259 dprintf(("IAudioControl: Error support req:%x",p->usIOCtlRequest)); 251 260 p->sReturnCode = INVALID_REQUEST; 252 261 prp->usStatus |= RPERR | RPBADCMD; … … 260 269 addr = OFFSETOF(pAudChange); 261 270 addr += sizeof(MCI_AUDIO_CHANGE); 262 if(addr >= 0x10000UL) { 263 dprintf(("Invalid MCI_AUDIO_CHANGE pointer %lx!!", (ULONG)pAudChange)); 271 if(addr >= 0x10000UL) 272 { 273 dprintf(("Invalid MCI_AUDIO_CHANGE pnt %lx!!", (ULONG)pAudChange)); 264 274 p->sReturnCode = INVALID_REQUEST; 265 275 prp->usStatus |= RPERR | RPBADCMD; … … 271 281 addr = OFFSETOF(pMasterVol); 272 282 addr += sizeof(MCI_TRACK_INFO); 273 if(addr >= 0x10000UL) { 274 dprintf(("Invalid MCI_TRACK_INFO pointer %lx!!", (ULONG)pMasterVol)); 283 if(addr >= 0x10000UL) 284 { 285 dprintf(("Invalid MCI_TRACK_INFO pnt %lx!!", (ULONG)pMasterVol)); 275 286 p->sReturnCode = INVALID_REQUEST; 276 287 prp->usStatus |= RPERR | RPBADCMD; … … 280 291 pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 281 292 if(pStream == NULL) { 282 dprintf(("I octlAudioControl stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));293 dprintf(("IAudioControl stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum)); 283 294 DebugInt3(); 284 295 return; … … 287 298 pStream->SetProperty(PROPERTY_BALANCE, pAudChange->lBalance); 288 299 289 if(pAudChange->lVolume != AUDIO_IGNORE) { 300 if (pAudChange->lVolume != AUDIO_IGNORE) 301 { 290 302 // stream volume ranges from 0 to 0x7FFFFFFF (linear) 291 303 volume = pAudChange->lVolume >> 16UL; … … 295 307 } 296 308 297 if (pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE)309 if (pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE) 298 310 { 299 311 // master volume ranges from 0 to 0x7FFF (linear) 300 312 volume = pMasterVol->usMasterVolume; 301 313 volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL; 302 if(volume > OSS32_MAX_VOLUME) { 314 if (volume > OSS32_MAX_VOLUME) 315 { 303 316 volume = OSS32_MAX_VOLUME; 304 317 } 305 // dprintf((" Set mastervolumeto %d", volume));318 // dprintf(("IlAudioControl:Set MV to %d", volume)); 306 319 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_FRONT, MAKE_VOLUME_LR(volume, volume)); 307 if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_MASTER_REAR)) { 320 if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_MASTER_REAR)) 321 { 308 322 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_REAR, MAKE_VOLUME_LR(volume, volume)); 309 323 } … … 345 359 volume = OSS32_MAX_VOLUME; 346 360 } 347 // dprintf((" Set input gainof %x to %d", prp->s.ioctl.usSysFileNum, volume));361 // dprintf(("IAudioControl:Set IG of %x to %d", prp->s.ioctl.usSysFileNum, volume)); 348 362 pStream->SetProperty(PROPERTY_INPUTGAIN, MAKE_VOLUME_LR(volume, volume)); 349 363 } … … 353 367 void IoctlDirectAudio(PREQPACKET prp) 354 368 { 369 dprintf(("IoctlDirectAudio")); 355 370 if(prp->s.ioctl.bCode == DAUDIO_OPEN) 356 371 { … … 362 377 if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE)) 363 378 { 364 dprintf(("Invalid MCI_AUDIO_INIT p ointer%lx!!", (ULONG)pInit));379 dprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit)); 365 380 prp->usStatus |= RPERR | RPBADCMD; 366 381 return; … … 382 397 pHWobj->DevCaps(&audioCaps); 383 398 if (audioCaps.ulSupport != SUPPORT_SUCCESS) { 384 dprintf(("I octlDirectAudio: DevCaps failed"));399 dprintf(("IDirectAudio: DevCaps failed")); 385 400 pInit->sReturnCode = INVALID_REQUEST; 386 401 prp->usStatus |= RPERR; … … 396 411 pStream = new DWAVESTREAM(AUDIOHW_WAVE_PLAY, pInit, prp->s.ioctl.usSysFileNum, MixerStreamId); 397 412 if(pStream == NULL) { 413 dprintf(("IDirectAudio: pStream")); 398 414 DebugInt3(); 399 415 pInit->sReturnCode = INVALID_REQUEST; … … 404 420 if(!pStream->IsEverythingOk()) { 405 421 delete pStream; 422 dprintf(("IlDirectAudio: IsEverythingOk")); 406 423 DebugInt3(); 407 424 pInit->sReturnCode = INVALID_REQUEST; … … 429 446 if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE)) 430 447 { 431 dprintf(("Invalid MCI_AUDIO_INIT p ointer%lx!!", (ULONG)pInit));448 dprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit)); 432 449 prp->usStatus |= RPERR | RPBADCMD; 433 450 return; … … 449 466 pHWobj->DevCaps(&audioCaps); 450 467 if (audioCaps.ulSupport != SUPPORT_SUCCESS) { 451 dprintf(("I octlDirectAudio: DevCaps failed"));468 dprintf(("IlDirectAudio: DevCaps failed")); 452 469 prp->usStatus |= RPERR; 453 470 pInit->sReturnCode = INVALID_REQUEST; … … 471 488 if(DevHelp_VerifyAccess(SELECTOROF(lpCaps), sizeof(OSS32_DEVCAPS), OFFSETOF(lpCaps), VERIFY_READWRITE)) 472 489 { 473 dprintf(("Invalid OSS32_DEVCAPS p ointer%lx!!", (ULONG)lpCaps));490 dprintf(("Invalid OSS32_DEVCAPS pnt %lx!!", (ULONG)lpCaps)); 474 491 prp->usStatus |= RPERR | RPBADCMD; 475 492 return; … … 493 510 pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum); 494 511 if(pStream == NULL) { 495 dprintf(("I octlDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));512 dprintf(("IDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum)); 496 513 DebugInt3(); 497 514 prp->usStatus |= RPERR | RPBADCMD; … … 504 521 if(DevHelp_VerifyAccess(SELECTOROF(pDAudioCmd), sizeof(DAUDIO_CMD), OFFSETOF(pDAudioCmd), VERIFY_READWRITE)) 505 522 { 506 dprintf(("Invalid DAUDIO_CMD p ointer%lx!!", (ULONG)pDAudioCmd));523 dprintf(("Invalid DAUDIO_CMD pnt %lx!!", (ULONG)pDAudioCmd)); 507 524 prp->usStatus |= RPERR | RPBADCMD; 508 525 return; … … 627 644 { 628 645 #ifdef DEBUG 629 // dprintf(("StrategyIoctl. cat %d, code: %d,dev %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device));646 dprintf(("StrategyIoctl:cat:0x%x, code:0x%x dev %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device)); 630 647 #endif 631 if(prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT) { 648 if (prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT) 649 { 632 650 IoctlDirectAudio(prp); 633 651 return; 634 652 } 635 653 636 if(prp->s.ioctl.bCategory == 0x90) { 654 if (prp->s.ioctl.bCategory == 0x90) 655 { 637 656 IoctlMixer(prp, LDev); 638 657 return; 639 658 } 640 if(prp->s.ioctl.bCategory != AUDIO_IOCTL_CAT) { 659 if (prp->s.ioctl.bCategory != AUDIO_IOCTL_CAT) 660 { 641 661 prp->usStatus |= RPERR | RPBADCMD; 642 662 return; … … 645 665 switch (prp->s.ioctl.bCode) 646 666 { 647 case AUDIO_INIT: 648 IoctlAudioInit(prp, LDev); 649 break; 650 case AUDIO_CONTROL: 651 IoctlAudioControl(prp); 652 break; 653 case AUDIO_CAPABILITY: 654 IoctlAudioCapability(prp, LDev); 655 break; 656 default: 657 prp->usStatus |= RPERR | RPBADCMD; 658 break; 659 } 667 case AUDIO_INIT: 668 IoctlAudioInit(prp, LDev); 669 break; 670 case AUDIO_CONTROL: 671 IoctlAudioControl(prp); 672 break; 673 case AUDIO_CAPABILITY: 674 IoctlAudioCapability(prp, LDev); 675 break; 676 default: 677 prp->usStatus |= RPERR | RPBADCMD; 678 break; 679 } 680 681 #ifdef DEBUG 682 dprintf(("StrategyIoctl:ret:0x%x", (USHORT)prp->usStatus)); 683 #endif 660 684 return; 661 685 } -
OCO/trunk/drv16/irq.hpp
r418 r468 51 51 // ###IHV: IRQ sharing flag. Set this to "0" for ISA bus, "1" for PCI 52 52 // PCI and Microchannel environments (where hardware can share an IRQ level. 53 const BOOLIRQ_HW_Sharing = 0;53 const unsigned long IRQ_HW_Sharing = 0; 54 54 55 55 // Max num of int handlers per IRQ level. 56 const intMAX_HandlersPerIRQLevel = 3;56 const unsigned long MAX_HandlersPerIRQLevel = 3; 57 57 58 58 // PFN_InterruptHandler: Pointer to an interrupt handler. This is a near … … 92 92 // Runs in interrupt context. 93 93 void CallHandlers (void); 94 //PS+++ add for debug IRQ level 95 USHORT GetIRQLevel (void) { return _usIRQLevel;}; 94 96 95 97 private: -
OCO/trunk/drv16/malloc.c
r33 r468 334 334 335 335 if (npvReturn) 336 { 336 337 SignatureCheck( (PMEMBLOCK) (((PUCHAR) npvReturn) - HDR_SIZE), (PSZ) "malloc() exit, allocated block" ); 337 else { 338 // Out of Memory !!! 339 int3(); 338 } 339 else 340 { 341 // Out of Memory !!! 342 int3(); 340 343 } 341 344 -
OCO/trunk/drv16/maudio.cpp
r418 r468 114 114 int MIDIAUDIO::Pause(OSSSTREAMID StreamId) // Pause the operation 115 115 { 116 dprintf(("DUMMY MIDIAUDIO::Pause"));116 // dprintf(("DUMMY MIDIAUDIO::Pause")); 117 117 DebugInt3(); 118 118 return 0; … … 122 122 int MIDIAUDIO::Resume(OSSSTREAMID StreamId) // Resume the operation 123 123 { 124 dprintf(("DUMMY MIDIAUDIO::Resume"));124 // dprintf(("DUMMY MIDIAUDIO::Resume")); 125 125 DebugInt3(); 126 126 return 0; … … 130 130 void MIDIAUDIO::noteOff(OSSSTREAMID StreamId, BYTE mchan, BYTE note, BYTE velocity ) 131 131 { 132 dprintf2(("MIDIAUDIO::noteOff %d %d %d", mchan, note, velocity));132 // dprintf2(("MIDIAUDIO::noteOff %d %d %d", mchan, note, velocity)); 133 133 if(OSS16_MidiNoteOff(StreamId, mchan, note, velocity) != OSSERR_SUCCESS) { 134 134 DebugInt3(); … … 139 139 void MIDIAUDIO::noteOn(OSSSTREAMID StreamId, BYTE mchan, BYTE note, BYTE velocity ) 140 140 { 141 dprintf2(("MIDIAUDIO::noteOn %d %d %d", mchan, note, velocity));141 // dprintf2(("MIDIAUDIO::noteOn %d %d %d", mchan, note, velocity)); 142 142 if(OSS16_MidiNoteOn(StreamId, mchan, note, velocity) != OSSERR_SUCCESS) { 143 143 DebugInt3(); … … 148 148 void MIDIAUDIO::polyphonicPressure(OSSSTREAMID StreamId, BYTE mchan, BYTE note, BYTE value ) 149 149 { 150 dprintf2(("MIDIAUDIO::polyphonicPressure %d %d %d", mchan, note, value));150 // dprintf2(("MIDIAUDIO::polyphonicPressure %d %d %d", mchan, note, value)); 151 151 if(OSS16_MidiKeyPressure(StreamId, mchan, note, value) != OSSERR_SUCCESS) { 152 152 DebugInt3(); … … 157 157 void MIDIAUDIO::controlChange(OSSSTREAMID StreamId, BYTE mchan, BYTE control_number, BYTE value ) 158 158 { 159 dprintf2(("MIDIAUDIO::controlChange %d %d %d", mchan, control_number, value));159 // dprintf2(("MIDIAUDIO::controlChange %d %d %d", mchan, control_number, value)); 160 160 if(OSS16_MidiControlChange(StreamId, mchan, control_number, value) != OSSERR_SUCCESS) { 161 161 DebugInt3(); … … 166 166 void MIDIAUDIO::programChange(OSSSTREAMID StreamId, BYTE mchan, BYTE program_number ) 167 167 { 168 dprintf2(("MIDIAUDIO::programChange %d %d", mchan, program_number));168 // dprintf2(("MIDIAUDIO::programChange %d %d", mchan, program_number)); 169 169 if(OSS16_MidiProgramChange(StreamId, mchan, program_number) != OSSERR_SUCCESS) { 170 170 DebugInt3(); … … 175 175 void MIDIAUDIO::channelPressure(OSSSTREAMID StreamId, BYTE mchan, BYTE value ) 176 176 { 177 dprintf2(("MIDIAUDIO::channelPressure %d %d", mchan, value));177 // dprintf2(("MIDIAUDIO::channelPressure %d %d", mchan, value)); 178 178 if(OSS16_MidiChannelPressure(StreamId, mchan, value) != OSSERR_SUCCESS) { 179 179 DebugInt3(); … … 184 184 void MIDIAUDIO::pitchBend(OSSSTREAMID StreamId, BYTE mchan, BYTE value_lsb, BYTE value_msb) 185 185 { 186 dprintf2(("MIDIAUDIO::pitchBend %d %d %d", mchan, value_lsb, value_msb));186 // dprintf2(("MIDIAUDIO::pitchBend %d %d %d", mchan, value_lsb, value_msb)); 187 187 if(OSS16_MidiKeyPressure(StreamId, mchan, value_lsb, value_msb) != OSSERR_SUCCESS) { 188 188 DebugInt3(); -
OCO/trunk/drv16/memutil.asm
r33 r468 93 93 ; save registers 94 94 push cx 95 push bx95 ;PS+++ push bx 96 96 push ds 97 97 push es … … 101 101 ; store number of bytes to transfer and calculate number of double words 102 102 ; and set of transfer value 103 mov bx,BUF1_LEN 104 mov cx,bx 103 ;PS+++ mov bx,BUF1_LEN 104 ;PS+++ mov cx,bx 105 mov cx,BUF1_LEN ;PS+++ 105 106 shr cx,2 106 107 … … 120 121 121 122 ; transfer number of odd bytes 122 mov cx,bx 123 ;PS+++ mov cx,bx 124 mov cx,BUF1_LEN ;PS+++ 123 125 and cx,03h 126 or cx,cx ;PS+++ 127 jz short @@NoPad ;PS+++ 124 128 rep movsb 125 129 @@NoPad: ;PS+++ 126 130 ;set up return value and restore registers 127 131 pop di … … 129 133 pop es 130 134 pop ds 131 pop bx135 ;PS+++ pop bx 132 136 pop cx 133 pop bp134 137 ;PS+++ pop bp 138 leave ;PS+++ 135 139 ;done 136 140 ret … … 143 147 ; the fill value as parameters on the stack. 144 148 ; The function does not return a value. 145 149 ;PS+++ Where is used now? 150 ifdef WhereIsUsed 146 151 public _ddmemfill 147 152 _ddmemfill proc near … … 157 162 158 163 ; save registers 159 push bx164 ;PS+++ push bx 160 165 push cx 161 166 push es … … 164 169 ; store number of bytes to transfer and calculate number of double words 165 170 ; and set of transfer value 166 mov bx,BUF2_LEN 167 mov cx,bx 171 ;PS+++ mov bx,BUF2_LEN 172 ;PS+++ mov cx,bx 173 mov cx,BUF2_LEN ;PS++ 168 174 shr cx,2 169 175 170 176 ; set size in bytes of object to be allocated 171 mov es,DEST2_HIGH 177 mov es,DEST2_HIGH 172 178 mov di,DEST2_LOW 173 179 174 180 ; set up value 175 mov ax,VALUE2 181 ;PS+++ mov ax,VALUE2 182 mov al,VALUE2 ;PS+++ 183 mov ah,ah ;PS+++ 184 push ax ;PS+++ 176 185 shl eax,010h 177 mov ax,VALUE2 186 ;PS+++ mov ax,VALUE2 187 pop ax ;PS+++ 178 188 179 189 ; set up transfer direction … … 184 194 185 195 ; transfer number of odd bytes 186 mov cx,bx 196 ;PS+++ mov cx,bx 197 mov cx,BUF2_LEN ;PS++ 187 198 and cx,03h 188 199 rep stosb … … 192 203 pop es 193 204 pop cx 194 pop bx195 pop bp196 205 ;PS+++ pop bx 206 ;PS+++ pop bp 207 leave 197 208 ;done 198 209 ret 199 210 _ddmemfill endp 211 endif 200 212 201 213 _TEXT ENDS -
OCO/trunk/drv16/midistrm.cpp
r33 r468 185 185 ULONG MIDISTREAM::StartStream(void) 186 186 { 187 dprintf(("MIDISTREAM::StartStream %lx %lx", (void far *)this, StreamId));187 // dprintf(("MIDISTREAM::StartStream %lx %lx", (void far *)this, StreamId)); 188 188 189 189 state = S_Init; // Reset parser state. … … 206 206 { 207 207 if(ulStreamState == STREAM_STOPPED) { 208 dprintf(("MIDISTREAM::StopStream %lx (already stopped)", StreamId));208 // dprintf(("MIDISTREAM::StopStream %lx (already stopped)", StreamId)); 209 209 pControl->ulTime = GetCurrentTime(); 210 210 return NO_ERROR; 211 211 } 212 212 213 dprintf(("MIDISTREAM::StopStream %lx %lx", (void far *)this, StreamId));213 // dprintf(("MIDISTREAM::StopStream %lx %lx", (void far *)this, StreamId)); 214 214 ulStreamState = STREAM_STOPPED; 215 215 pahw->Stop(StreamId); … … 223 223 ULONG MIDISTREAM::PauseStream(PCONTROL_PARM pControl) 224 224 { 225 dprintf(("MIDISTREAM::PauseStream %lx %lx", (void far *)this, StreamId));225 // dprintf(("MIDISTREAM::PauseStream %lx %lx", (void far *)this, StreamId)); 226 226 if (ulStreamState == STREAM_PAUSED) { // is the stream paused? 227 227 DebugInt3(); … … 239 239 ULONG MIDISTREAM::ResumeStream(void) 240 240 { 241 dprintf(("MIDISTREAM::ResumeStream %lx %lx", (void far *)this, StreamId));241 // dprintf(("MIDISTREAM::ResumeStream %lx %lx", (void far *)this, StreamId)); 242 242 if (ulStreamState != STREAM_PAUSED) { // is the stream paused? 243 243 DebugInt3(); … … 275 275 STREAM(streamtype, filesysnum, mixerStreamId) 276 276 { 277 dprintf(("MIDISTREAM::ctor"));277 // dprintf(("MIDISTREAM::ctor")); 278 278 279 279 // get the pointer to the hardware object … … 281 281 if(pahw) { 282 282 if(pahw->Open(0, streamtype, filesysnum, &StreamId) == FALSE) { 283 dprintf(("MIDISTREAM ctor: open failed!!"));283 // dprintf(("MIDISTREAM ctor: open failed!!")); 284 284 DebugInt3(); 285 285 } -
OCO/trunk/drv16/mixer.cpp
r450 r468 714 714 } 715 715 if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_HEADPHONE)) { 716 MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_HEADPHONE, MAKE_VOLUME_LR(lVolume, rVolume));717 716 } 718 717 if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_AUX)) { -
OCO/trunk/drv16/ossidc16.cpp
r391 r468 718 718 //Signal all active wave playback streams to update their status 719 719 pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_PLAY); 720 while(pStream) { 720 while(pStream) 721 { 721 722 pStream->Process(); 722 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream);723 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream); 723 724 } 724 725 //Signal all active wave capture streams to update their status -
OCO/trunk/drv16/parse.c
r134 r468 75 75 int fCDMute = TRUE; 76 76 77 #ifdef DEBUG 77 #ifdef DEBUG_COM 78 78 extern short int MAGIC_COMM_PORT; 79 79 #endif … … 189 189 fInt3BeforeInit = TRUE; 190 190 break; 191 #ifdef DEBUG 191 #ifdef DEBUG_COM 192 192 case 'D': 193 193 if(pszOption) { -
OCO/trunk/drv16/queue.cpp
r33 r468 38 38 void QUEUEHEAD::PushOnHead(PQUEUEELEMENT pElement) 39 39 { 40 if (pHead == NULL) { 40 if (pHead == NULL) 41 { 41 42 pElement->pNext = NULL; 42 43 pHead = pElement; 43 44 pTail = pElement; 44 45 } 45 else { 46 else 47 { 46 48 pElement->pNext = pHead; 47 49 pHead = pElement; … … 52 54 { 53 55 pElement->pNext = NULL; 54 if (pHead == NULL) { 56 if (pHead == NULL) 57 { 55 58 pHead = pElement; 56 59 pTail = pElement; 57 60 } 58 else { 61 else 62 { 59 63 pTail->pNext = pElement; 60 64 pTail = pElement; … … 66 70 PQUEUEELEMENT temp = pHead; 67 71 68 if (temp) { 72 if (temp) 73 { 69 74 pHead = temp->pNext; 70 75 if (pHead == NULL) … … 83 88 // zapp the next pointer in the element being returned 84 89 // get out of here 85 if (pHead == pTail) { 90 if (pHead == pTail) 91 { 86 92 pHead = NULL; 87 93 pTail = NULL; -
OCO/trunk/drv16/ssm_idc.cpp
r396 r468 29 29 #include "event.hpp" 30 30 #include <include.h> 31 31 #include <devhelp.h> 32 32 33 33 extern "C" int open_strategy; … … 47 47 48 48 case DDCMD_SETUP: { 49 ddprintf(("DDCMD_SETUP"));50 49 if (!pstream) 51 return ERROR_INVALID_STREAM; 50 { 51 dprintf(("DDCMD_SETUP err pstream")); 52 return ERROR_INVALID_STREAM; 53 } 52 54 PDDCMDSETUP p = (PDDCMDSETUP) pCommon; 53 55 SETUP_PARM __far *psp = (SETUP_PARM __far *) p->pSetupParm; … … 56 58 // if there is a flags field in the SETUP_PARM 57 59 // the tell MMPM it can send us 'RECURRING' events.... 58 if (p->ulSetupParmSize > sizeof(ULONG)) { 60 if (p->ulSetupParmSize > sizeof(ULONG)) 61 { 62 // dprintf(("DDCMD_SETUP ParmSize %ld", p->ulSetupParmSize)); 59 63 psp->ulFlags = SETUP_RECURRING_EVENTS; 60 64 } … … 74 78 break; 75 79 } 76 case DDCMD_WRITE: { 77 PDDCMDREADWRITE p=(PDDCMDREADWRITE) pCommon; 80 // Task time 81 case DDCMD_WRITE: 82 { 83 PDDCMDREADWRITE p=(PDDCMDREADWRITE) pCommon; 84 ULONG Space; 78 85 79 if (!pstream) 80 return ERROR_INVALID_STREAM; 81 ulReturnCode = pstream->Write((PSTREAMBUF) p->pBuffer,(unsigned) p->ulBufferSize); 82 ddprintf(("DDCMD_WRITE %lx",p->ulBufferSize)); 83 if (ulReturnCode) 84 return ulReturnCode; 86 if (!pstream) 87 { 88 dprintf(("DDCMD_WRITE err stream %x", (USHORT)pstream)); 89 return ERROR_INVALID_STREAM; 90 } 91 #ifdef PS_Thinking 92 OSS16_WaveGetSpace(pstream->StreamId, &Space); 93 ddprintf(("DDCMD_WRITE %lx space %lx",p->ulBufferSize, Space)); 94 if (Space < p->ulBufferSize) 95 { 96 DevHelp_ProcBlock (pstream->StreamId, 2, 0); 97 ddprintf(("DDCMD_WRITE after %lx space %lx",p->ulBufferSize, Space)); 98 } 99 #endif 100 ulReturnCode = pstream->Write((PSTREAMBUF) p->pBuffer,(unsigned) p->ulBufferSize); 101 // ddprintf(("DDCMD_WRITE %lx rc=%ld",p->ulBufferSize, ulReturnCode)); 102 if (ulReturnCode) 103 return ulReturnCode; 85 104 break; 86 105 } 87 106 case DDCMD_STATUS: { 88 ddprintf(("DDCMD_STATUS"));107 // ddprintf(("DDCMD_STATUS")); 89 108 PDDCMDSTATUS p = (PDDCMDSTATUS) pCommon; 90 109 PSTATUS_PARM p2 = (PSTATUS_PARM) p->pStatus; … … 92 111 return ERROR_INVALID_STREAM; 93 112 p2->ulTime = pstream->GetCurrentTime(); 113 // ddprintf(("DDCMD_STATUS time:%ld",p2->ulTime)); 94 114 break; 95 115 } 96 case DDCMD_CONTROL: { 116 case DDCMD_CONTROL: 117 { 97 118 PDDCMDCONTROL p = (PDDCMDCONTROL) pCommon; 98 119 if (!pstream) 99 return ERROR_INVALID_STREAM; 120 { 121 dprintf(("DDCMD_CONTROL err stream %x", (USHORT)pstream)); 122 return ERROR_INVALID_STREAM; 123 } 100 124 101 switch (p->ulCmd) { 125 switch (p->ulCmd) 126 { 102 127 case DDCMD_START: 103 128 ddprintf(("DDCMD_START")); 104 return pstream->StartStream(); 129 ulReturnCode = pstream->StartStream(); 130 ddprintf(("DDCMD_START End rc=%ld",ulReturnCode)); 131 return ulReturnCode; 105 132 case DDCMD_STOP: 106 133 ddprintf(("DDCMD_STOP")); 134 DevHelp_ProcBlock ((ULONG)p, 2, 0); 107 135 p->ulParmSize=sizeof(ULONG); 108 return pstream->StopStream((PCONTROL_PARM)p->pParm);136 return pstream->StopStream((PCONTROL_PARM)p->pParm); 109 137 case DDCMD_PAUSE: 110 138 ddprintf(("DDCMD_PAUSE")); … … 118 146 return pstream->EnableEvent(p); 119 147 case DDCMD_DISABLE_EVENT: 120 ddprintf(("DDCMD_DISABLE_EVENT"));148 // ddprintf(("DDCMD_DISABLE_EVENT")); 121 149 return pstream->DisableEvent(p); 122 150 case DDCMD_PAUSE_TIME: 123 ddprintf(("DDCMD_PAUSE_TIME"));151 // ddprintf(("DDCMD_PAUSE_TIME")); 124 152 return pstream->PauseStreamTime(); 125 153 case DDCMD_RESUME_TIME: … … 130 158 } /* endswitch */ 131 159 } 132 case DDCMD_REG_STREAM: { 133 ddprintf(("DDCMD_REG_STREAM")); 160 case DDCMD_REG_STREAM: 161 { 162 ddprintf(("DDCMD_REG_STREAM size:%lx countbuf:%lx",((PDDCMDREGISTER) pCommon)->ulBufSize, ((PDDCMDREGISTER) pCommon)->ulNumBufs)); 134 163 if (pstream) 164 { 165 dprintf(("DDCMD_REG_STREAM err stream %x", (USHORT)pstream)); 135 166 return ERROR_HNDLR_REGISTERED; 167 } 136 168 pstream = FindStream_fromFile(((PDDCMDREGISTER) pCommon)->ulSysFileNum); 137 169 if (!pstream) 138 return ERROR_STREAM_CREATION; 170 { 171 dprintf(("DDCMD_REG_STREAM1 err stream %x", (USHORT)pstream)); 172 return ERROR_STREAM_CREATION; 173 } 139 174 ulReturnCode = pstream->Register((PDDCMDREGISTER) pCommon); 140 //dprintf(("DDCMD_EntryPoint: DDCMD_REG_STREAM stream %x returned %d", (USHORT)pCommon->hStream, (USHORT)ulReturnCode));141 175 if (ulReturnCode) 142 return ERROR_STREAM_CREATION; 176 { 177 dprintf(("DDCMD_REG_STREAM err stream %x returned %d", (USHORT)pCommon->hStream, (USHORT)ulReturnCode)); 178 return ERROR_STREAM_CREATION; 179 } 180 ddprintf(("DDCMD_REG_STREAM end size:%lx countbuf:%lx",((PDDCMDREGISTER) pCommon)->ulBufSize, ((PDDCMDREGISTER) pCommon)->ulNumBufs)); 143 181 break; 144 182 } -
OCO/trunk/drv16/strategy.cpp
r253 r468 411 411 delete pstream; 412 412 else 413 ; //### Log unexpected condition.413 dprintf(("Close NULL stream"));; //### Log unexpected condition. 414 414 } 415 415 //****************************************************************************** … … 470 470 break; 471 471 default: 472 dprintf(("Strategy Unk:0x%x", prp->bCommand)); 472 473 prp->usStatus = RPDONE | RPERR | RPGENFAIL; 473 474 } -
OCO/trunk/drv16/stream.cpp
r418 r468 39 39 40 40 //****************************************************************************** 41 // Here we ask to mmpm - give me next buffer 41 42 //****************************************************************************** 42 43 void STREAM::ReturnBuffer(void) … … 51 52 // if this is a write (playback) then set the streamtype and 52 53 // tell the stream handler that we played all of the buffer. 53 if (ulStreamType & STREAM_WRITE) { 54 if (ulStreamType & STREAM_WRITE) 55 { 54 56 shdri.ulFlag = SHD_WRITE_COMPLETE; 55 57 shdri.ulStatus = temp->ulBuffsz; … … 171 173 ULONG STREAM::Register(PDDCMDREGISTER p) 172 174 { 175 ddprintf(("STREAM::Register")); 173 176 hstream = p->hStream; 174 177 pfnSHD = (PFN_SHD) p->pSHDEntryPoint; … … 213 216 { 214 217 218 // dprintf(("STREAM::SetNextEvent")); 215 219 // if there are no events or only one event on the 216 220 // queue just return … … 232 236 // event to time out.. if it is not already on 233 237 // the head of the Event queue then put it there 234 if (pele2 != qhEvent.Head()) { 238 if (pele2 != qhEvent.Head()) 239 { 235 240 cli(); 236 241 qhEvent.PopElement(pele2); -
OCO/trunk/drv16/timer.cpp
r418 r468 159 159 static ULONG hookHandle; 160 160 161 //_asm int 3; 162 dprintf(("TIMER::TIMER Ms:%d IRQ%d", uTargetMSec,pIRQ->GetIRQLevel())); 161 163 // Set initial state - "not functional". 162 164 _eState = TIMER_Disabled; … … 394 396 uMSec = _uInterval_mSec; 395 397 _uCumulativeError += _uIntervalErr_uSec; 396 if (_uCumulativeError >= 1000) { 397 ++uMSec; 398 _uCumulativeError -= 1000; 398 if (_uCumulativeError >= 1000) 399 { 400 //PS++ begin 401 while ( _uCumulativeError >= 1000 ) 402 { 403 ++uMSec; 404 _uCumulativeError -= 1000; 405 } 406 //PS End 399 407 } 400 408 _ulTime += uMSec; -
OCO/trunk/drv16/waudio.cpp
r391 r468 1043 1043 1044 1044 #ifdef DEBUG 1045 //dprintf(("WAVEAUDIO::DevCaps1"));1045 dprintf(("WAVEAUDIO::DevCaps1")); 1046 1046 #endif 1047 1047 … … 1055 1055 pCaps->ulOperation != OPERATION_RECORD ) 1056 1056 { 1057 dprintf(("DevCaps1 unsupported play/record")); 1057 1058 pCaps->ulSupport = UNSUPPORTED_OPERATION; 1058 1059 return; 1059 1060 } 1060 1061 1061 if(pCaps->ulOperation == OPERATION_PLAY) { 1062 if(pCaps->ulOperation == OPERATION_PLAY) 1063 { 1062 1064 pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps; 1063 1065 } … … 1067 1069 if (pCaps->ulChannels != 1 && pCaps->ulChannels != 2) 1068 1070 { 1069 if(pCaps->ulChannels > pWaveCaps->ulMaxChannels) { 1071 if(pCaps->ulChannels > pWaveCaps->ulMaxChannels) 1072 { 1073 dprintf(("DevCaps1 unsupported channel")); 1070 1074 pCaps->ulSupport = UNSUPPORTED_CHANNELS; 1071 1075 return; 1072 1076 } 1073 1077 } 1074 if (pCaps->ulSamplingRate == 0) { 1078 if (pCaps->ulSamplingRate == 0) 1079 { 1080 dprintf(("DevCaps1 unsupported rate")); 1075 1081 pCaps->ulSupport = UNSUPPORTED_RATE; 1076 1082 return; … … 1126 1132 break; 1127 1133 case 24: 1128 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS)) { 1134 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS)) 1135 { 1136 dprintf(("DevCaps1 unsupported 24BPS")); 1129 1137 pCaps->ulSupport = UNSUPPORTED_BPS; 1130 1138 return; … … 1132 1140 break; 1133 1141 case 32: 1134 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS)) { 1142 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS)) 1143 { 1135 1144 pCaps->ulSupport = UNSUPPORTED_BPS; 1145 dprintf(("DevCaps1 unsupported 32BPS")); 1136 1146 return; 1137 1147 } 1138 1148 break; 1139 1149 default: 1150 dprintf(("DevCaps1 unsupported BPS %d",(USHORT)pCaps->ulBitsPerSample)); 1140 1151 pCaps->ulSupport = UNSUPPORTED_BPS; 1141 1152 return; … … 1151 1162 case DATATYPE_RIFF_ALAW: 1152 1163 case A_LAW: 1153 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW)) { 1164 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW)) 1165 { 1166 dprintf(("DevCaps1 unsupported ALAW")); 1154 1167 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1155 1168 return; 1156 1169 } 1157 1170 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1158 if (pCaps->ulBitsPerSample != 8) { 1171 if (pCaps->ulBitsPerSample != 8) 1172 { 1173 dprintf(("DevCaps1 unsupported ALAW BPS8")); 1159 1174 pCaps->ulSupport = UNSUPPORTED_BPS; 1160 1175 return; … … 1167 1182 case DATATYPE_RIFF_MULAW: 1168 1183 case MU_LAW: 1169 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW)) { 1184 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW)) 1185 { 1186 dprintf(("DevCaps1 unsupported MULAW")); 1170 1187 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1171 1188 return; 1172 1189 } 1173 1190 // supported bits per sample are 8 (for unsigned PCM, u-law or A-law ) 1174 if (pCaps->ulBitsPerSample != 8) { 1191 if (pCaps->ulBitsPerSample != 8) 1192 { 1193 dprintf(("DevCaps1 unsupported MULAW BPS8")); 1175 1194 pCaps->ulSupport = UNSUPPORTED_BPS; 1176 1195 return; … … 1182 1201 case DATATYPE_ADPCM_AVC: 1183 1202 case DATATYPE_CT_ADPCM: 1184 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM)) { 1203 if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM)) 1204 { 1205 dprintf(("DevCaps1 unsupported ADPCM")); 1185 1206 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1186 1207 return; 1187 1208 } 1188 1209 // supported bits per sample are 4 1189 if (pCaps->ulBitsPerSample != 4) { 1210 if (pCaps->ulBitsPerSample != 4) 1211 { 1212 dprintf(("DevCaps1 unsupported ADPCM BPS4")); 1190 1213 pCaps->ulSupport = UNSUPPORTED_BPS; 1191 1214 return; … … 1196 1219 1197 1220 default: 1221 dprintf(("DevCaps1 unsupported dattype")); 1198 1222 pCaps->ulSupport = UNSUPPORTED_DATATYPE; 1199 1223 return; … … 1232 1256 pCaps->ulResourceUnits = OSS32_MAX_WAVE_PLAYBACK_STREAMS; 1233 1257 } 1234 dprintf(("R esource Unitsused by playback stream: %d", (int)pCaps->ulResourceUnits));1258 dprintf(("RU used by playback stream: %d", (int)pCaps->ulResourceUnits)); 1235 1259 } 1236 1260 else { … … 1272 1296 { 1273 1297 #ifdef DEBUG 1274 //dprintf(("WAVEAUDIO::DevCaps"));1298 dprintf(("WAVEAUDIO::DevCaps")); 1275 1299 #endif 1276 1300 ddmemmov(lpCaps, &devCaps[current_device], sizeof(OSS32_DEVCAPS)); … … 1352 1376 } 1353 1377 pConfigInfo->ulBytesPerIRQ = ulBytesPerIRQ; 1378 dprintf(("WAVEAUDIO::ConfigDev BytesPerIRQ:%ld",ulBytesPerIRQ)); 1354 1379 1355 1380 … … 1403 1428 #endif 1404 1429 1405 if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS) { 1430 if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS) 1431 { 1406 1432 DebugInt3(); 1407 1433 return FALSE; 1408 1434 } 1409 1435 //Reset cleans up waveout instance 1410 if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS) { 1436 if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS) 1437 { 1411 1438 DebugInt3(); 1412 1439 return FALSE; … … 1510 1537 newlen = tmp; 1511 1538 1512 if ( newlen > length ) 1513 dprintf(("!!!!Back len %ld tmp %ld new %ld",length,tmp,newlen )); 1514 1515 if(newlen >= 4UL*1024UL*1024UL) { 1516 //oh, oh 1517 DebugInt3(); //this shouldn't happen!! 1518 return newlen; 1519 } 1520 /*PS++ 1521 if(newlen && pConfigInfo->fSampleRateConversion) { 1522 newlen = SRATE_CONVERT_LENGTH_INVERT(newlen, pConfigInfo->ulSRatePosition, 1523 pConfigInfo->ulSRateIncrement); 1524 } 1525 */ 1539 // if ( newlen > length ) dprintf(("!!!!Back len %ld tmp %ld new %ld",length,tmp,newlen )); 1540 1541 // dprintf(("Overflow len %ld in:%ld inc:%ld pos:%lx",length, len, pConfigInfo->ulSRateIncrement, pConfigInfo->ulSRatePosition)); 1526 1542 return newlen; 1527 1543 } -
OCO/trunk/drv16/waveplay.cpp
r391 r468 79 79 dprintf(("OSS16_WaveOpen failed!!")); 80 80 #endif 81 // DevHelp_Beep(1000, 100);82 81 DebugInt3(); 83 82 // StreamId = 0; … … 108 107 { 109 108 #ifdef DEBUG 110 dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx \n", StreamId, waveOpened,open_strategy));109 dprintf(("WAVEPLAY::Close stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 111 110 #endif 112 111 #if 0 // fixme to be gone? … … 120 119 force_closed = 0; 121 120 #ifdef DEBUG 122 dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx \n", StreamId, waveOpened,open_strategy));121 dprintf(("WAVEPLAY::Closed stream: %lx, %lx, os: %lx", StreamId, waveOpened,open_strategy)); 123 122 #endif 124 123 return TRUE; … … 141 140 open_strategy = 0UL; 142 141 #ifdef DEBUG 143 dprintf(("OSS16_WAVECLOSE: Success \n"));142 dprintf(("OSS16_WAVECLOSE: Success")); 144 143 #endif /* DEBUG */ 145 144 return TRUE; 146 145 } else 147 146 #ifdef DEBUG 148 dprintf(("OSS16_WAVECLOSE: Error \n"));147 dprintf(("OSS16_WAVECLOSE: Error")); 149 148 #endif /* DEBUG */ 150 149 return FALSE; … … 166 165 int samplesize; 167 166 ULONG ulPCMConsumeRate; 168 intrc;167 USHORT rc; 169 168 170 169 … … 195 194 #endif 196 195 197 if(ulFirstBufSize == 0) { 196 if(ulFirstBufSize == 0) 197 { 198 198 ulFirstBufSize = pConfigInfo->ulFragsize; //no conversion required (see below) 199 if(ulFirstBufSize == 0) { 199 if (ulFirstBufSize == 0) 200 { 200 201 DebugInt3(); 201 202 ulFirstBufSize = 8192; //should never happen! … … 205 206 } 206 207 } 207 else { 208 else 209 { 208 210 //convert size of first buffer 209 211 ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo); … … 212 214 #endif /* DEBUG */ 213 215 } 214 215 216 //Must call this method (i.e. resets sample rate conversion position) 216 217 WAVEAUDIO::ConfigDev(StreamId, pConfigInfo, ulFirstBufSize); … … 225 226 #endif /* DEBUG */ 226 227 227 fragsize = ulPCMConsumeRate/64; //start with 64 irqs/sec 228 fragsize = ulPCMConsumeRate/64; //start with 64 irqs/sec 2756 228 229 229 230 //if the buffer is smaller than our predefined fragmentsize (*2), then correct it … … 232 233 //There's nothing we can do about it as the fragment size can't be changed 233 234 //while the stream is playing. 234 ULONG minimumsize = ulFirstBufSize/2; 235 ULONG minimumsize = ulFirstBufSize/2; //650 235 236 if(minimumsize && minimumsize < fragsize) 236 237 { 237 while(minimumsize < fragsize) fragsize = fragsize / 2; 238 238 while(minimumsize < fragsize) fragsize = fragsize / 2; // 239 239 240 if(fragsize < ulPCMConsumeRate/256) 240 241 {//lower limit; don't accept extremely small buffers … … 257 258 hwparam.ulNumChannels = pConfigInfo->ulHwNumChannels; 258 259 hwparam.ulDataType = QueryOSSDataFormat(OPERATION_PLAY, pConfigInfo->ulDataType, pConfigInfo->ulHwBitsPerSample); 259 rc = ( int)OSS16_WaveSetFormat(StreamId, &hwparam);260 rc = (USHORT)OSS16_WaveSetFormat(StreamId, &hwparam); 260 261 #ifdef DEBUG 261 262 dprintf(("WAVEPLAY:ConfigDev:OSS16_WaveSetFormat . rc = %d",rc)); … … 267 268 #endif 268 269 if( rc != OSSERR_SUCCESS) { 269 // DevHelp_Beep(500, 100);270 dprintf(("WAVEPLAY:ConfigDev: rc %d",rc)); 270 271 DebugInt3(); 271 272 // vladest … … 287 288 288 289 #ifdef DEBUG 289 // dprintf(("WAVEPLAY::Transfer "));290 // dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer)); 290 291 #endif 291 292 … … 299 300 } 300 301 302 //PS very strange 303 if (!ulBytesToTransfer) 304 { 305 return TRUE; 306 } 307 301 308 // if (!waveOpened) return TRUE; 302 309 303 310 if(pConfigInfo->usConversion == CONVERT_NONE) 304 311 { 305 #ifdef DEBUG 306 dprintf(("Transfer. NoConv ulB %ld",ulBytesToTransfer));307 # endif /* DEBUG */308 if(AddBuffer(StreamId, pConfigInfo, pUserBuffer, ulBytesToTransfer, pulBytesTransferred) == FALSE)309 { 312 if (AddBuffer(StreamId, pConfigInfo, pUserBuffer, ulBytesToTransfer, pulBytesTransferred) == FALSE) 313 { 314 #ifdef DEBUG 315 dprintf(("Transfer.False. NoConv ulB %ld tr:%ld",ulBytesToTransfer,*pulBytesTransferred)); 316 #endif /* DEBUG */ 310 317 *pulBytesTransferred = 0; 311 318 return FALSE; 312 319 } 313 320 } 314 else { 315 if(pConfigInfo->pfnConvert) { 321 else 322 { 323 if(pConfigInfo->pfnConvert) 324 { 316 325 ULONG ulCvtBufferSize; 317 326 … … 323 332 ulBytesToTransfer = CONVERT_LENGTH(ulCvtBufferSize, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 324 333 325 if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) { 326 DebugInt3(); 334 if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) 335 { 336 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); 337 // DebugInt3(); 327 338 ulBytesToTransfer = ulBytesToTransfer & ~(pConfigInfo->ulSampleSize-1); 328 339 #ifdef DEBUG 329 dprintf((" New ulBr %ld" , ulBytesToTransfer));340 dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer)); 330 341 #endif 331 342 } … … 338 349 //convert back from conversion to 'real' 339 350 *pulBytesTransferred = CONVERT_LENGTH(*pulBytesTransferred, CONVERSION_INVERT(pConfigInfo->ulConversionFactor)); 340 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) { 341 DebugInt3(); 342 #ifdef DEBUG 343 dprintf(("New pulBr %ld" , pulBytesTransferred)); 344 #endif 351 if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) 352 { 353 #ifdef DEBUG 354 dprintf(("Transfer New pulBr %ld" , pulBytesTransferred)); 355 #endif 356 // DebugInt3(); 345 357 } 346 358 } 347 else { 348 DebugInt3(); 359 else 360 { 361 dprintf(("Transfer Zero pConfigInfo->pfnConvert")); 362 // DebugInt3(); 349 363 return FALSE; 350 364 } … … 363 377 // if (!waveOpened) return TRUE; 364 378 379 //PS Here is inrerrupt time.... 365 380 if (fAPMSuspend) 366 381 { 367 382 #ifdef DEBUG 368 dprintf(("WAVEPLAY::AddBuffer. Suspend state"));383 // dprintf(("WAVEPLAY::AddBuffer. Suspend state")); 369 384 #endif 370 385 apm_resume(); … … 372 387 } 373 388 374 if (pConfigInfo->fSampleRateConversion)389 if (pConfigInfo->fSampleRateConversion) 375 390 { 376 391 ULONG ulCvtBufferSize, ulSampleCount, ulHwSampleCount; … … 378 393 379 394 //bytes to convert is bounded by bytes to transfer & max conversion buffer size 380 ulCvtBufferSize = SRATE_CONVERT_LENGTH(ulBytesToTransfer, pConfigInfo->ulSRatePosition, 381 pConfigInfo->ulSRateIncrement); 395 ulCvtBufferSize = SRATE_CONVERT_LENGTH(ulBytesToTransfer, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 382 396 ulCvtBufferSize = min(CONVERSION_BUFFER_SIZE, ulCvtBufferSize); 383 397 //round to sample boundary 384 398 ulCvtBufferSize &= ~(pConfigInfo->ulHwSampleSize - 1); 385 399 386 if(ulCvtBufferSize == 0) { 400 if(ulCvtBufferSize == 0) 401 { 387 402 *pulBytesTransferred = ulBytesToTransfer; 388 if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) { 403 if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) 404 { 389 405 pConfigInfo->ulSRatePosition -= pConfigInfo->ulSRateIncrement; 390 406 } 391 #ifdef DEBUG392 dprintf(("WAVEPLAY::AddBuffer %lx %lx %lx -> nothing left", ulBytesToTransfer, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement));393 #endif /* DEBUG */394 407 return TRUE; 395 408 } 396 409 pConfigInfo->pfnSRateConv(pUserBuffer, ulCvtBufferSize, pConfigInfo->pSRateConvBuffer, 397 410 pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement); 398 //PS++ !!!!! This don't be !!!!!!!399 411 OSS16_WaveGetSpace(StreamId, &Space); 400 412 if (ulCvtBufferSize > Space) … … 403 415 dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space)); 404 416 #endif 405 for (i=0; i < 0xffffff; i++) 417 while (!Space) 418 for (i=0; i < 0xffffff; i++) 419 { 420 OSS16_WaveGetSpace(StreamId, &Space); 421 if (Space & ~(pConfigInfo->ulHwSampleSize - 1)) break; 422 } 423 #ifdef DEBUG 424 dprintf(("OUT %lx need %ld space:%ld ",i, ulCvtBufferSize, Space)); 425 #endif 426 if (ulCvtBufferSize > Space) 427 ulCvtBufferSize = Space & ~(pConfigInfo->ulHwSampleSize - 1); 428 } 429 if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS 430 || *pulBytesTransferred == 0) 431 { 432 if(rc == OSSERR_BUFFER_FULL) 406 433 { 407 OSS16_WaveGetSpace(StreamId, &Space);408 if (ulCvtBufferSize <= Space) break;409 }410 #ifdef DEBUG411 dprintf(("OUT %ld need %ld space:%ld Last:%ld",i, ulCvtBufferSize, Space,LastSpace));412 #endif413 }414 if((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS ||415 *pulBytesTransferred == 0)416 {417 if(rc == OSSERR_BUFFER_FULL) {418 434 GetSpace(StreamId, pConfigInfo, &Space); 419 435 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space)); 420 436 } 421 else dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc)); 437 #ifdef DEBUG 438 else 439 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc)); 440 #endif 422 441 *pulBytesTransferred = 0; 423 442 return FALSE; … … 437 456 // if the last sample is still needed for the next run, then adjust sample count and 438 457 // sample rate conversion position 439 if(lSRatePosition < 0) { 458 if(lSRatePosition < 0) 459 { 440 460 dprintf4(("WAVEPLAY::AddBuffer; sratepos < 0")); 441 461 dprintf4(("ulHwSampleCount %lx pConfigInfo->ulSRateIncrement %lx ulSampleCount %lx", ulHwSampleCount, pConfigInfo->ulSRateIncrement, ulSampleCount)); 442 462 pConfigInfo->ulSRatePosition = 0; 443 463 } 444 else { 464 else 465 { 445 466 pConfigInfo->ulSRatePosition = (ULONG)lSRatePosition; 446 467 } … … 451 472 if( (rc=OSS16_WaveAddBuffer(StreamId, pUserBuffer, ulBytesToTransfer, pulBytesTransferred)) != OSSERR_SUCCESS) 452 473 { 453 *pulBytesTransferred = 0; 454 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer failed due to an error rc=%x",(USHORT)rc)); 455 return FALSE; 456 } 474 *pulBytesTransferred = 0; 475 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer failed due to an error rc=%x",(USHORT)rc)); 476 dprintf(("StreamID:%x PUB:%lx BtTr:%ld",(USHORT)StreamId, pUserBuffer, ulBytesToTransfer)); 477 return FALSE; 478 } 457 479 } 458 480 return TRUE; … … 489 511 // if (!waveOpened) return TRUE; 490 512 491 if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) { 513 if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) 514 { 492 515 *pulStreamSpace = 0; 493 516 #ifdef DEBUG … … 496 519 return FALSE; 497 520 } 498 LastSpace = space; 521 522 // dprintf(("GetSpace: len %ld",space)); 499 523 cvt = ConvertLengthInvert(space, pConfigInfo); 500 524 //round to sample boundary … … 509 533 ULONG space,cvt; 510 534 511 if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) { 535 if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) 536 { 512 537 *pulHwPtr = 0; 513 538 #ifdef DEBUG … … 516 541 return FALSE; 517 542 } 543 518 544 cvt = ConvertLengthInvert(space, pConfigInfo); 519 545 //round to sample boundary 520 *pulHwPtr = cvt & ( ~(pConfigInfo->ulSampleSize - 1));546 *pulHwPtr = cvt & (~(pConfigInfo->ulSampleSize - 1)); 521 547 return TRUE; 522 548 } -
OCO/trunk/drv16/waverec.cpp
r391 r468 132 132 pConfigInfo->ulFragsize = fragsize; 133 133 134 dprintf(("WAVEREC::ConfigDev: Fragment size %d", (USHORT)fragsize));134 // dprintf(("WAVEREC::ConfigDev: Fragment size %d", (USHORT)fragsize)); 135 135 136 136 hwparam.ulSampleRate = pConfigInfo->ulHwSampleRate; -
OCO/trunk/drv16/wavestrm.cpp
r396 r468 115 115 // if there is a buffer on the InProcess Queue 116 116 // only check the first one as any others are just waiting..... 117 if (qhInProcess.IsElements()) { 117 if (qhInProcess.IsElements()) 118 { 118 119 // if any data has been written from this stream buffer 119 120 ptempbuff = (PSTREAMBUFFER)qhInProcess.Head(); 120 if (ptempbuff->ulDonepos) { 121 _vRealignBuffer(endpos, ptempbuff); 122 } /* end if ulDonepos */ 121 if (ptempbuff->ulDonepos) 122 { 123 _vRealignBuffer(endpos, ptempbuff); 124 } /* end if ulDonepos */ 123 125 } 124 126 … … 131 133 // If the rc is 1 then put it on the head of the InProcess queue. 132 134 133 while (qhDone.IsElements()) { 135 while (qhDone.IsElements()) 136 { 134 137 pTempHead->PushOnHead(qhDone.PopHead()); 135 138 } /* endwhile */ 136 139 137 while (pTempHead->IsElements()) { 140 while (pTempHead->IsElements()) 141 { 138 142 usRC = _vRealignBuffer(endpos, (PSTREAMBUFFER)pTempHead->Head()); 139 143 if (usRC) … … 159 163 #pragma on (unreferenced) 160 164 { 161 ULONG space, byteswritten ;162 163 dgprintf(("AddBuffers"));165 ULONG space, byteswritten, curspace,i; 166 167 // dgprintf(("AddBuffers %d",fFirst == TRUE?1:2)); 164 168 165 169 byteswritten = 0; 166 if (ulStreamType & STREAM_WRITE) { 170 if (ulStreamType & STREAM_WRITE) 171 { 167 172 // get the space available in the hardware buffer 168 173 // only call GetSpace once because the amount of free space in … … 170 175 // could keep us in this loop writing 4 or 8 bytes at a time. 171 176 // In extream cases we will stay stuck in this loop long enough to casue a trap rjj 172 if(pahw->GetSpace(StreamId, &_configinfo, &space) == FALSE) { 173 dgprintf(("WAVESTREAM::AddBuffers Error 1")); 177 if (pahw->GetSpace(StreamId, &_configinfo, &space) == FALSE) 178 { 179 // dgprintf(("WAVESTREAM::AddBuffers Error 1")); 174 180 return; 175 181 } 176 space &= ( ~(_configinfo.ulSampleSize - 1)); 177 while (space && qhInProcess.IsElements()) { 178 byteswritten = AddBuffer(space); 182 space &= (~(_configinfo.ulSampleSize - 1)); 183 curspace = space; 184 while (space && qhInProcess.IsElements()) 185 { 186 // Fisrt time going in task time 187 // for I7 need give time for interrupt time 188 if (fFirst == TRUE) //PS+++ 189 { 190 DevHelp_ProcBlock (space, 20, 0); 191 } 192 // dgprintf(("AddBuffers write %ld SSize:%ld %d",space, _configinfo.ulSampleSize, fFirst == TRUE?1:2)); 193 byteswritten = AddBuffer(space > curspace? curspace: space); 194 if (pahw->GetSpace(StreamId, &_configinfo, &curspace) == FALSE) 195 { 196 // dgprintf(("WAVESTREAM::AddBuffers Error 2")); 197 return; 198 } 179 199 if(byteswritten == (ULONG)-1) 180 200 break; 201 if (!curspace) 202 { 203 curspace = _configinfo.ulSampleSize; 204 } 181 205 space -= byteswritten; 182 206 space &= ( ~(_configinfo.ulSampleSize - 1)); … … 184 208 185 209 } 210 // dgprintf(("AddBuffers %d End",fFirst == TRUE?1:2)); 186 211 } 187 212 //****************************************************************************** … … 197 222 ULONG Buff_left, byteswritten, start_pos; 198 223 199 ddprintf(("AddBuffer"));224 // ddprintf(("AddBuffer")); 200 225 // make sure we have a buffer to copy from..... 201 if (!pTemp) { 226 if (!pTemp) 227 { 202 228 return (ULONG)-1; 203 229 } … … 212 238 } 213 239 240 if (!pTemp->ulBuffsz || !space) 241 { 242 dgprintf(("WAVESTREAM::AddBuffer NULL, Bufsz:%ld Space:%ld",pTemp->ulBuffsz, space)); 243 //PS+++ if is ZERO do nothing and ask for give new buffer, See REMARK in mmpm2.inf 244 qhDone.PushOnTail(qhInProcess.PopHead()); 245 // DebugInt3(); 246 return 0; 247 } 214 248 // get the buffer pointer and amount of data remaining 215 249 pdataBuf = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos; … … 217 251 Buff_left = min(Buff_left, space); 218 252 219 if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE) { 253 if (pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE) 254 { 220 255 dgprintf(("AddBuffer: pahw->Transfer failed!!")); 256 // DebugInt3(); 221 257 return (ULONG)-1; 222 258 } 223 if(byteswritten == 0) { 259 if (byteswritten == 0) 260 { 261 dgprintf(("AddBuffer: No more room!!")); 262 // DebugInt3(); 224 263 return (ULONG)-1; //no more room 225 264 } … … 231 270 232 271 // check to see if the buffer has been copied and needs to be put on the done queue 233 if (pTemp->ulBuffpos >= (pTemp->ulBuffsz & 0xFFFFFFFC)) { 272 if (pTemp->ulBuffpos >= (pTemp->ulBuffsz & 0xFFFFFFFC)) 273 { 234 274 qhDone.PushOnTail(qhInProcess.PopHead()); 235 275 } 236 dgprintf(("WAVESTREAM::AddBuffer sz %lx, bywr %lx dp %lx", Buff_left, byteswritten,pTemp->ulDonepos));276 // dgprintf(("WV::AddBuffer sz %lx, bywr %lx dp %lx", Buff_left, byteswritten,pTemp->ulDonepos)); 237 277 return byteswritten; 238 278 } … … 255 295 256 296 // read wave data 257 if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &bytesread) == FALSE) { 297 if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &bytesread) == FALSE) 298 { 258 299 dprintf(("_vReadAudioBuf: pahw->Transfer failed!!")); 259 300 return FALSE; … … 284 325 // can be returned and finally process any events pending. 285 326 //****************************************************************************** 327 //USHORT ProcNumber = 0; 286 328 void DBGCALLCONV WAVESTREAM::Process(void) 287 329 { 288 330 PSTREAMBUFFER ptemp; 289 331 ULONG ulCurBytesProcessed = 0; 290 // ULONG bytesinc; 332 // USHORT CurProcNumber = ProcNumber++; 333 ULONG space; 291 334 292 335 #ifdef DEBUG 293 ddprintf(("WAVESTREAM::Process"));336 // ddprintf(("WAVESTREAM::Process %d",CurProcNumber)); 294 337 #endif 295 338 … … 304 347 return; 305 348 } 306 ddprintf(("StPos: %lx", ulCurBytesProcessed));349 // ddprintf(("StPos: %lx", ulCurBytesProcessed)); 307 350 // save the bytes processed in the stream object 308 351 _ulBytesProcessed = ulCurBytesProcessed; 309 352 353 // if ((pahw->GetSpace(StreamId, &_configinfo, &space) != FALSE) && (space > _configinfo.ulBytesPerIRQ)) 310 354 switch (ulStreamType & STREAM_WRITE) { 311 355 … … 322 366 case STREAM_WRITE: 323 367 { 324 if(qhDone.IsElements()) { 368 if (qhDone.IsElements()) 369 { 325 370 ptemp = (PSTREAMBUFFER)qhDone.Head(); 326 371 while ((_ulBytesProcessed + _configinfo.ulBytesPerIRQ) >= ptemp->ulDonepos) … … 330 375 } 331 376 } 332 if (qhInProcess.IsElements()){ 377 if (qhInProcess.IsElements()) 378 { 333 379 AddBuffers(FALSE); 334 380 } … … 345 391 346 392 ProcessEvents(); 393 // ddprintf(("WAVESTREAM::Process %d End",CurProcNumber)); 347 394 } 348 395 //****************************************************************************** … … 353 400 { 354 401 PSTREAMBUFFER pStreamBuf = new STREAMBUFFER(uLength, pbuf); 355 402 356 403 return Write(pStreamBuf); 357 404 } … … 390 437 ULONG Seconds, MilliSeconds, Overflow, Processed; 391 438 439 //PS++ optimize code 440 Processed = _ulBytesProcessed; 392 441 if (ulStreamState == STREAM_STREAMING) // if the stream is active 393 442 { 394 if (ulStreamType & STREAM_WRITE)395 {396 if(pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE)397 {398 DebugInt3();443 if (ulStreamType & STREAM_WRITE) 444 { 445 if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 446 { 447 // DebugInt3(); 399 448 Processed = _ulBytesProcessed; //last known position 400 } 401 } 402 else 403 Processed = _ulBytesProcessed; 404 } 405 else 406 Processed = _ulBytesProcessed; 449 } 450 } 451 } 407 452 408 453 // if we haven't processed anything then just return … … 411 456 return(_ulTimeBase); 412 457 413 Seconds = Processed / _configinfo.ulPCMConsumeRate;458 Seconds = Processed / _configinfo.ulPCMConsumeRate; 414 459 Overflow = Processed - (Seconds * _configinfo.ulPCMConsumeRate); 415 460 MilliSeconds = (Overflow * 1000) / _configinfo.ulPCMConsumeRate; 416 461 MilliSeconds += (Seconds * 1000); 417 return (MilliSeconds + _ulTimeBase);462 return (MilliSeconds + _ulTimeBase); 418 463 } 419 464 //****************************************************************************** … … 423 468 ULONG Processed; 424 469 470 //PS++ optimize code 471 Processed = _ulBytesProcessed; 425 472 if (ulStreamState == STREAM_STREAMING) // if the stream is active 426 473 { 427 if (ulStreamType & STREAM_WRITE) { 428 if(pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 429 { 474 if (ulStreamType & STREAM_WRITE) 475 { 476 if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE) 477 { 430 478 DebugInt3(); 431 479 Processed = _ulBytesProcessed; //last known position 432 }480 } 433 481 } 434 else 435 Processed = _ulBytesProcessed; 436 } 437 else 438 Processed = _ulBytesProcessed; 482 } 439 483 440 484 return Processed; … … 446 490 ULONG writepos = 0; 447 491 492 // May be lock? 448 493 cli(); 449 494 PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Tail(); 450 495 451 if(!pTemp) { 496 if(!pTemp) 497 { 452 498 pTemp = (PSTREAMBUFFER)qhInProcess.Head(); 453 499 } 454 if(pTemp) { 500 if(pTemp) 501 { 455 502 writepos = pTemp->ulBuffpos; 456 503 } … … 478 525 #endif 479 526 480 if(ulStreamState == STREAM_STREAMING) { 527 if(ulStreamState == STREAM_STREAMING) 528 { 481 529 ddprintf(("StartStream: already playing!!")); 482 530 return NO_ERROR; … … 485 533 // configure the wave device 486 534 // (NOTE: Must call this function; sample rate position is reset there) 487 if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE) { 535 if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE) 536 { 488 537 ddprintf(("StartStream: ConfigDev failed!!")); 489 goto fail; 538 return ERROR_INSUFF_BUFFER; 539 // goto fail; 490 540 } 491 541 // prepare wave device for playback/recording 492 if(pahw->Prepare(StreamId) == FALSE) { 542 if(pahw->Prepare(StreamId) == FALSE) 543 { 493 544 ddprintf(("StartStream: Prepare failed!!")); 494 545 goto fail; … … 499 550 ulStreamState = STREAM_STREAMING; 500 551 //Adding the first buffer also starts playback 501 if(ulStreamType == STREAM_WAVE_PLAY) { 552 if (ulStreamType == STREAM_WAVE_PLAY) 553 { 554 pahw->SetVolume(StreamId, getMixerStreamId(), volume); //PS 502 555 AddBuffers(TRUE); 503 556 //Must set volume after adding buffers (voices inside sblive driver might not 504 557 //be allocated otherwise (first start) ) 505 dprintf(("SetVolume %lx",volume)); 506 pahw->SetVolume(StreamId, getMixerStreamId(), volume); 507 } 508 else { 558 // dprintf(("SetVolume %lx",volume)); 559 // PS, removing to high 560 // pahw->SetVolume(StreamId, getMixerStreamId(), volume); 561 } 562 else 563 { 509 564 ulSavedInputGain = pahw->QueryVolume(StreamId, getMixerStreamId()); 510 565 pahw->SetInputSrc(StreamId, getMixerStreamId(), inputsrc); 511 566 pahw->SetVolume(StreamId, getMixerStreamId(), inputgain); 512 567 513 if(pahw->Start(StreamId) != TRUE) { 568 if(pahw->Start(StreamId) != TRUE) 569 { 514 570 dprintf(("pahw->Start failed!!")); 515 571 goto fail; 516 572 } 517 573 } 518 ddprintf(("WAVESTREAM::StartStream %lx ", StreamId));574 ddprintf(("WAVESTREAM::StartStream %lx End", StreamId)); 519 575 return NO_ERROR; 520 576 … … 665 721 if(DevHelp_VMAlloc((VMDHA_FIXED | VMDHA_CONTIG), CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0) 666 722 { 667 //dgprintf(("Error in DevHelp_VMAlloc Conversion Buffer"));723 dgprintf(("Error in DevHelp_VMAlloc Conversion Buffer")); 668 724 DebugInt3(); //should never happen!! 669 725 _configinfo.usConversion = CONVERT_NONE; … … 676 732 LIN linAddr; 677 733 678 if (DevHelp_VMAlloc((VMDHA_FIXED | VMDHA_CONTIG), CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0)734 if (DevHelp_VMAlloc((VMDHA_FIXED | VMDHA_CONTIG), CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0) 679 735 { 680 //dgprintf(("Error in DevHelp_VMAlloc SR Conversion Buffer"));681 DebugInt3(); //should never happen!!736 dgprintf(("Error in DevHelp_VMAlloc SR Conversion Buffer")); 737 DebugInt3(); //should never happen!! 682 738 } 683 739 else _configinfo.pSRateConvBuffer = linAddr; -
OCO/trunk/include/dbgos2.h
r396 r468 25 25 #define ddprintf(a) if(dbglevel >= 1) PrintfOut a 26 26 #define dgprintf(a) if(dbglevel >= 1) PrintfOut a 27 #define DebugInt3() ;// _asm int 3 27 28 #ifdef DEBUG 29 #define DebugInt3() //_asm int 3 30 #else 31 #define DebugInt3() _asm int 3 32 #endif 28 33 29 34 #ifdef DEBUG
Note:
See TracChangeset
for help on using the changeset viewer.
