Changeset 468


Ignore:
Timestamp:
Nov 4, 2009, 4:21:24 PM (16 years ago)
Author:
pasha
Message:

Rebuild buffers supply, fix DDCMD_WRITE with len=0 in WAVE chain, remove/add debug output, change DebugInt3 for debug/nondebug version, move unused code to unused directore

Location:
OCO/trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • OCO/trunk/drv16/apmevent.cpp

    r221 r468  
    2828USHORT far APMEvent(APM_EVENT_MSG far *peventmsg)
    2929{
    30 #ifdef DEBUG
     30#ifdef DEBUG_APM
    3131    dprintf(("APM_event parm 1 %d, parm 2 %d", peventmsg->parm1, peventmsg->parm2));
    3232#endif
     
    8080USHORT DBGCALLCONV APM_suspend(USHORT state)
    8181{
    82 #ifdef DEBUG
     82#ifdef DEBUG_APM
    8383  dprintf(("APM_suspend %d", state));
    8484#endif
     
    112112USHORT DBGCALLCONV APM_resume(USHORT state)
    113113{
    114 #ifdef DEBUG
     114#ifdef DEBUG_APM
    115115  dprintf(("APM_resume %d", state));
    116116#endif
     
    163163        if((ret = APM_COMMAND(&APM_Reg_Req)) != 0)
    164164        {
    165 #ifdef DEBUG
     165#ifdef DEBUG_APM
    166166            dprintf(("APM_Init: cant register at APM.SYS: %d", ret));
    167167#endif
     
    172172    {
    173173        APM_Enabled = 0;
    174 #ifdef DEBUG
     174#ifdef DEBUG_APM
    175175        dprintf(("APM_Init: cant attach to APM.SYS"));
    176176#endif
    177177    }
    178178
    179 #ifdef DEBUG
     179#ifdef DEBUG_APM
    180180    dprintf(("APM_enabled %d", APM_Enabled));
    181181#endif
  • OCO/trunk/drv16/commdbg.c

    r288 r468  
    339339}
    340340
    341 #ifdef DEBUG
     341#ifdef DEBUG_COM
    342342
    343343void StringOut(char far *DbgStr)
  • OCO/trunk/drv16/convert.asm

    r466 r468  
    1 .386
    2 .seq
     1            .586
     2            .seq
    33
    44EXTRN         DOS32FLATDS:ABS
     5
    56
    67SetupParameters MACRO
     
    3738            pop  bp
    3839ENDM
    39 
     40;******************************************************************************
     41; PS 27.20.2009
     42; Check len for zero
     43;******************************************************************************
     44CheckLenZero       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                                               ;
     50RightPar:                                                            ;
     51                   EndM                                              ;
     52;******************************************************************************
     53; Check ecx to 1
     54;******************************************************************************
     55CheckLenOne        Macro                                             ;
     56                   Local    RightPar                                 ;
     57                   cmp      ecx, 1                                   ; Here 1, we have hext shr
     58                   jg       short   RightPar                         ;
     59                   PopRegs                                           ;
     60                   ret                                               ;
     61RightPar:                                                            ;
     62                   EndM                                              ;
     63;******************************************************************************
     64; Check ecx to 3
     65;******************************************************************************
     66CheckLenThree      Macro                                             ;
     67                   Local    RightPar                                 ;
     68                   cmp      ecx, 3                                   ; Here 1, we have hext shr
     69                   jg       short   RightPar                         ;
     70                   PopRegs                                           ;
     71                   ret                                               ;
     72RightPar:                                                            ;
     73                   EndM                                              ;
     74;******************************************************************************
    4075_HEADER       segment dword public use16 'DATA'
    4176_HEADER       ends
     
    119154                PUBLIC _Convert16SignedTo8UnsignedStereoMono
    120155                PUBLIC _Convert16UnsignedTo8SignedStereoMono               
    121                
    122156pSrc       EQU DWORD PTR [bp+4]
    123157ulSrcBytes EQU DWORD PTR [bp+8]
     
    127161;void NEAR CDECL ConvertNone(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest);
    128162;*******************************************************************************
    129 _ConvertNone PROC NEAR
    130             ret
    131 _ConvertNone ENDP
    132 
     163_ConvertNone       PROC NEAR                                         ;
     164                   ret                                               ;
     165_ConvertNone       ENDP                                              ;
    133166;******************************************************************************
    134167;******************************************************************************
     
    145178            PushRegs
    146179            SetupParameters
    147 
     180                   CheckLenZero                                      ; PS
    148181            xor  ax, ax
    149182;unoptimized
     
    169202            PushRegs
    170203            SetupParameters
     204                   CheckLenZero                                      ; PS
    171205
    172206            xor  ax, ax
     
    192226            PushRegs
    193227            SetupParameters
     228                   CheckLenZero                                      ; PS
    194229
    195230            xor  ax, ax
     
    216251            PushRegs
    217252            SetupParameters
     253                   CheckLenZero                                      ; PS
    218254           
    219255;unoptimized
     
    241277            PushRegs
    242278            SetupParameters
     279                   CheckLenZero                                      ; PS
    243280           
    244281;unoptimized
     
    267304            PushRegs
    268305            SetupParameters
     306                   CheckLenZero                                      ; PS
    269307           
    270308;unoptimized
     
    294332;void NEAR CDECL Convert8MonoTo16StereoSignChange(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest);
    295333;*******************************************************************************
    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                                   ;
     339loopm8st16signchange:                                                ;
     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                               ;
    338353
    339354;*******************************************************************************
     
    343358            PushRegs
    344359            SetupParameters
     360
     361                   CheckLenOne                                       ; PS
    345362            shr  ecx, 1                 ;sample size = 2 bytes
    346363
     
    374391            PushRegs
    375392            SetupParameters
     393                   CheckLenOne                                       ; PS
    376394            shr  ecx, 1                 ;sample size = 2 bytes
    377395
     
    403421            PushRegs
    404422            SetupParameters
     423                   CheckLenOne                                       ; PS
    405424            shr  ecx, 1                 ;sample size = 2 bytes
    406425
     
    435454            PushRegs
    436455            SetupParameters
     456                   CheckLenOne                                       ; PS
    437457            shr  ecx, 1                 ;sample size = 2 bytes
    438458
     
    465485            PushRegs
    466486            SetupParameters
     487                   CheckLenOne                                       ; PS
    467488            shr  ecx, 1                 ;sample size = 2 bytes
    468489
     
    496517            PushRegs
    497518            SetupParameters
     519                   CheckLenOne                                       ; PS
    498520            shr  ecx, 1                 ;sample size = 2 bytes
    499521
     
    527549            PushRegs
    528550            SetupParameters
     551                   CheckLenOne                                       ; PS
    529552            shr  ecx, 1                 ;sample size = 2 bytes
    530553
     
    558581            PushRegs
    559582            SetupParameters
     583                   CheckLenOne                                       ; PS
    560584            shr  ecx, 1                 ;sample size = 2 bytes
    561585
     
    601625            PushRegs
    602626            SetupParameters
     627                   CheckLenOne                                       ; PS
    603628
    604629            shr  ecx, 1                 ;sample size = 2           
     
    626651            PushRegs
    627652            SetupParameters
     653                   CheckLenOne                                       ; PS
    628654
    629655            shr  ecx, 1                 ;sample size = 2           
     
    650676            PushRegs
    651677            SetupParameters
     678                   CheckLenOne                                       ; PS
    652679
    653680            shr  ecx, 1                 ;sample size = 2           
     
    673700;void NEAR cdecl Convert16MonoTo16Stereo(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest);
    674701;*******************************************************************************
    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           
     707loopm16m16st:                                                        ;
     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                                        ;
    708720;*******************************************************************************
    709721;void NEAR cdecl Convert16MonoTo16StereoSignChange(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest);
    710722;*******************************************************************************
    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           
     728loopm16m16stsignchange:                                              ;
     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                              ;
    739742;*******************************************************************************
    740743;void NEAR cdecl Convert16MonoTo8Stereo(LINEAR pSrc, ULONG ulSrcBytes, LINEAR pDest);
     
    743746            PushRegs
    744747            SetupParameters
     748                   CheckLenOne                                       ; PS
    745749            shr  ecx, 1                 ;sample = 2 bytes
    746750
     
    771775            PushRegs
    772776            SetupParameters
     777                   CheckLenOne                                       ; PS
    773778            shr  ecx, 1                 ;sample = 2 bytes
    774779
     
    801806            PushRegs
    802807            SetupParameters
     808                   CheckLenThree                                     ; PS
     809
    803810            shr  ecx, 2                 ;sample size = 4 bytes
    804811
     
    832839            PushRegs
    833840            SetupParameters
     841                   CheckLenThree                                     ; PS
    834842            shr    ecx, 2                 ;sample size = 4 bytes
    835843
     
    860868            PushRegs
    861869            SetupParameters
     870                   CheckLenThree                                     ; PS
    862871            shr  ecx, 2                 ;sample size = 4 bytes
    863872
     
    891900            PushRegs
    892901            SetupParameters
     902                   CheckLenThree                                     ; PS
    893903            shr  ecx, 2                 ;sample size = 4 bytes
    894904
     
    920930            PushRegs
    921931            SetupParameters
     932                   CheckLenThree                                     ; PS
    922933            shr  ecx, 2                 ;sample size = 4 bytes
    923934
     
    951962            PushRegs
    952963            SetupParameters
     964                   CheckLenThree                                     ; PS
    953965            shr  ecx, 2                 ;sample size = 4 bytes
    954966
     
    982994            PushRegs
    983995            SetupParameters
     996                   CheckLenThree                                     ; PS
    984997            shr  ecx, 2                 ;sample size = 4 bytes
    985998
     
    10101023            PushRegs
    10111024            SetupParameters
     1025                   CheckLenThree                                     ; PS
    10121026            shr  ecx, 2                 ;sample size = 4 bytes
    10131027
  • OCO/trunk/drv16/dwavestrm.cpp

    r33 r468  
    4444
    4545    pStream = (PDWAVESTREAM)FindStream_fromFile(ulSysFileNum);
    46     if(pStream == NULL) {
     46    if (pStream == NULL)
     47    {
    4748        dprintf(("HookHandler stream %lx not found!", (ULONG) ulSysFileNum));
    4849        DebugInt3();
     
    7980    pStreamBuf = new STREAMBUFFER(uLength, (PSTREAMBUF)0, fLooping);
    8081    if(pStreamBuf == NULL) {
     82        dprintf(("DWAVESTREAM::Write StreamBuf"));
    8183        DebugInt3();
    8284        return 1;
     
    8789    rc = DevHelp_VirtToLin(SELECTOROF(pLock), OFFSETOF(pLock), &linLock);
    8890    if(rc) {
     91        dprintf(("DWAVESTREAM::Write VirtToLin"));
    8992        DebugInt3();
    9093        delete pStreamBuf;
     
    9497    rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE, (LIN)pbuf, uLength, -1L, linLock, (PULONG)&PageListCount);
    9598    if(rc) {
     99        dprintf(("DWAVESTREAM::Write VMLock"));
    96100        DebugInt3();
    97101        delete pStreamBuf;
     
    101105    rc = DevHelp_VMProcessToGlobal(VMDHGP_WRITE, (LIN)pbuf, uLength, (PLIN)&linAddr);
    102106    if(rc) {
     107        dprintf(("DWAVESTREAM::Write ProcToGlob"));
    103108        DebugInt3();
    104109        DevHelp_VMUnLock(linLock);
     
    119124   if(temp)
    120125   {
    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
    122128            qhReturn.PushOnTail((PQUEUEELEMENT)temp);
    123129            DevHelp_ArmCtxHook(ulSysFileNum, hCtxHook);
    124130        }
    125         else {
     131        else
     132        {
    126133            DevHelp_VMFree((LIN)temp->pBuffptr);
    127134            DevHelp_VMUnLock(temp->linLock);
     
    136143    hSem = pReg->hStream;
    137144
     145    dprintf(("DWAVESTREAM::Register"));
    138146    if(DevHelp_OpenEventSem(hSem) != 0) {
    139147        dprintf(("DevHlp_OpenEventSem %lx failed!", hSem));
     
    173181        Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
    174182
    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           }
    179189        if(fFirst) {
    180190             space = min(space, 4*_configinfo.ulFragsize);
     
    255265   WAVESTREAM(streamtype, pinit, filesysnum, mixerStreamId), fError(FALSE), hCtxHook(0), hSem(0)
    256266{
    257     if(DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook)) {
     267    if (DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook))
     268    {
     269        dprintf(("DWAVESTREAM::DWAVESTREAM AllocCtx"));
    258270        DebugInt3();
    259271        fError = TRUE;
  • OCO/trunk/drv16/fmsynth.cpp

    r252 r468  
    9595int FMSYNTH::readByte(OSSSTREAMID StreamId)
    9696{
     97    dprintf(("FMSYNTH::readByte"));
    9798    DebugInt3();
    9899    return -1;
  • OCO/trunk/drv16/ioctl.cpp

    r33 r468  
    7272      // stream idle bit in the stream state then write the sysfilenum
    7373      // 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;
    8182   }
    8283       // call FindStream_fromFile to see if there is already a stream
     
    182183   //HACK BEGIN
    183184   if(pfnSHD) {
    184        dprintf(("Stream was previously registered; reregister it"));
     185//       dprintf(("Stream was previously registered; reregister it"));
    185186       pstream->pfnSHD  = pfnSHD;
    186187       pstream->hstream = hstream;
     
    201202   ULONG ulDevicetype;
    202203
     204#ifdef DEBUG
     205//   dprintf(("IACapability: src type: %d, op %d",(USHORT)p->ulDataType, (USHORT)p->ulOperation));
     206#endif
     207
    203208   // get the hardware device type based on the datatype and operation
    204209   ulDevicetype = GetHardwareType((USHORT)p->ulDataType,(USHORT)p->ulOperation,LDev);
    205210
    206211#ifdef DEBUG
    207 //   dprintf(("dev type: %d, ldev %d",ulDevicetype, LDev));
     212//   dprintf(("IACapability: dev type: %d, ldev %d",ulDevicetype, LDev));
    208213#endif
    209214
     
    215220   // bailout if no hardware object is returned..
    216221   pHWobj = GetHardwareDevice(ulDevicetype);
    217    if (pHWobj) {
     222   if (pHWobj)
     223   {
    218224      pHWobj->DevCaps(p);
    219225      if (p->ulSupport != SUPPORT_SUCCESS) {
     226         dprintf(("IACapability: Error support"));
    220227         prp->usStatus |= RPERR;
    221228      }
     
    223230   else {
    224231#ifdef DEBUG
    225        dprintf(("Error getting hardware object"));
     232       dprintf(("IACapability: Error get HW obj"));
    226233#endif
    227234      p->ulSupport = UNSUPPORTED_DATATYPE;
     
    248255   ULONG               addr;
    249256
    250    if (p->usIOCtlRequest != AUDIO_CHANGE) {
     257   if (p->usIOCtlRequest != AUDIO_CHANGE)
     258   {
     259       dprintf(("IAudioControl: Error support req:%x",p->usIOCtlRequest));
    251260       p->sReturnCode = INVALID_REQUEST;
    252261       prp->usStatus |= RPERR | RPBADCMD;
     
    260269   addr  = OFFSETOF(pAudChange);
    261270   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));
    264274       p->sReturnCode = INVALID_REQUEST;
    265275       prp->usStatus |= RPERR | RPBADCMD;
     
    271281   addr  = OFFSETOF(pMasterVol);
    272282   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));
    275286       p->sReturnCode = INVALID_REQUEST;
    276287       prp->usStatus |= RPERR | RPBADCMD;
     
    280291   pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);
    281292   if(pStream == NULL) {
    282        dprintf(("IoctlAudioControl stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));
     293       dprintf(("IAudioControl stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));
    283294       DebugInt3();
    284295       return;
     
    287298       pStream->SetProperty(PROPERTY_BALANCE, pAudChange->lBalance);
    288299
    289    if(pAudChange->lVolume != AUDIO_IGNORE) {
     300   if (pAudChange->lVolume != AUDIO_IGNORE)
     301   {
    290302       // stream volume ranges from 0 to 0x7FFFFFFF (linear)
    291303       volume = pAudChange->lVolume >> 16UL;
     
    295307   }
    296308
    297    if(pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE)
     309   if (pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE)
    298310   {
    299311       // master volume ranges from 0 to 0x7FFF (linear)
    300312       volume = pMasterVol->usMasterVolume;
    301313       volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL;
    302        if(volume > OSS32_MAX_VOLUME) {
     314       if (volume > OSS32_MAX_VOLUME)
     315       {
    303316           volume = OSS32_MAX_VOLUME;
    304317       }
    305 //       dprintf(("Set mastervolume to %d", volume));
     318//       dprintf(("IlAudioControl:Set MV to %d", volume));
    306319       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       {
    308322           MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_REAR, MAKE_VOLUME_LR(volume, volume));
    309323       }
     
    345359           volume = OSS32_MAX_VOLUME;
    346360       }
    347 //       dprintf(("Set input gain of %x to %d", prp->s.ioctl.usSysFileNum, volume));
     361//       dprintf(("IAudioControl:Set IG of %x to %d", prp->s.ioctl.usSysFileNum, volume));
    348362       pStream->SetProperty(PROPERTY_INPUTGAIN, MAKE_VOLUME_LR(volume, volume));
    349363   }
     
    353367void IoctlDirectAudio(PREQPACKET prp)
    354368{
     369    dprintf(("IoctlDirectAudio"));
    355370    if(prp->s.ioctl.bCode == DAUDIO_OPEN)
    356371    {
     
    362377        if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE))
    363378        {
    364             dprintf(("Invalid MCI_AUDIO_INIT pointer %lx!!", (ULONG)pInit));
     379            dprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit));
    365380            prp->usStatus |= RPERR | RPBADCMD;
    366381            return;
     
    382397            pHWobj->DevCaps(&audioCaps);
    383398            if (audioCaps.ulSupport != SUPPORT_SUCCESS) {
    384                 dprintf(("IoctlDirectAudio: DevCaps failed"));
     399                dprintf(("IDirectAudio: DevCaps failed"));
    385400                pInit->sReturnCode = INVALID_REQUEST;
    386401                prp->usStatus |= RPERR;
     
    396411        pStream = new DWAVESTREAM(AUDIOHW_WAVE_PLAY, pInit,  prp->s.ioctl.usSysFileNum, MixerStreamId);
    397412        if(pStream == NULL) {
     413            dprintf(("IDirectAudio: pStream"));
    398414            DebugInt3();
    399415            pInit->sReturnCode = INVALID_REQUEST;
     
    404420        if(!pStream->IsEverythingOk()) {
    405421            delete pStream;
     422            dprintf(("IlDirectAudio: IsEverythingOk"));
    406423            DebugInt3();
    407424            pInit->sReturnCode = INVALID_REQUEST;
     
    429446        if(DevHelp_VerifyAccess(SELECTOROF(pInit), sizeof(MCI_AUDIO_INIT), OFFSETOF(pInit), VERIFY_READWRITE))
    430447        {
    431             dprintf(("Invalid MCI_AUDIO_INIT pointer %lx!!", (ULONG)pInit));
     448            dprintf(("Invalid MCI_AUDIO_INIT pnt %lx!!", (ULONG)pInit));
    432449            prp->usStatus |= RPERR | RPBADCMD;
    433450            return;
     
    449466            pHWobj->DevCaps(&audioCaps);
    450467            if (audioCaps.ulSupport != SUPPORT_SUCCESS) {
    451                 dprintf(("IoctlDirectAudio: DevCaps failed"));
     468                dprintf(("IlDirectAudio: DevCaps failed"));
    452469                prp->usStatus |= RPERR;
    453470                pInit->sReturnCode = INVALID_REQUEST;
     
    471488        if(DevHelp_VerifyAccess(SELECTOROF(lpCaps), sizeof(OSS32_DEVCAPS), OFFSETOF(lpCaps), VERIFY_READWRITE))
    472489        {
    473             dprintf(("Invalid OSS32_DEVCAPS pointer %lx!!", (ULONG)lpCaps));
     490            dprintf(("Invalid OSS32_DEVCAPS pnt %lx!!", (ULONG)lpCaps));
    474491            prp->usStatus |= RPERR | RPBADCMD;
    475492            return;
     
    493510    pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);
    494511    if(pStream == NULL) {
    495         dprintf(("IoctlDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));
     512        dprintf(("IDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));
    496513        DebugInt3();
    497514        prp->usStatus |= RPERR | RPBADCMD;
     
    504521    if(DevHelp_VerifyAccess(SELECTOROF(pDAudioCmd), sizeof(DAUDIO_CMD), OFFSETOF(pDAudioCmd), VERIFY_READWRITE))
    505522    {
    506         dprintf(("Invalid DAUDIO_CMD pointer %lx!!", (ULONG)pDAudioCmd));
     523        dprintf(("Invalid DAUDIO_CMD pnt %lx!!", (ULONG)pDAudioCmd));
    507524        prp->usStatus |= RPERR | RPBADCMD;
    508525        return;
     
    627644{
    628645#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));
    630647#endif
    631     if(prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT) {
     648    if (prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT)
     649    {
    632650        IoctlDirectAudio(prp);
    633651        return;
    634652    }
    635653
    636     if(prp->s.ioctl.bCategory == 0x90) {
     654    if (prp->s.ioctl.bCategory == 0x90)
     655    {
    637656        IoctlMixer(prp, LDev);
    638657        return;
    639658    }
    640     if(prp->s.ioctl.bCategory != AUDIO_IOCTL_CAT) {
     659    if (prp->s.ioctl.bCategory != AUDIO_IOCTL_CAT)
     660    {
    641661        prp->usStatus |= RPERR | RPBADCMD;
    642662        return;
     
    645665    switch (prp->s.ioctl.bCode)
    646666    {
    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
    660684    return;
    661685}
  • OCO/trunk/drv16/irq.hpp

    r418 r468  
    5151// ###IHV:  IRQ sharing flag.  Set this to "0" for ISA bus, "1" for PCI
    5252// PCI and Microchannel environments (where hardware can share an IRQ level.
    53 const BOOL IRQ_HW_Sharing = 0;
     53const unsigned long IRQ_HW_Sharing = 0;
    5454
    5555// Max num of int handlers per IRQ level.
    56 const int MAX_HandlersPerIRQLevel = 3;
     56const unsigned long MAX_HandlersPerIRQLevel = 3;
    5757
    5858// PFN_InterruptHandler:  Pointer to an interrupt handler.  This is a near
     
    9292   // Runs in interrupt context.
    9393   void CallHandlers (void);
     94   //PS+++ add for debug IRQ level
     95   USHORT GetIRQLevel (void) { return _usIRQLevel;};
    9496
    9597private:
  • OCO/trunk/drv16/malloc.c

    r33 r468  
    334334
    335335   if (npvReturn)
     336   {
    336337      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();
    340343   }
    341344
  • OCO/trunk/drv16/maudio.cpp

    r418 r468  
    114114int MIDIAUDIO::Pause(OSSSTREAMID StreamId)         // Pause the operation
    115115{
    116     dprintf(("DUMMY MIDIAUDIO::Pause"));
     116//    dprintf(("DUMMY MIDIAUDIO::Pause"));
    117117    DebugInt3();
    118118    return 0;
     
    122122int MIDIAUDIO::Resume(OSSSTREAMID StreamId)        // Resume the operation
    123123{
    124     dprintf(("DUMMY MIDIAUDIO::Resume"));
     124//    dprintf(("DUMMY MIDIAUDIO::Resume"));
    125125    DebugInt3();
    126126    return 0;
     
    130130void MIDIAUDIO::noteOff(OSSSTREAMID StreamId, BYTE mchan, BYTE note, BYTE velocity )
    131131{
    132     dprintf2(("MIDIAUDIO::noteOff %d %d %d", mchan, note, velocity));
     132//    dprintf2(("MIDIAUDIO::noteOff %d %d %d", mchan, note, velocity));
    133133    if(OSS16_MidiNoteOff(StreamId, mchan, note, velocity) != OSSERR_SUCCESS) {
    134134       DebugInt3();
     
    139139void MIDIAUDIO::noteOn(OSSSTREAMID StreamId, BYTE mchan, BYTE note, BYTE velocity )
    140140{
    141     dprintf2(("MIDIAUDIO::noteOn %d %d %d", mchan, note, velocity));
     141//    dprintf2(("MIDIAUDIO::noteOn %d %d %d", mchan, note, velocity));
    142142    if(OSS16_MidiNoteOn(StreamId, mchan, note, velocity) != OSSERR_SUCCESS) {
    143143        DebugInt3();
     
    148148void MIDIAUDIO::polyphonicPressure(OSSSTREAMID StreamId, BYTE mchan, BYTE note, BYTE value )
    149149{
    150     dprintf2(("MIDIAUDIO::polyphonicPressure %d %d %d", mchan, note, value));
     150//    dprintf2(("MIDIAUDIO::polyphonicPressure %d %d %d", mchan, note, value));
    151151    if(OSS16_MidiKeyPressure(StreamId, mchan, note, value) != OSSERR_SUCCESS) {
    152152        DebugInt3();
     
    157157void MIDIAUDIO::controlChange(OSSSTREAMID StreamId, BYTE mchan, BYTE control_number, BYTE value )
    158158{
    159     dprintf2(("MIDIAUDIO::controlChange %d %d %d", mchan, control_number, value));
     159//    dprintf2(("MIDIAUDIO::controlChange %d %d %d", mchan, control_number, value));
    160160    if(OSS16_MidiControlChange(StreamId, mchan, control_number, value) != OSSERR_SUCCESS) {
    161161        DebugInt3();
     
    166166void MIDIAUDIO::programChange(OSSSTREAMID StreamId, BYTE mchan, BYTE program_number )
    167167{
    168     dprintf2(("MIDIAUDIO::programChange %d %d", mchan, program_number));
     168//    dprintf2(("MIDIAUDIO::programChange %d %d", mchan, program_number));
    169169    if(OSS16_MidiProgramChange(StreamId, mchan, program_number) != OSSERR_SUCCESS) {
    170170        DebugInt3();
     
    175175void MIDIAUDIO::channelPressure(OSSSTREAMID StreamId, BYTE mchan, BYTE value )
    176176{
    177     dprintf2(("MIDIAUDIO::channelPressure %d %d", mchan, value));
     177//    dprintf2(("MIDIAUDIO::channelPressure %d %d", mchan, value));
    178178    if(OSS16_MidiChannelPressure(StreamId, mchan, value) != OSSERR_SUCCESS) {
    179179        DebugInt3();
     
    184184void MIDIAUDIO::pitchBend(OSSSTREAMID StreamId, BYTE mchan, BYTE value_lsb, BYTE value_msb)
    185185{
    186     dprintf2(("MIDIAUDIO::pitchBend %d %d %d", mchan, value_lsb, value_msb));
     186//    dprintf2(("MIDIAUDIO::pitchBend %d %d %d", mchan, value_lsb, value_msb));
    187187    if(OSS16_MidiKeyPressure(StreamId, mchan, value_lsb, value_msb) != OSSERR_SUCCESS) {
    188188        DebugInt3();
  • OCO/trunk/drv16/memutil.asm

    r33 r468  
    9393    ; save registers
    9494        push   cx
    95         push   bx
     95;PS+++        push   bx
    9696        push   ds
    9797        push   es
     
    101101    ; store number of bytes to transfer and calculate number of double words
    102102    ; 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+++
    105106        shr    cx,2
    106107
     
    120121
    121122    ; transfer number of odd bytes
    122         mov    cx,bx
     123;PS+++        mov    cx,bx
     124        mov    cx,BUF1_LEN                    ;PS+++
    123125        and    cx,03h
     126        or     cx,cx                          ;PS+++
     127        jz     short @@NoPad                  ;PS+++
    124128        rep    movsb
    125 
     129@@NoPad:                                      ;PS+++
    126130    ;set up return value and restore registers
    127131        pop    di
     
    129133        pop    es
    130134        pop    ds
    131         pop    bx
     135;PS+++        pop    bx
    132136        pop    cx
    133         pop    bp
    134 
     137;PS+++        pop    bp
     138        leave                                  ;PS+++
    135139   ;done
    136140        ret
     
    143147; the fill value as parameters on the stack.
    144148;    The function does not return a value.
    145 
     149;PS+++ Where is used now?
     150ifdef WhereIsUsed
    146151public _ddmemfill
    147152_ddmemfill proc near
     
    157162
    158163    ; save registers
    159         push   bx
     164;PS+++        push   bx
    160165        push   cx
    161166        push   es
     
    164169    ; store number of bytes to transfer and calculate number of double words
    165170    ; 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++
    168174        shr    cx,2
    169175
    170176    ; set size in bytes of object to be allocated
    171         mov    es,DEST2_HIGH
     177        mov    es,DEST2_HIGH               
    172178        mov    di,DEST2_LOW
    173179
    174180    ; 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+++
    176185        shl    eax,010h
    177         mov    ax,VALUE2
     186;PS+++        mov    ax,VALUE2
     187        pop    ax                                 ;PS+++
    178188
    179189    ; set up transfer direction
     
    184194
    185195    ; transfer number of odd bytes
    186         mov    cx,bx
     196;PS+++        mov    cx,bx
     197        mov    cx,BUF2_LEN                            ;PS++
    187198        and    cx,03h
    188199        rep    stosb
     
    192203        pop    es
    193204        pop    cx
    194         pop    bx
    195         pop    bp
    196 
     205;PS+++        pop    bx
     206;PS+++        pop    bp
     207        leave
    197208   ;done
    198209        ret
    199210_ddmemfill endp
     211endif
    200212
    201213_TEXT       ENDS
  • OCO/trunk/drv16/midistrm.cpp

    r33 r468  
    185185ULONG  MIDISTREAM::StartStream(void)
    186186{
    187     dprintf(("MIDISTREAM::StartStream %lx %lx", (void far *)this, StreamId));
     187//    dprintf(("MIDISTREAM::StartStream %lx %lx", (void far *)this, StreamId));
    188188   
    189189    state = S_Init;                        // Reset parser state.
     
    206206{
    207207    if(ulStreamState == STREAM_STOPPED) {
    208         dprintf(("MIDISTREAM::StopStream %lx (already stopped)", StreamId));
     208//              dprintf(("MIDISTREAM::StopStream %lx (already stopped)", StreamId));
    209209            pControl->ulTime = GetCurrentTime();
    210210            return NO_ERROR;
    211211    }
    212212
    213     dprintf(("MIDISTREAM::StopStream %lx %lx", (void far *)this, StreamId));
     213//    dprintf(("MIDISTREAM::StopStream %lx %lx", (void far *)this, StreamId));
    214214    ulStreamState = STREAM_STOPPED;
    215215    pahw->Stop(StreamId);
     
    223223ULONG  MIDISTREAM::PauseStream(PCONTROL_PARM pControl)
    224224{
    225     dprintf(("MIDISTREAM::PauseStream %lx %lx", (void far *)this, StreamId));
     225//    dprintf(("MIDISTREAM::PauseStream %lx %lx", (void far *)this, StreamId));
    226226    if (ulStreamState == STREAM_PAUSED) {   // is the stream paused?
    227227        DebugInt3();
     
    239239ULONG  MIDISTREAM::ResumeStream(void)
    240240{
    241     dprintf(("MIDISTREAM::ResumeStream %lx %lx", (void far *)this, StreamId));
     241//    dprintf(("MIDISTREAM::ResumeStream %lx %lx", (void far *)this, StreamId));
    242242    if (ulStreamState != STREAM_PAUSED) {   // is the stream paused?
    243243        DebugInt3();
     
    275275   STREAM(streamtype, filesysnum, mixerStreamId)
    276276{
    277     dprintf(("MIDISTREAM::ctor"));
     277//    dprintf(("MIDISTREAM::ctor"));
    278278
    279279    // get the pointer to the hardware object
     
    281281    if(pahw) {
    282282        if(pahw->Open(0, streamtype, filesysnum, &StreamId) == FALSE) {
    283             dprintf(("MIDISTREAM ctor: open failed!!"));
     283//            dprintf(("MIDISTREAM ctor: open failed!!"));
    284284            DebugInt3();
    285285        }
  • OCO/trunk/drv16/mixer.cpp

    r450 r468  
    714714    }
    715715    if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_HEADPHONE)) {
    716         MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_HEADPHONE, MAKE_VOLUME_LR(lVolume, rVolume));
    717716    }
    718717    if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_AUX)) {
  • OCO/trunk/drv16/ossidc16.cpp

    r391 r468  
    718718        //Signal all active wave playback streams to update their status
    719719            pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_PLAY);
    720             while(pStream) {
     720            while(pStream)
     721           {
    721722                pStream->Process();
    722                     pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream);
     723               pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_PLAY, pStream);
    723724            }
    724725        //Signal all active wave capture streams to update their status
  • OCO/trunk/drv16/parse.c

    r134 r468  
    7575int fCDMute   = TRUE;
    7676
    77 #ifdef DEBUG
     77#ifdef DEBUG_COM
    7878extern short int MAGIC_COMM_PORT;
    7979#endif
     
    189189         fInt3BeforeInit = TRUE;
    190190         break;
    191 #ifdef DEBUG
     191#ifdef DEBUG_COM
    192192      case 'D':
    193193         if(pszOption) {
  • OCO/trunk/drv16/queue.cpp

    r33 r468  
    3838void QUEUEHEAD::PushOnHead(PQUEUEELEMENT pElement)
    3939{
    40    if (pHead == NULL) {
     40   if (pHead == NULL)
     41   {
    4142      pElement->pNext = NULL;
    4243      pHead = pElement;
    4344      pTail = pElement;
    4445   }
    45    else {
     46   else
     47   {
    4648      pElement->pNext = pHead;
    4749      pHead = pElement;
     
    5254{
    5355   pElement->pNext = NULL;
    54    if (pHead == NULL) {
     56   if (pHead == NULL)
     57   {
    5558      pHead = pElement;
    5659      pTail = pElement;
    5760   }
    58    else {
     61   else
     62   {
    5963      pTail->pNext = pElement;
    6064      pTail = pElement;
     
    6670   PQUEUEELEMENT temp = pHead;
    6771
    68    if (temp) {
     72   if (temp)
     73   {
    6974      pHead = temp->pNext;
    7075      if (pHead == NULL)
     
    8388    // zapp the next pointer in the element being returned
    8489    // get out of here
    85    if (pHead == pTail) {
     90   if (pHead == pTail)
     91   {
    8692      pHead = NULL;
    8793      pTail = NULL;
  • OCO/trunk/drv16/ssm_idc.cpp

    r396 r468  
    2929#include "event.hpp"
    3030#include <include.h>
    31 
     31#include <devhelp.h>
    3232
    3333extern "C" int open_strategy;
     
    4747
    4848      case DDCMD_SETUP: {
    49          ddprintf(("DDCMD_SETUP"));
    5049         if (!pstream)
    51             return ERROR_INVALID_STREAM;
     50         {
     51             dprintf(("DDCMD_SETUP err pstream"));
     52             return ERROR_INVALID_STREAM;
     53         }
    5254         PDDCMDSETUP p = (PDDCMDSETUP) pCommon;
    5355         SETUP_PARM __far *psp = (SETUP_PARM __far *) p->pSetupParm;
     
    5658           // if there is a flags field in the SETUP_PARM
    5759           // 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));
    5963            psp->ulFlags = SETUP_RECURRING_EVENTS;
    6064         }
     
    7478         break;
    7579      }
    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;
    7885
    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;
    85104         break;
    86105      }
    87106      case DDCMD_STATUS: {
    88          ddprintf(("DDCMD_STATUS"));
     107//         ddprintf(("DDCMD_STATUS"));
    89108         PDDCMDSTATUS p = (PDDCMDSTATUS) pCommon;
    90109         PSTATUS_PARM p2 = (PSTATUS_PARM) p->pStatus;
     
    92111           return ERROR_INVALID_STREAM;
    93112         p2->ulTime = pstream->GetCurrentTime();
     113//         ddprintf(("DDCMD_STATUS time:%ld",p2->ulTime));
    94114         break;
    95115      }
    96       case DDCMD_CONTROL: {
     116      case DDCMD_CONTROL:
     117      {
    97118         PDDCMDCONTROL p = (PDDCMDCONTROL) pCommon;
    98119         if (!pstream)
    99             return ERROR_INVALID_STREAM;
     120         {
     121             dprintf(("DDCMD_CONTROL err stream %x", (USHORT)pstream));
     122             return ERROR_INVALID_STREAM;
     123         }
    100124
    101          switch (p->ulCmd) {
     125         switch (p->ulCmd)
     126         {
    102127         case DDCMD_START:
    103128             ddprintf(("DDCMD_START"));
    104              return pstream->StartStream();
     129             ulReturnCode = pstream->StartStream();
     130             ddprintf(("DDCMD_START End rc=%ld",ulReturnCode));
     131             return ulReturnCode;
    105132         case DDCMD_STOP:
    106133             ddprintf(("DDCMD_STOP"));
     134             DevHelp_ProcBlock ((ULONG)p, 2, 0);
    107135             p->ulParmSize=sizeof(ULONG);
    108             return pstream->StopStream((PCONTROL_PARM)p->pParm);
     136             return pstream->StopStream((PCONTROL_PARM)p->pParm);
    109137         case DDCMD_PAUSE:
    110138             ddprintf(("DDCMD_PAUSE"));
     
    118146             return pstream->EnableEvent(p);
    119147         case DDCMD_DISABLE_EVENT:
    120              ddprintf(("DDCMD_DISABLE_EVENT"));
     148//             ddprintf(("DDCMD_DISABLE_EVENT"));
    121149             return pstream->DisableEvent(p);
    122150         case DDCMD_PAUSE_TIME:
    123              ddprintf(("DDCMD_PAUSE_TIME"));
     151//             ddprintf(("DDCMD_PAUSE_TIME"));
    124152             return pstream->PauseStreamTime();
    125153         case DDCMD_RESUME_TIME:
     
    130158         } /* endswitch */
    131159      }
    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));
    134163         if (pstream)
     164         {
     165             dprintf(("DDCMD_REG_STREAM err stream %x", (USHORT)pstream));
    135166             return ERROR_HNDLR_REGISTERED;
     167         }
    136168         pstream = FindStream_fromFile(((PDDCMDREGISTER) pCommon)->ulSysFileNum);
    137169         if (!pstream)
    138             return ERROR_STREAM_CREATION;
     170         {
     171             dprintf(("DDCMD_REG_STREAM1 err stream %x", (USHORT)pstream));
     172             return ERROR_STREAM_CREATION;
     173         }
    139174         ulReturnCode = pstream->Register((PDDCMDREGISTER) pCommon);
    140          //dprintf(("DDCMD_EntryPoint: DDCMD_REG_STREAM stream %x returned %d", (USHORT)pCommon->hStream, (USHORT)ulReturnCode));
    141175         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));
    143181         break;
    144182      }
  • OCO/trunk/drv16/strategy.cpp

    r253 r468  
    411411        delete pstream;
    412412    else
    413         ;         //### Log unexpected condition.
     413        dprintf(("Close NULL stream"));;         //### Log unexpected condition.
    414414}
    415415//******************************************************************************
     
    470470         break;
    471471      default:
     472         dprintf(("Strategy Unk:0x%x", prp->bCommand));
    472473         prp->usStatus = RPDONE | RPERR | RPGENFAIL;
    473474   }
  • OCO/trunk/drv16/stream.cpp

    r418 r468  
    3939
    4040//******************************************************************************
     41// Here we ask to mmpm - give me next buffer
    4142//******************************************************************************
    4243void STREAM::ReturnBuffer(void)
     
    5152        // if this is a write (playback) then set the streamtype and
    5253        // tell the stream handler that we played all of the buffer.
    53         if (ulStreamType & STREAM_WRITE) {
     54        if (ulStreamType & STREAM_WRITE)
     55       {
    5456                shdri.ulFlag = SHD_WRITE_COMPLETE;
    5557                shdri.ulStatus = temp->ulBuffsz;
     
    171173ULONG STREAM::Register(PDDCMDREGISTER p)
    172174{
     175   ddprintf(("STREAM::Register"));
    173176   hstream             = p->hStream;
    174177   pfnSHD              = (PFN_SHD) p->pSHDEntryPoint;
     
    213216{
    214217
     218//   dprintf(("STREAM::SetNextEvent"));
    215219   // if there are no events or only one event on the
    216220   // queue just return
     
    232236   // event to time out.. if it is not already on
    233237   // the head of the Event queue then put it there
    234    if (pele2 != qhEvent.Head()) {
     238   if (pele2 != qhEvent.Head())
     239   {
    235240      cli();
    236241      qhEvent.PopElement(pele2);
  • OCO/trunk/drv16/timer.cpp

    r418 r468  
    159159   static ULONG hookHandle;
    160160
     161//_asm int 3;
     162   dprintf(("TIMER::TIMER Ms:%d IRQ%d", uTargetMSec,pIRQ->GetIRQLevel()));
    161163   // Set initial state - "not functional".
    162164   _eState = TIMER_Disabled;
     
    394396      uMSec = _uInterval_mSec;
    395397      _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
    399407      }
    400408      _ulTime += uMSec;
  • OCO/trunk/drv16/waudio.cpp

    r391 r468  
    10431043
    10441044#ifdef DEBUG
    1045 //    dprintf(("WAVEAUDIO::DevCaps1"));
     1045    dprintf(("WAVEAUDIO::DevCaps1"));
    10461046#endif
    10471047
     
    10551055         pCaps->ulOperation != OPERATION_RECORD )
    10561056    {
     1057        dprintf(("DevCaps1 unsupported play/record"));
    10571058        pCaps->ulSupport = UNSUPPORTED_OPERATION;
    10581059        return;
    10591060    }
    10601061
    1061     if(pCaps->ulOperation == OPERATION_PLAY) {
     1062    if(pCaps->ulOperation == OPERATION_PLAY)
     1063    {
    10621064         pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps;
    10631065    }
     
    10671069    if (pCaps->ulChannels != 1 && pCaps->ulChannels != 2)
    10681070    {
    1069         if(pCaps->ulChannels > pWaveCaps->ulMaxChannels) {
     1071        if(pCaps->ulChannels > pWaveCaps->ulMaxChannels)
     1072        {
     1073            dprintf(("DevCaps1 unsupported channel"));
    10701074            pCaps->ulSupport = UNSUPPORTED_CHANNELS;
    10711075            return;
    10721076        }
    10731077    }
    1074     if (pCaps->ulSamplingRate == 0) {
     1078    if (pCaps->ulSamplingRate == 0)
     1079    {
     1080        dprintf(("DevCaps1 unsupported rate"));
    10751081        pCaps->ulSupport = UNSUPPORTED_RATE;
    10761082        return;
     
    11261132            break;
    11271133        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"));
    11291137                pCaps->ulSupport = UNSUPPORTED_BPS;
    11301138                return;
     
    11321140            break;
    11331141        case 32:
    1134             if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS)) {
     1142            if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS))
     1143            {
    11351144                pCaps->ulSupport = UNSUPPORTED_BPS;
     1145                dprintf(("DevCaps1 unsupported 32BPS"));
    11361146                return;
    11371147            }
    11381148            break;
    11391149        default:
     1150            dprintf(("DevCaps1 unsupported BPS %d",(USHORT)pCaps->ulBitsPerSample));
    11401151            pCaps->ulSupport = UNSUPPORTED_BPS;
    11411152            return;
     
    11511162    case DATATYPE_RIFF_ALAW:
    11521163    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"));
    11541167            pCaps->ulSupport = UNSUPPORTED_DATATYPE;
    11551168            return;
    11561169        }
    11571170        // 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"));
    11591174            pCaps->ulSupport = UNSUPPORTED_BPS;
    11601175            return;
     
    11671182    case DATATYPE_RIFF_MULAW:
    11681183    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"));
    11701187            pCaps->ulSupport = UNSUPPORTED_DATATYPE;
    11711188            return;
    11721189        }
    11731190        // 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"));
    11751194            pCaps->ulSupport = UNSUPPORTED_BPS;
    11761195            return;
     
    11821201    case DATATYPE_ADPCM_AVC:
    11831202    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"));
    11851206            pCaps->ulSupport = UNSUPPORTED_DATATYPE;
    11861207            return;
    11871208        }
    11881209        // supported bits per sample are 4
    1189         if (pCaps->ulBitsPerSample != 4) {
     1210        if (pCaps->ulBitsPerSample != 4)
     1211        {
     1212            dprintf(("DevCaps1 unsupported ADPCM BPS4"));
    11901213            pCaps->ulSupport = UNSUPPORTED_BPS;
    11911214            return;
     
    11961219
    11971220    default:
     1221        dprintf(("DevCaps1 unsupported dattype"));
    11981222        pCaps->ulSupport = UNSUPPORTED_DATATYPE;
    11991223        return;
     
    12321256            pCaps->ulResourceUnits = OSS32_MAX_WAVE_PLAYBACK_STREAMS;
    12331257        }
    1234         dprintf(("Resource Units used by playback stream: %d", (int)pCaps->ulResourceUnits));
     1258        dprintf(("RU used by playback stream: %d", (int)pCaps->ulResourceUnits));
    12351259    }
    12361260    else {
     
    12721296{
    12731297#ifdef DEBUG
    1274 //    dprintf(("WAVEAUDIO::DevCaps"));
     1298    dprintf(("WAVEAUDIO::DevCaps"));
    12751299#endif
    12761300    ddmemmov(lpCaps, &devCaps[current_device], sizeof(OSS32_DEVCAPS));
     
    13521376    }
    13531377    pConfigInfo->ulBytesPerIRQ = ulBytesPerIRQ;
     1378    dprintf(("WAVEAUDIO::ConfigDev BytesPerIRQ:%ld",ulBytesPerIRQ));
    13541379
    13551380
     
    14031428#endif
    14041429
    1405     if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS) {
     1430    if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS)
     1431    {
    14061432        DebugInt3();
    14071433        return FALSE;
    14081434    }
    14091435    //Reset cleans up waveout instance
    1410     if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS) {
     1436    if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS)
     1437    {
    14111438        DebugInt3();
    14121439        return FALSE;
     
    15101537        newlen = tmp;
    15111538
    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));
    15261542    return newlen;
    15271543}
  • OCO/trunk/drv16/waveplay.cpp

    r391 r468  
    7979            dprintf(("OSS16_WaveOpen failed!!"));
    8080#endif
    81 //            DevHelp_Beep(1000, 100);
    8281            DebugInt3();
    8382//            StreamId = 0;
     
    108107{
    109108#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));
    111110#endif
    112111#if 0 // fixme to be gone?
     
    120119        force_closed = 0;
    121120#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));
    123122#endif
    124123        return TRUE;
     
    141140                open_strategy = 0UL;
    142141#ifdef DEBUG
    143                 dprintf(("OSS16_WAVECLOSE: Success\n"));
     142                dprintf(("OSS16_WAVECLOSE: Success"));
    144143#endif /* DEBUG */
    145144                return TRUE;
    146145            } else
    147146#ifdef DEBUG
    148                 dprintf(("OSS16_WAVECLOSE: Error\n"));
     147                dprintf(("OSS16_WAVECLOSE: Error"));
    149148#endif /* DEBUG */
    150149                return FALSE;
     
    166165    int            samplesize;
    167166    ULONG          ulPCMConsumeRate;
    168     int rc;
     167    USHORT        rc;
    169168
    170169
     
    195194#endif
    196195
    197     if(ulFirstBufSize == 0) {
     196    if(ulFirstBufSize == 0)
     197    {
    198198        ulFirstBufSize = pConfigInfo->ulFragsize; //no conversion required (see below)
    199         if(ulFirstBufSize == 0) {
     199        if (ulFirstBufSize == 0)
     200        {
    200201            DebugInt3();
    201202            ulFirstBufSize = 8192; //should never happen!
     
    205206        }
    206207    }
    207     else {
     208    else
     209    {
    208210        //convert size of first buffer
    209211        ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo);
     
    212214#endif /* DEBUG */
    213215    }
    214 
    215216    //Must call this method (i.e. resets sample rate conversion position)
    216217    WAVEAUDIO::ConfigDev(StreamId, pConfigInfo, ulFirstBufSize);
     
    225226#endif /* DEBUG */
    226227
    227     fragsize = ulPCMConsumeRate/64; //start with 64 irqs/sec
     228    fragsize = ulPCMConsumeRate/64; //start with 64 irqs/sec   2756
    228229
    229230    //if the buffer is smaller than our predefined fragmentsize (*2), then correct it
     
    232233    //There's nothing we can do about it as the fragment size can't be changed
    233234    //while the stream is playing.
    234     ULONG minimumsize = ulFirstBufSize/2;
     235    ULONG minimumsize = ulFirstBufSize/2;  //650
    235236    if(minimumsize && minimumsize < fragsize)
    236237    {
    237         while(minimumsize < fragsize) fragsize = fragsize / 2;
    238 
     238        while(minimumsize < fragsize) fragsize = fragsize / 2; //
     239 
    239240            if(fragsize < ulPCMConsumeRate/256)
    240241            {//lower limit; don't accept extremely small buffers
     
    257258    hwparam.ulNumChannels   = pConfigInfo->ulHwNumChannels;
    258259    hwparam.ulDataType      = QueryOSSDataFormat(OPERATION_PLAY, pConfigInfo->ulDataType, pConfigInfo->ulHwBitsPerSample);
    259     rc = (int)OSS16_WaveSetFormat(StreamId, &hwparam);
     260    rc = (USHORT)OSS16_WaveSetFormat(StreamId, &hwparam);
    260261#ifdef DEBUG
    261262        dprintf(("WAVEPLAY:ConfigDev:OSS16_WaveSetFormat . rc = %d",rc));
     
    267268#endif
    268269    if( rc != OSSERR_SUCCESS) {
    269 //        DevHelp_Beep(500, 100);
     270        dprintf(("WAVEPLAY:ConfigDev: rc %d",rc));
    270271        DebugInt3();
    271272        // vladest
     
    287288
    288289#ifdef DEBUG
    289 //    dprintf(("WAVEPLAY::Transfer"));
     290//    dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer));
    290291#endif
    291292
     
    299300    }
    300301
     302    //PS very strange
     303    if (!ulBytesToTransfer)
     304    {
     305        return TRUE;
     306    }
     307
    301308//    if (!waveOpened) return TRUE;
    302309
    303310    if(pConfigInfo->usConversion == CONVERT_NONE)
    304311    {
    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 */
    310317            *pulBytesTransferred = 0;
    311318            return FALSE;
    312319        }
    313320    }
    314     else {
    315         if(pConfigInfo->pfnConvert) {
     321    else
     322    {
     323        if(pConfigInfo->pfnConvert)
     324        {
    316325            ULONG ulCvtBufferSize;
    317326
     
    323332            ulBytesToTransfer = CONVERT_LENGTH(ulCvtBufferSize, CONVERSION_INVERT(pConfigInfo->ulConversionFactor));
    324333
    325             if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) {
    326                 DebugInt3();
     334            if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1))
     335            {
     336                dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer));
     337//                DebugInt3();
    327338                ulBytesToTransfer = ulBytesToTransfer & ~(pConfigInfo->ulSampleSize-1);
    328339#ifdef DEBUG
    329                 dprintf(("New ulBr %ld" , ulBytesToTransfer));
     340                dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer));
    330341#endif
    331342            }
     
    338349            //convert back from conversion to 'real'
    339350            *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();
    345357            }
    346358        }
    347         else {
    348             DebugInt3();
     359        else
     360        {
     361            dprintf(("Transfer Zero pConfigInfo->pfnConvert"));
     362//            DebugInt3();
    349363            return FALSE;
    350364        }
     
    363377//    if (!waveOpened) return TRUE;
    364378
     379//PS Here is inrerrupt time....
    365380    if (fAPMSuspend)
    366381    {
    367382#ifdef DEBUG
    368         dprintf(("WAVEPLAY::AddBuffer. Suspend state"));
     383//        dprintf(("WAVEPLAY::AddBuffer. Suspend state"));
    369384#endif
    370385        apm_resume();
     
    372387    }
    373388
    374     if(pConfigInfo->fSampleRateConversion)
     389    if (pConfigInfo->fSampleRateConversion)
    375390    {
    376391        ULONG  ulCvtBufferSize, ulSampleCount, ulHwSampleCount;
     
    378393
    379394        //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);
    382396        ulCvtBufferSize = min(CONVERSION_BUFFER_SIZE, ulCvtBufferSize);
    383397        //round to sample boundary
    384398        ulCvtBufferSize &= ~(pConfigInfo->ulHwSampleSize - 1);
    385399
    386         if(ulCvtBufferSize == 0) {
     400        if(ulCvtBufferSize == 0)
     401        {
    387402            *pulBytesTransferred = ulBytesToTransfer;
    388             if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) {
     403            if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement)
     404            {
    389405                pConfigInfo->ulSRatePosition -= pConfigInfo->ulSRateIncrement;
    390406            }
    391 #ifdef DEBUG
    392             dprintf(("WAVEPLAY::AddBuffer %lx %lx %lx -> nothing left", ulBytesToTransfer, pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement));
    393 #endif /* DEBUG */
    394407            return TRUE;
    395408        }
    396409        pConfigInfo->pfnSRateConv(pUserBuffer, ulCvtBufferSize, pConfigInfo->pSRateConvBuffer,
    397410                                  pConfigInfo->ulSRatePosition, pConfigInfo->ulSRateIncrement);
    398 //PS++ !!!!! This don't be !!!!!!!
    399411        OSS16_WaveGetSpace(StreamId, &Space);
    400412        if (ulCvtBufferSize > Space)
     
    403415            dprintf(("WPLAY::AddBuffer need %ld space:%ld", ulCvtBufferSize, Space));
    404416#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)
    406433            {
    407                  OSS16_WaveGetSpace(StreamId, &Space);
    408                  if (ulCvtBufferSize <= Space) break;
    409             }
    410 #ifdef DEBUG
    411             dprintf(("OUT %ld need %ld space:%ld Last:%ld",i, ulCvtBufferSize, Space,LastSpace));
    412 #endif
    413         }
    414         if((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS ||
    415            *pulBytesTransferred == 0)
    416         {
    417             if(rc == OSSERR_BUFFER_FULL) {
    418434                 GetSpace(StreamId, pConfigInfo, &Space);
    419435                 dprintf(("WPLAY::AddBuffer; OSS16_WaveAddBuffer %ld %x failed due to full buffer free space:%ld", ulCvtBufferSize, (USHORT)rc,Space));
    420436            }
    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
    422441            *pulBytesTransferred = 0;
    423442            return FALSE;
     
    437456        // if the last sample is still needed for the next run, then adjust sample count and
    438457        // sample rate conversion position
    439         if(lSRatePosition < 0) {
     458        if(lSRatePosition < 0)
     459        {
    440460            dprintf4(("WAVEPLAY::AddBuffer; sratepos < 0"));
    441461            dprintf4(("ulHwSampleCount %lx pConfigInfo->ulSRateIncrement %lx ulSampleCount %lx", ulHwSampleCount, pConfigInfo->ulSRateIncrement, ulSampleCount));
    442462            pConfigInfo->ulSRatePosition = 0;
    443463        }
    444         else {
     464        else
     465        {
    445466            pConfigInfo->ulSRatePosition = (ULONG)lSRatePosition;
    446467        }
     
    451472       if( (rc=OSS16_WaveAddBuffer(StreamId, pUserBuffer, ulBytesToTransfer, pulBytesTransferred)) != OSSERR_SUCCESS)
    452473       {
    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       }
    457479    }
    458480    return TRUE;
     
    489511//    if (!waveOpened) return TRUE;
    490512
    491     if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) {
     513    if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS)
     514    {
    492515        *pulStreamSpace = 0;
    493516#ifdef DEBUG
     
    496519        return FALSE;
    497520    }
    498     LastSpace = space;
     521
     522//    dprintf(("GetSpace: len %ld",space));
    499523    cvt  = ConvertLengthInvert(space, pConfigInfo);
    500524    //round to sample boundary
     
    509533    ULONG space,cvt;
    510534
    511     if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) {
     535    if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS)
     536    {
    512537        *pulHwPtr = 0;
    513538        #ifdef DEBUG
     
    516541        return FALSE;
    517542    }
     543
    518544    cvt  = ConvertLengthInvert(space, pConfigInfo);
    519545    //round to sample boundary
    520     *pulHwPtr = cvt & ( ~(pConfigInfo->ulSampleSize - 1));
     546    *pulHwPtr = cvt & (~(pConfigInfo->ulSampleSize - 1));
    521547    return TRUE;
    522548}
  • OCO/trunk/drv16/waverec.cpp

    r391 r468  
    132132    pConfigInfo->ulFragsize = fragsize;
    133133
    134     dprintf(("WAVEREC::ConfigDev: Fragment size %d", (USHORT)fragsize));
     134//    dprintf(("WAVEREC::ConfigDev: Fragment size %d", (USHORT)fragsize));
    135135
    136136    hwparam.ulSampleRate    = pConfigInfo->ulHwSampleRate;
  • OCO/trunk/drv16/wavestrm.cpp

    r396 r468  
    115115      // if there is a buffer on the InProcess Queue
    116116      // only check the first one as any others are just waiting.....
    117       if (qhInProcess.IsElements()) {
     117      if (qhInProcess.IsElements())
     118      {
    118119           // if any data has been written from this stream buffer
    119120         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 */
    123125      }
    124126
     
    131133      // If the rc is 1 then put it on the head of the InProcess queue.
    132134
    133       while (qhDone.IsElements()) {
     135      while (qhDone.IsElements())
     136      {
    134137         pTempHead->PushOnHead(qhDone.PopHead());
    135138      } /* endwhile */
    136139
    137       while (pTempHead->IsElements()) {
     140      while (pTempHead->IsElements())
     141      {
    138142         usRC = _vRealignBuffer(endpos, (PSTREAMBUFFER)pTempHead->Head());
    139143         if (usRC)
     
    159163#pragma on (unreferenced)
    160164{
    161     ULONG space, byteswritten;
    162 
    163     dgprintf(("AddBuffers"));
     165    ULONG space, byteswritten, curspace,i;
     166
     167//    dgprintf(("AddBuffers %d",fFirst == TRUE?1:2));
    164168
    165169    byteswritten = 0;
    166     if (ulStreamType & STREAM_WRITE) {
     170    if (ulStreamType & STREAM_WRITE)
     171    {
    167172        // get the space available in the hardware buffer
    168173        // only call GetSpace once because the amount of free space in
     
    170175        // could keep us in this loop writing 4 or 8 bytes at a time.
    171176        // 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"));
    174180            return;
    175181        }
    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            }
    179199            if(byteswritten == (ULONG)-1)
    180200                break;
     201            if (!curspace)
     202            {
     203                curspace = _configinfo.ulSampleSize;
     204            }
    181205            space -= byteswritten;
    182206            space &= ( ~(_configinfo.ulSampleSize - 1));
     
    184208
    185209    }
     210//    dgprintf(("AddBuffers %d End",fFirst == TRUE?1:2));
    186211}
    187212//******************************************************************************
     
    197222    ULONG Buff_left, byteswritten, start_pos;
    198223
    199     ddprintf(("AddBuffer"));
     224//    ddprintf(("AddBuffer"));
    200225    // make sure we have a buffer to copy from.....
    201     if (!pTemp) {
     226    if (!pTemp)
     227    {
    202228        return (ULONG)-1;
    203229    }
     
    212238    }
    213239
     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    }
    214248    // get the buffer pointer and amount of data remaining
    215249    pdataBuf  = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos;
     
    217251    Buff_left = min(Buff_left, space);
    218252
    219     if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE) {
     253    if (pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE)
     254    {
    220255        dgprintf(("AddBuffer: pahw->Transfer failed!!"));
     256//        DebugInt3();
    221257        return (ULONG)-1;
    222258    }
    223     if(byteswritten == 0) {
     259    if (byteswritten == 0)
     260    {
     261        dgprintf(("AddBuffer: No more room!!"));
     262//        DebugInt3();
    224263        return (ULONG)-1; //no more room
    225264    }
     
    231270
    232271    // 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    {
    234274        qhDone.PushOnTail(qhInProcess.PopHead());
    235275    }
    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));
    237277    return byteswritten;
    238278}
     
    255295
    256296    // 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    {
    258299       dprintf(("_vReadAudioBuf: pahw->Transfer failed!!"));
    259300       return FALSE;
     
    284325// can be returned and finally process any events pending.
    285326//******************************************************************************
     327//USHORT ProcNumber = 0;
    286328void DBGCALLCONV WAVESTREAM::Process(void)
    287329{
    288330 PSTREAMBUFFER ptemp;
    289331 ULONG         ulCurBytesProcessed = 0;
    290 // ULONG         bytesinc;
     332// USHORT        CurProcNumber = ProcNumber++;
     333 ULONG         space;
    291334
    292335#ifdef DEBUG
    293     ddprintf(("WAVESTREAM::Process"));
     336//    ddprintf(("WAVESTREAM::Process %d",CurProcNumber));
    294337#endif
    295338
     
    304347        return;
    305348    }
    306     ddprintf(("StPos: %lx", ulCurBytesProcessed));
     349//    ddprintf(("StPos: %lx", ulCurBytesProcessed));
    307350    // save the bytes processed in the stream object
    308351    _ulBytesProcessed = ulCurBytesProcessed;
    309352
     353//    if ((pahw->GetSpace(StreamId, &_configinfo, &space) != FALSE) && (space > _configinfo.ulBytesPerIRQ))
    310354    switch (ulStreamType & STREAM_WRITE) {
    311355
     
    322366        case STREAM_WRITE:
    323367        {
    324           if(qhDone.IsElements()) {
     368            if (qhDone.IsElements())
     369            {
    325370                ptemp = (PSTREAMBUFFER)qhDone.Head();
    326371                while ((_ulBytesProcessed + _configinfo.ulBytesPerIRQ) >= ptemp->ulDonepos)
     
    330375                }
    331376            }
    332             if (qhInProcess.IsElements()){
     377            if (qhInProcess.IsElements())
     378            {
    333379               AddBuffers(FALSE);
    334380            }
     
    345391
    346392    ProcessEvents();
     393//    ddprintf(("WAVESTREAM::Process %d End",CurProcNumber));
    347394}
    348395//******************************************************************************
     
    353400{
    354401    PSTREAMBUFFER pStreamBuf = new STREAMBUFFER(uLength, pbuf);
    355 
     402 
    356403    return Write(pStreamBuf);
    357404}
     
    390437    ULONG Seconds, MilliSeconds, Overflow, Processed;
    391438
     439//PS++ optimize code
     440    Processed = _ulBytesProcessed;
    392441    if (ulStreamState == STREAM_STREAMING)  // if the stream is active
    393442    {
    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();
    399448                Processed = _ulBytesProcessed; //last known position
    400             }
    401         }
    402         else
    403             Processed = _ulBytesProcessed;
    404     }
    405     else
    406         Processed = _ulBytesProcessed;
     449           }
     450        }
     451    }
    407452
    408453    // if we haven't processed anything then just return
     
    411456        return(_ulTimeBase);
    412457
    413     Seconds = Processed / _configinfo.ulPCMConsumeRate;
     458    Seconds  = Processed / _configinfo.ulPCMConsumeRate;
    414459    Overflow = Processed - (Seconds * _configinfo.ulPCMConsumeRate);
    415460    MilliSeconds = (Overflow * 1000) / _configinfo.ulPCMConsumeRate;
    416461    MilliSeconds += (Seconds * 1000);
    417     return(MilliSeconds + _ulTimeBase);
     462    return (MilliSeconds + _ulTimeBase);
    418463}
    419464//******************************************************************************
     
    423468    ULONG Processed;
    424469
     470//PS++ optimize code
     471    Processed = _ulBytesProcessed;
    425472    if (ulStreamState == STREAM_STREAMING)  // if the stream is active
    426473    {
    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           {
    430478                DebugInt3();
    431479                Processed = _ulBytesProcessed; //last known position
    432             }
     480           }
    433481        }
    434         else
    435             Processed = _ulBytesProcessed;
    436     }
    437     else
    438         Processed = _ulBytesProcessed;
     482    }
    439483
    440484    return Processed;
     
    446490   ULONG writepos = 0;
    447491
     492// May be lock?
    448493   cli();
    449494   PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Tail();
    450495
    451    if(!pTemp) {
     496   if(!pTemp)
     497   {
    452498       pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    453499   }
    454    if(pTemp) {
     500   if(pTemp)
     501   {
    455502       writepos = pTemp->ulBuffpos;
    456503   }
     
    478525#endif
    479526
    480     if(ulStreamState == STREAM_STREAMING) {
     527    if(ulStreamState == STREAM_STREAMING)
     528    {
    481529        ddprintf(("StartStream: already playing!!"));
    482530        return NO_ERROR;
     
    485533    // configure the wave device
    486534    // (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    {
    488537        ddprintf(("StartStream: ConfigDev failed!!"));
    489         goto fail;
     538        return ERROR_INSUFF_BUFFER;
     539//        goto fail;
    490540    }
    491541    // prepare wave device for playback/recording
    492     if(pahw->Prepare(StreamId) == FALSE) {
     542    if(pahw->Prepare(StreamId) == FALSE)
     543    {
    493544        ddprintf(("StartStream: Prepare failed!!"));
    494545        goto fail;
     
    499550    ulStreamState = STREAM_STREAMING;
    500551    //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
    502555        AddBuffers(TRUE);
    503556        //Must set volume after adding buffers (voices inside sblive driver might not
    504557        //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    {
    509564        ulSavedInputGain = pahw->QueryVolume(StreamId, getMixerStreamId());
    510565        pahw->SetInputSrc(StreamId, getMixerStreamId(), inputsrc);
    511566        pahw->SetVolume(StreamId, getMixerStreamId(), inputgain);
    512567
    513         if(pahw->Start(StreamId) != TRUE) {
     568        if(pahw->Start(StreamId) != TRUE)
     569       {
    514570            dprintf(("pahw->Start failed!!"));
    515571            goto fail;
    516572        }
    517573    }
    518     ddprintf(("WAVESTREAM::StartStream %lx", StreamId));
     574    ddprintf(("WAVESTREAM::StartStream %lx End", StreamId));
    519575    return NO_ERROR;
    520576
     
    665721        if(DevHelp_VMAlloc((VMDHA_FIXED | VMDHA_CONTIG), CONVERSION_BUFFER_SIZE, (ULONG)-1L, &linAddr, &pSelOff) != 0)
    666722        {
    667                            //dgprintf(("Error in DevHelp_VMAlloc Conversion Buffer"));
     723             dgprintf(("Error in DevHelp_VMAlloc Conversion Buffer"));
    668724             DebugInt3(); //should never happen!!
    669725             _configinfo.usConversion = CONVERT_NONE;
     
    676732        LIN   linAddr;
    677733
    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)
    679735        {
    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!!
    682738        }
    683739        else _configinfo.pSRateConvBuffer = linAddr;
  • OCO/trunk/include/dbgos2.h

    r396 r468  
    2525#define ddprintf(a) if(dbglevel >= 1) PrintfOut a
    2626#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
    2833
    2934#ifdef DEBUG
Note: See TracChangeset for help on using the changeset viewer.