Changeset 483


Ignore:
Timestamp:
May 6, 2010, 3:08:34 AM (15 years ago)
Author:
David Azarewicz
Message:

Rework buffer management

Location:
OCO/trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • OCO/trunk/drv16/commdbg.c

    r473 r483  
    204204
    205205      if (Power==0xF0000000)                  // 1 billion
    206          Power=0xF000000;     
     206         Power=0xF000000;
    207207      else if (Power==0xF000000)
    208208         Power=0xF00000;
     
    230230ULONG DBGCALLCONV _cdecl OSS16_DebugString(char FAR *debstr,ULONG bufsize);
    231231
     232#ifdef DEBUG_COM
     233
     234short int MAGIC_COMM_PORT = 0x3f8;
     235
     236
     237#define UART_DATA               0x00            // UART Data port
     238#define UART_INT_ENAB           0x01            // UART Interrupt enable
     239#define UART_INT_ID             0x02            // interrupt ID
     240#define UART_LINE_CTRL          0x03            // line control registers
     241#define UART_MODEM_CTRL         0x04            // modem control register
     242#define UART_LINE_STAT          0x05            // line status register
     243#define UART_MODEM_STAT         0x06            // modem status regiser
     244#define UART_DIVISOR_LO         0x00            // divisor latch least sig
     245#define UART_DIVISOR_HI         0x01h           // divisor latch most sig
     246
     247#define DELAY   nop
     248
     249void CharOut(char c)
     250{
     251        _asm    {
     252
     253        mov     dx, MAGIC_COMM_PORT     // address of PS/2's first COM port
     254        add     dx, UART_LINE_STAT
     255
     256ReadyCheck:
     257        in      al, dx                                                          // wait for comm port ready signal
     258
     259        DELAY
     260        DELAY
     261        DELAY
     262
     263        test    al, 020h
     264        jz      ReadyCheck
     265
     266        // Send the character
     267
     268        add     dx, UART_DATA - UART_LINE_STAT
     269        mov     al,c
     270        out     dx, al
     271        }
     272}
     273
     274void StringOut(char far *DbgStr)
     275{
     276   while (*DbgStr)
     277      CharOut(*DbgStr++);
     278
     279   if (fLineTerminate)
     280   {
     281      CharOut(CR);                              // append carriage return,
     282      CharOut(LF);                              // linefeed
     283   }
     284}
     285
     286#endif
     287
    232288void cdecl far PrintfOut(char far *DbgStr , ...)
    233289{
     
    334390
    335391   *BuildPtr=0;                                 // cauterize the string
    336 //PS+++   StringOut((char far *) BuildString);         // print to comm port
     392#ifdef DEBUG_COM
     393   StringOut((char far *) BuildString);         // print to comm port
     394#endif
    337395//PS++ if want can add option like /Ox and set this if(comport) StringOut((char far *) BuildString);
    338396   OSS16_DebugString((char far *) BuildString,0);         // print to Uniaud32 alsahlp$
    339397}
    340398
    341 #ifdef DEBUG_COM
    342 
    343 void StringOut(char far *DbgStr)
    344 {
    345    while (*DbgStr)
    346       CharOut(*DbgStr++);
    347 
    348    if (fLineTerminate)
    349    {
    350       CharOut(CR);                              // append carriage return,
    351       CharOut(LF);                              // linefeed
    352    }
    353 }
    354 
    355 short int MAGIC_COMM_PORT = 0x3f8;
    356 
    357 
    358 #define UART_DATA               0x00            // UART Data port
    359 #define UART_INT_ENAB           0x01            // UART Interrupt enable
    360 #define UART_INT_ID             0x02            // interrupt ID
    361 #define UART_LINE_CTRL          0x03            // line control registers
    362 #define UART_MODEM_CTRL         0x04            // modem control register
    363 #define UART_LINE_STAT          0x05            // line status register
    364 #define UART_MODEM_STAT         0x06            // modem status regiser
    365 #define UART_DIVISOR_LO         0x00            // divisor latch least sig
    366 #define UART_DIVISOR_HI         0x01h           // divisor latch most sig
    367 
    368 #define DELAY   nop
    369 
    370 void CharOut(char c)
    371 {
    372         _asm    {
    373 
    374         mov     dx, MAGIC_COMM_PORT     // address of PS/2's first COM port
    375         add     dx, UART_LINE_STAT
    376 
    377 ReadyCheck:
    378         in      al, dx                                                          // wait for comm port ready signal
    379 
    380         DELAY
    381         DELAY
    382         DELAY
    383 
    384         test    al, 020h
    385         jz      ReadyCheck
    386 
    387         // Send the character
    388 
    389         add     dx, UART_DATA - UART_LINE_STAT
    390         mov     al,c
    391         out     dx, al
    392         }
    393 }
    394 
    395 #endif
  • OCO/trunk/drv16/commdbg.h

    r237 r483  
    11#ifndef __COMMDBG_H__
    22#define __COMMDBG_H__
     3
     4#ifdef DEBUG
     5//#define DEBUG_COM
     6#endif
    37
    48#ifdef __cplusplus
  • OCO/trunk/drv16/dwavestrm.cpp

    r478 r483  
    4444
    4545    pStream = (PDWAVESTREAM)FindStream_fromFile(ulSysFileNum);
    46     if (pStream == NULL) 
     46    if (pStream == NULL)
    4747    {
    4848        dprintf(("HookHandler stream %lx not found!", (ULONG) ulSysFileNum));
     
    124124   if(temp)
    125125   {
    126         if(ulStreamState == STREAM_STREAMING) 
     126        if(ulStreamState == STREAM_STREAMING)
    127127        {//means we're called during an interrupt
    128128            qhReturn.PushOnTail((PQUEUEELEMENT)temp);
    129129            DevHelp_ArmCtxHook(ulSysFileNum, hCtxHook);
    130130        }
    131         else 
     131        else
    132132        {
    133133            DevHelp_VMFree((LIN)temp->pBuffptr);
     
    143143    hSem = pReg->hStream;
    144144
     145#ifdef DEBUG
    145146    dprintf(("DWAVESTREAM::Register"));
     147#endif
    146148    if(DevHelp_OpenEventSem(hSem) != 0) {
    147149        dprintf(("DevHlp_OpenEventSem %lx failed!", hSem));
     
    166168ULONG DWAVESTREAM::StartStream(void)
    167169{
    168     dprintf(("DWAVESTREAM::StartStream"));
    169    return WAVESTREAM::StartStream();
     170#ifdef DEBUG
     171        dprintf(("DWAVESTREAM::StartStream"));
     172#endif
     173        return WAVESTREAM::StartStream();
    170174}
    171175//*****************************************************************************
     
    176180   ULONG space, Buff_left, byteswritten;
    177181
    178 //    dprintf(("DW::AddBuffers"));
     182#ifdef DEBUG
     183        dprintf(("DW::AddBuffers"));
     184#endif
    179185    if (!pTemp) pTemp = (PSTREAMBUFFER)qhInProcess.Tail();
    180186
    181     if (ulStreamType & STREAM_WRITE && pTemp && pTemp->looping) 
     187    if (ulStreamType & STREAM_WRITE && pTemp && pTemp->looping)
    182188    {
    183189        Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
    184         if (pahw->GetPosition(StreamId, &_configinfo, &space) != OSSERR_SUCCESS) 
     190        if (pahw->GetPosition(StreamId, &_configinfo, &space) != OSSERR_SUCCESS)
    185191        {
    186192            dprintf(("DWAVESTREAM::AddBuffers GetPositions"));
     
    188194            return;
    189195        }
    190         if(fFirst) 
     196        if(fFirst)
    191197        {
    192198             space = min(space, 4*_configinfo.ulFragsize);
    193199        }
    194200        else
    195         { 
     201        {
    196202            space = min(space, _configinfo.ulFragsize);
    197203        }
    198         if (space) 
    199         {
    200            if (space >= Buff_left) 
     204        if (space)
     205        {
     206           if (space >= Buff_left)
    201207           {
    202208              byteswritten = AddBuffer(Buff_left);
    203               if (byteswritten == Buff_left) 
     209              if (byteswritten == Buff_left)
    204210              {
    205211                  pTemp->ulBuffpos = 0; //reset fill position
     
    207213              }
    208214           }
    209            else 
     215           else
    210216           {
    211217              AddBuffer(space);
     
    214220        pTemp->ulDonepos = 0; //make sure it ::Process never thinks it's done
    215221   }
    216    else 
     222   else
    217223   {
    218224     WAVESTREAM::AddBuffers(fFirst);
    219225   }
    220 //    dprintf(("DW::AddBuffers End"));
    221226}
    222227//*****************************************************************************
     
    252257//*****************************************************************************
    253258//*****************************************************************************
    254 ULONG DWAVESTREAM::GetProperty(int type) 
     259ULONG DWAVESTREAM::GetProperty(int type)
    255260{
    256261   switch(type) {
     
    279284   WAVESTREAM(streamtype, pinit, filesysnum, mixerStreamId), fError(FALSE), hCtxHook(0), hSem(0)
    280285{
    281     dprintf(("DWS::DWS Init"));
    282     if (DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook))
     286#ifdef DEBUG
     287        dprintf(("DWS::DWS Init"));
     288#endif
     289    if (DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook))
    283290    {
    284291        dprintf(("DWAVESTREAM::DWAVESTREAM AllocCtx"));
  • OCO/trunk/drv16/event.cpp

    r33 r483  
    5353   ulPopTime = ulNextTime;
    5454   ulNextTime = 0xFFFFFFFF;
     55
    5556
    5657   // send the event back to the SHDD
  • OCO/trunk/drv16/fmsynth.cpp

    r468 r483  
    4444BOOL FMSYNTH::Open(ULONG ulDevice, ULONG ulStreamType, ULONG ulSysFileNum, OSSSTREAMID FAR *pStreamId)
    4545{
    46     if(midiOutStreamId == 0) 
     46    if(midiOutStreamId == 0)
    4747    {
    4848        if(OSS16_MidiOpen(current_device, FM_SEND, pStreamId) != OSSERR_SUCCESS)
     
    8383//******************************************************************************
    8484int FMSYNTH::writeByte(OSSSTREAMID StreamId, BYTE b)
    85 { 
    86     int dummy = b; 
    87     return 0; 
     85{
     86    int dummy = b;
     87    return 0;
    8888}
    8989//******************************************************************************
     
    9494//******************************************************************************
    9595int FMSYNTH::readByte(OSSSTREAMID StreamId)
    96 { 
    97     dprintf(("FMSYNTH::readByte"));
     96{
     97    //dprintf(("FMSYNTH::readByte"));
    9898    DebugInt3();
    99     return -1; 
     99    return -1;
    100100}
    101101//******************************************************************************
  • OCO/trunk/drv16/init.cpp

    r259 r483  
    137137        DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
    138138        DosWrite(1, (VOID FAR*)szParamError, sizeof(szParamError)-1, &result);
    139         return;                 
     139        return;
    140140    }
    141141
     
    194194        DosWrite(1, (VOID FAR*)szAlsaError, sizeof(szAlsaError)-1, &result);
    195195        DosWrite(1, (VOID FAR*)NEWLINE, sizeof(NEWLINE)-1, &result);
    196         return;                 
     196        return;
    197197    }
    198198
  • OCO/trunk/drv16/ioctl.cpp

    r478 r483  
    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) 
     74   if (p->sMode == IDLE)
    7575   {
    7676       pstream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);
     
    117117         //HACK BEGIN
    118118         //SvL: Save stream handle & SHD entrypoint in case MMPM2 reinitializes
    119          //     a stream that was already registered 
     119         //     a stream that was already registered
    120120         //HACK END
    121121         if(pstream->pfnSHD) {
     
    145145
    146146   p->ulFlags = 0;  /* Zero the Flags  */
    147    switch (HardwareType) 
     147   switch (HardwareType)
    148148   {
    149149      case AUDIOHW_WAVE_PLAY:
     
    210210
    211211#ifdef DEBUG
    212    dprintf(("IACapability: dev type: %ld, ldev %d",ulDevicetype, LDev));
     212//   dprintf(("IACapability: dev type: %ld, ldev %d",ulDevicetype, LDev));
    213213#endif
    214214
     
    220220   // bailout if no hardware object is returned..
    221221   pHWobj = GetHardwareDevice(ulDevicetype);
    222    if (pHWobj) 
     222   if (pHWobj)
    223223   {
    224224      pHWobj->DevCaps(p);
    225       if (p->ulSupport != SUPPORT_SUCCESS) 
     225      if (p->ulSupport != SUPPORT_SUCCESS)
    226226      {
    227227         //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call
     
    237237   else {
    238238#ifdef DEBUG
    239        dprintf(("IACapability: Error get HW obj"));
     239//       dprintf(("IACapability: Error get HW obj"));
    240240#endif
    241241      //PS+++ filling to our parameters as say mmpm2.inf for returning error in this call
     
    268268   ULONG               addr;
    269269
    270    if (p->usIOCtlRequest != AUDIO_CHANGE) 
     270   if (p->usIOCtlRequest != AUDIO_CHANGE)
    271271   {
    272272       dprintf(("IAudioControl: Error support req:%x",p->usIOCtlRequest));
     
    282282   addr  = OFFSETOF(pAudChange);
    283283   addr += sizeof(MCI_AUDIO_CHANGE);
    284    if(addr >= 0x10000UL) 
     284   if(addr >= 0x10000UL)
    285285   {
    286286       dprintf(("Invalid MCI_AUDIO_CHANGE pnt %lx!!", (ULONG)pAudChange));
     
    294294   addr  = OFFSETOF(pMasterVol);
    295295   addr += sizeof(MCI_TRACK_INFO);
    296    if(addr >= 0x10000UL) 
     296   if(addr >= 0x10000UL)
    297297   {
    298298       dprintf(("Invalid MCI_TRACK_INFO pnt %lx!!", (ULONG)pMasterVol));
     
    311311       pStream->SetProperty(PROPERTY_BALANCE, pAudChange->lBalance);
    312312
    313    if (pAudChange->lVolume != AUDIO_IGNORE) 
     313   if (pAudChange->lVolume != AUDIO_IGNORE)
    314314   {
    315315       // stream volume ranges from 0 to 0x7FFFFFFF (linear)
     
    320320   }
    321321
    322    if (pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE) 
     322   if (pMasterVol && pMasterVol->usMasterVolume != AUDIO_IGNORE)
    323323   {
    324324       // master volume ranges from 0 to 0x7FFF (linear)
    325325       volume = pMasterVol->usMasterVolume;
    326326       volume = (volume*OSS32_MAX_VOLUME)/0x7FFFUL;
    327        if (volume > OSS32_MAX_VOLUME) 
     327       if (volume > OSS32_MAX_VOLUME)
    328328       {
    329329           volume = OSS32_MAX_VOLUME;
     
    331331//       dprintf(("IlAudioControl:Set MV to %d", volume));
    332332       MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_FRONT, MAKE_VOLUME_LR(volume, volume));
    333        if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_MASTER_REAR)) 
     333       if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_MASTER_REAR))
    334334       {
    335335           MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_MASTER_REAR, MAKE_VOLUME_LR(volume, volume));
     
    409409        {
    410410            pHWobj->DevCaps(&audioCaps);
    411             if (audioCaps.ulSupport != SUPPORT_SUCCESS) 
     411            if (audioCaps.ulSupport != SUPPORT_SUCCESS)
    412412            {
    413413                dprintf(("IDirectAudio: DevCaps failed"));
     
    417417            }
    418418        }
    419         else 
     419        else
    420420        {
    421421            dprintf(("IDirectAudio: HW DevCaps failed"));
     
    427427        pStream = new DWAVESTREAM(AUDIOHW_WAVE_PLAY, pInit,  prp->s.ioctl.usSysFileNum, MixerStreamId);
    428428        if(pStream == NULL) {
    429             dprintf(("IDirectAudio: pStream"));
     429//            dprintf(("IDirectAudio: pStream"));
    430430            DebugInt3();
    431431            pInit->sReturnCode = INVALID_REQUEST;
     
    434434        }
    435435
    436         if(!pStream->IsEverythingOk()) 
     436        if(!pStream->IsEverythingOk())
    437437        {
    438438            delete pStream;
    439             dprintf(("IlDirectAudio: IsEverythingOk"));
     439//            dprintf(("IlDirectAudio: IsEverythingOk"));
    440440            DebugInt3();
    441441            pInit->sReturnCode = INVALID_REQUEST;
     
    482482        {
    483483            pHWobj->DevCaps(&audioCaps);
    484             if (audioCaps.ulSupport != SUPPORT_SUCCESS) 
     484            if (audioCaps.ulSupport != SUPPORT_SUCCESS)
    485485            {
    486486                dprintf(("IlDirectAudio: DevCaps failed"));
     
    489489                return;
    490490            }
    491             dprintf(("IoctlDirectAudio ret0"));
     491//            dprintf(("IoctlDirectAudio ret0"));
    492492            pInit->sReturnCode = 0;
    493493            return;
     
    500500        }
    501501    }
    502     else 
    503     if(prp->s.ioctl.bCode == DAUDIO_QUERYCAPS) 
     502    else
     503    if(prp->s.ioctl.bCode == DAUDIO_QUERYCAPS)
    504504    {
    505505        LPOSS32_DEVCAPS lpCaps = (LPOSS32_DEVCAPS) prp->s.ioctl.pvData;
     
    519519        {
    520520            pHWobj->DevCaps(lpCaps);
    521             dprintf(("IoctlDirectAudio ret1"));
    522             return;
    523         }
    524         else 
     521//            dprintf(("IoctlDirectAudio ret1"));
     522            return;
     523        }
     524        else
    525525        {
    526526            prp->usStatus |= RPERR;
    527             dprintf(("IoctlDirectAudio ret err1"));
     527//            dprintf(("IoctlDirectAudio ret err1"));
    528528            return;
    529529        }
     
    532532
    533533    pStream = FindStream_fromFile((ULONG) prp->s.ioctl.usSysFileNum);
    534     if(pStream == NULL) 
     534    if(pStream == NULL)
    535535    {
    536536        dprintf(("IDirectAudio stream %lx not found!", (ULONG) prp->s.ioctl.usSysFileNum));
     
    553553    {
    554554    case DAUDIO_CLOSE:
    555          dprintf(("ID close"));
     555//         dprintf(("ID close"));
    556556        delete pStream;
    557557        break;
     
    559559    case DAUDIO_SETVOLUME:
    560560    {
    561         dprintf(("ID SetVolume"));
     561//        dprintf(("ID SetVolume"));
    562562        pStream->SetProperty(PROPERTY_VOLUME, MAKE_VOLUME_LR(pDAudioCmd->Vol.VolumeL, pDAudioCmd->Vol.VolumeR));
    563563        break;
     
    566566    case DAUDIO_GETVOLUME:
    567567    {
    568         dprintf(("ID GetVolume"));
     568//        dprintf(("ID GetVolume"));
    569569        pDAudioCmd->Vol.VolumeL = GET_VOLUME_L(pStream->GetProperty(PROPERTY_VOLUME));
    570570        pDAudioCmd->Vol.VolumeR = GET_VOLUME_R(pStream->GetProperty(PROPERTY_VOLUME));
     
    575575    {
    576576        dprintf(("ID Start NF:%d",(USHORT)numFreeStreams));
    577         if(numFreeStreams > 0) 
     577        if(numFreeStreams > 0)
    578578        {
    579579              rc = pStream->StartStream();
     
    631631    case DAUDIO_SETPROPERTY:
    632632    {
    633         dprintf(("ID SetProp"));
     633//        dprintf(("ID SetProp"));
    634634        rc = pStream->SetProperty((USHORT)pDAudioCmd->SetProperty.type, pDAudioCmd->SetProperty.value);
    635635        break;
     
    640640        DDCMDREGISTER reg;
    641641
    642         dprintf(("ID Reg"));
     642//        dprintf(("ID Reg"));
    643643        reg.ulFunction     = DDCMD_REG_STREAM;
    644644        reg.hStream        = pDAudioCmd->Thread.hSemaphore;
     
    651651    case DAUDIO_DEREGISTER_THREAD:
    652652    {
    653         dprintf(("ID DeReg"));
     653//        dprintf(("ID DeReg"));
    654654        pStream->DeRegister();
    655655        break;
     
    657657
    658658    case DAUDIO_QUERYVERSION:
    659         dprintf(("ID qVer"));
     659//        dprintf(("ID qVer"));
    660660        pDAudioCmd->Version.ulVersion = DAUDIO_VERSION;
    661661        break;
    662662    }
    663663
    664     if(rc) 
    665     {
    666         dprintf(("IoctlDirectAudio ret err rc=%ld",rc));
     664    if(rc)
     665    {
     666//        dprintf(("IoctlDirectAudio ret err rc=%ld",rc));
    667667        prp->usStatus |= RPERR | RPBADCMD;
    668668        return;
     
    687687extern "C" void StrategyIoctl(PREQPACKET prp, USHORT LDev)
    688688{
    689     if (prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT) 
     689    if (prp->s.ioctl.bCategory == DAUDIO_IOCTL_CAT)
    690690    {
    691691        IoctlDirectAudio(prp);
     
    696696    dprintf(("StrategyIoctl:cat:0x%x, code:0x%x cd %d gd %d", prp->s.ioctl.bCategory, prp->s.ioctl.bCode, current_device, LDev));
    697697#endif
    698     if (prp->s.ioctl.bCategory == 0x90) 
     698    if (prp->s.ioctl.bCategory == 0x90)
    699699    {
    700700        IoctlMixer(prp, LDev);
    701701        return;
    702702    }
    703     if (prp->s.ioctl.bCategory != AUDIO_IOCTL_CAT) 
     703    if (prp->s.ioctl.bCategory != AUDIO_IOCTL_CAT)
    704704    {
    705705        prp->usStatus |= RPERR | RPBADCMD;
     
    724724
    725725#ifdef DEBUG
    726     dprintf(("StrategyIoctl:ret:0x%x", (USHORT)prp->usStatus));
     726//    dprintf(("StrategyIoctl:ret:0x%x", (USHORT)prp->usStatus));
    727727#endif
    728728    return;
  • OCO/trunk/drv16/mixer.cpp

    r478 r483  
    8181/* OSS32_MIX_VOLUME_SPEAKER       */   MONOINSET & 0xF,
    8282/* OSS32_MIX_VOLUME_PHONE         */   PHONESET & 0xF,
    83 /* OSS32_MIX_VOLUME_HEADPHONE     */   -1, 
     83/* OSS32_MIX_VOLUME_HEADPHONE     */   -1,
    8484/* OSS32_MIX_VOLUME_AUX           */   AUXSET & 0xF,
    8585/* OSS32_MIX_VOLUME_CAPTURE       */   RECORDGAINSET & 0xF,
     
    109109    USHORT    VolumeL, VolumeR;
    110110
     111    //dprintf(("IoctlMixer Dev=%x Code=%x Data=%x", LDev, prp->s.ioctl.bCode, prp->s.ioctl.pvData));
    111112    if((prp->s.ioctl.bCode & 0xF0) == 0x40)
    112113    {
     
    123124        if(prp->s.ioctl.bCode == RECORDSRCSET ||
    124125           prp->s.ioctl.bCode == RECORDGAINSET ||
    125            prp->s.ioctl.bCode == STREAMVOLSET) 
     126           prp->s.ioctl.bCode == STREAMVOLSET)
    126127        {
    127128             if(pMixStruct->Mute != 2) { //don't save lock override value
     
    149150    }
    150151
    151     if(prp->s.ioctl.bCode >= MONOINSET && prp->s.ioctl.bCode <= RECORDGAINSET) 
     152    if(prp->s.ioctl.bCode >= MONOINSET && prp->s.ioctl.bCode <= RECORDGAINSET)
    152153    {
    153154        int idx = prp->s.ioctl.bCode & 0xF;
     
    198199                break;
    199200            }
    200             MixerSetProperty(MixerStreamId, OSS32_MIX_INPUTSRC, recsrc, 
     201            MixerSetProperty(MixerStreamId, OSS32_MIX_INPUTSRC, recsrc,
    201202                             MIXFLAG_FORCE_UPDATE|MIXFLAG_IOCTL90);
    202203            break;
     
    210211            fRecGainIOCTL90 = TRUE;
    211212            //must use left volume value only
    212             MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_CAPTURE, MAKE_VOLUME_LR(VolumeL, VolumeL), 
     213            MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_CAPTURE, MAKE_VOLUME_LR(VolumeL, VolumeL),
    213214                           MIXFLAG_FORCE_UPDATE|MIXFLAG_IOCTL90);
    214215            break;
     
    223224
    224225            fPCMVolIOCTL90 = TRUE;
    225             MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_PCM, MAKE_VOLUME_LR(VolumeL, VolumeR), 
     226            MixerSetVolume(MixerStreamId, OSS32_MIX_VOLUME_PCM, MAKE_VOLUME_LR(VolumeL, VolumeR),
    226227                           MIXFLAG_FORCE_UPDATE|MIXFLAG_IOCTL90);
    227228            break;
     
    233234        }
    234235    }
    235     else 
    236     if(prp->s.ioctl.bCode >= MONOINQUERY && prp->s.ioctl.bCode <= RECORDGAINQUERY) 
     236    else
     237    if(prp->s.ioctl.bCode >= MONOINQUERY && prp->s.ioctl.bCode <= RECORDGAINQUERY)
    237238     {
    238239        int idx = prp->s.ioctl.bCode & 0xF;
     
    289290                return;
    290291            }
    291         }       
    292         else 
     292        }
     293        else
    293294        if(oldsem) {
    294295            if(DevHelp_CloseEventSem(oldsem) != 0) {
     
    333334
    334335    //if input gain is not supported by hardware, then change line volume
    335     if(ulControl == OSS32_MIX_VOLUME_CAPTURE && !(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_CAPTURE))) 
     336    if(ulControl == OSS32_MIX_VOLUME_CAPTURE && !(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_CAPTURE)))
    336337    {
    337338        dprintf(("MixerSetVolume: No input gain -> change line volume!!"));
     
    359360    }
    360361
    361     if(!(fFlags & MIXFLAG_DONTSAVE)) 
    362     {
    363         if(ulControl < OSS32_MIX_MAX_CONTROLS && ALSAToIOCTL90Control[ulControl] != -1) 
     362    if(!(fFlags & MIXFLAG_DONTSAVE))
     363    {
     364        if(ulControl < OSS32_MIX_MAX_CONTROLS && ALSAToIOCTL90Control[ulControl] != -1)
    364365        {
    365366            int idx = ALSAToIOCTL90Control[ulControl];
     
    409410    }
    410411
    411     if(ulControl < OSS32_MIX_MAX_CONTROLS && (mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(ulControl))) 
    412     {
    413         ulVolume = MAKE_VOLUME_LR(MixerSettingsALSA[ulControl].VolumeL, 
     412    if(ulControl < OSS32_MIX_MAX_CONTROLS && (mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(ulControl)))
     413    {
     414        ulVolume = MAKE_VOLUME_LR(MixerSettingsALSA[ulControl].VolumeL,
    414415                                  MixerSettingsALSA[ulControl].VolumeR);
    415416    }
     
    424425    ULONG ulVolume = 0;
    425426
    426     if(ulControl < OSS32_MIX_MAX_CONTROLS && (mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(ulControl))) 
    427     {
    428         ulVolume = MAKE_VOLUME_LR(MixerSettingsALSA[ulControl].VolumeL, 
     427    if(ulControl < OSS32_MIX_MAX_CONTROLS && (mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(ulControl)))
     428    {
     429        ulVolume = MAKE_VOLUME_LR(MixerSettingsALSA[ulControl].VolumeL,
    429430                                  MixerSettingsALSA[ulControl].VolumeR);
    430431    }
     
    435436//******************************************************************************
    436437void DBGCALLCONV MixerSuspend()
    437 { 
     438{
    438439    ULONG ulVolume;
    439440    int i;
    440441
    441     dprintf(("MixerSuspend"));
     442        //dprintf(("MixerSuspend"));
    442443
    443444    for(i=0;i<=OSS32_MIX_VOLUME_MAX;i++) {
     
    470471    int i;
    471472
    472     dprintf(("MixerRestoreState"));
     473        //dprintf(("MixerRestoreState"));
    473474
    474475    //restore mixer control volume
     
    586587
    587588    if(hMixerNotifySem) {
    588         dprintf(("Notify mixer change"));
     589                //dprintf(("Notify mixer change"));
    589590        rc = DevHelp_PostEventSem(hMixerNotifySem);
    590591        if(rc != 0) {
     
    611612    USHORT lVolume, rVolume;
    612613
    613     if(OSS16_MixOpen(LDev, &MixerStreamId) != OSSERR_SUCCESS) 
     614    if(OSS16_MixOpen(LDev, &MixerStreamId) != OSSERR_SUCCESS)
    614615    {
    615616        DebugInt3();
     
    617618        return;
    618619    }
    619     if(OSS16_MixQueryCaps(MixerStreamId, &mixcaps) != OSSERR_SUCCESS) 
     620    if(OSS16_MixQueryCaps(MixerStreamId, &mixcaps) != OSSERR_SUCCESS)
    620621    {
    621622        DebugInt3();
     
    685686        ALSAIOCTLMap[VIDEOSET]         = 1;
    686687        ALSAIOCTLMap[VIDEOQUERY]       = 1;
    687    
     688
    688689        //Set VIDEO
    689690        rp.s.ioctl.bCode  = VIDEOSET;
     
    702703        mixinfo.Mute    = 1;
    703704        mixinfo.VolumeR = mixinfo.VolumeL = 80;
    704         IoctlMixer(&rp, LDev);   
     705        IoctlMixer(&rp, LDev);
    705706    }
    706707    if(mixcaps.fuCtrlCaps & OSS32_MIX_FLAG(OSS32_MIX_VOLUME_PHONE)) {
  • OCO/trunk/drv16/ossidc16.cpp

    r473 r483  
    279279//******************************************************************************
    280280//******************************************************************************
    281 //******************************************************************************
    282 //******************************************************************************
    283281OSSRET DBGCALLCONV OSS16_WaveGetHwPtr(OSSSTREAMID StreamId, ULONG FAR *lpBytesLeft)
    284282{
     
    295293   return ret;
    296294}
     295//******************************************************************************
     296//******************************************************************************
    297297OSSRET DBGCALLCONV OSS16_WaveSetVolume(OSSSTREAMID StreamId, ULONG volume)
    298298{
     
    688688#pragma on (unreferenced)
    689689{
    690 //    dprintf(("OSSIDC ep. cmd: %x param1: %x, param2: %x",cmd, param1, param2));
     690    //dprintf(("OSSIDC cmd:%lx param1:%lx param2:%lx", cmd, param1, param2));
    691691    switch(cmd & 0xFFFF)
    692692    {
     
    715715    {
    716716        PWAVESTREAM pStream;
    717 //           dprintf(("IDC16_PROCESS"));
    718            //Signal all active wave playback streams to update their status
     717                //dprintf(("IDC16_PROCESS, %d", param1));
     718        //Signal all active wave playback streams to update their status
    719719            pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_PLAY);
    720             while(pStream) 
     720            while(pStream)
    721721           {
    722722                pStream->Process();
     
    725725           //Signal all active wave capture streams to update their status
    726726           pStream = (PWAVESTREAM)FindFirstActiveStream(STREAM_WAVE_CAPTURE);
    727            while(pStream) 
     727           while(pStream)
    728728           {
    729729                 pStream->Process();
    730730                 pStream = (PWAVESTREAM)FindNextActiveStream(STREAM_WAVE_CAPTURE, pStream);
    731731           }
    732 //           dprintf(("IDC16_PROCESS end"));
     732                        //dprintf(("IDC16_PROCESS end"));
    733733           break;
    734734    }
  • OCO/trunk/drv16/rtmidi.cpp

    r33 r483  
    209209    MIDIAUDIO *pma = (MIDIAUDIO *) pMidiAudio;
    210210
    211     dprintf(("rtmidi: RecvByte"));
     211    //dprintf(("rtmidi: RecvByte"));
    212212
    213213   if(!pma) {
     
    233233   MIDIAUDIO *pma = (MIDIAUDIO *) pMidiAudio;
    234234
    235    dprintf(("rtmidi: RecvString"));
     235   //dprintf(("rtmidi: RecvString"));
    236236
    237237   if(!pma) {
  • OCO/trunk/drv16/ssm_idc.cpp

    r478 r483  
    4343   }
    4444#endif
    45 
    4645   switch (pCommon->ulFunction) {
    4746
    4847      case DDCMD_SETUP: {
     48         ddprintf(("DDCMD_SETUP"));
    4949         if (!pstream)
    5050         {
     
    5656         pstream->SetCurrentTime(psp->ulStreamTime);
    5757
    58            // if there is a flags field in the SETUP_PARM
    59            // the tell MMPM it can send us 'RECURRING' events....
    60          if (p->ulSetupParmSize > sizeof(ULONG)) 
     58         // if there is a flags field in the SETUP_PARM
     59         // the tell MMPM it can send us 'RECURRING' events....
     60         if (p->ulSetupParmSize > sizeof(ULONG))
    6161         {
    62 //            dprintf(("DDCMD_SETUP ParmSize %ld", p->ulSetupParmSize));
     62                        // dprintf(("DDCMD_SETUP ParmSize %ld", p->ulSetupParmSize));
    6363            psp->ulFlags = SETUP_RECURRING_EVENTS;
    6464         }
     
    6868         ddprintf(("DDCMD_READ"));
    6969         PDDCMDREADWRITE p=(PDDCMDREADWRITE) pCommon;
    70 
    7170
    7271         if (!pstream)
     
    7978      }
    8079      // Task time
    81       case DDCMD_WRITE: 
     80      case DDCMD_WRITE:
    8281      {
    8382           PDDCMDREADWRITE p=(PDDCMDREADWRITE) pCommon;
    84            ULONG           Space;
    8583
    8684           if (!pstream)
     
    8987              return ERROR_INVALID_STREAM;
    9088           }
    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 //           ddprintf(("DDCMD_WRITE"));
    10189           ulReturnCode = pstream->Write((PSTREAMBUF) p->pBuffer,(unsigned) p->ulBufferSize);
    102            ddprintf(("DDCMD_WRITE %lx rc=%ld",p->ulBufferSize, ulReturnCode));
     90           ddprintf(("DDCMD_WRITE %lx %lx rc=%ld", p->pBuffer, p->ulBufferSize, ulReturnCode));
    10391           if (ulReturnCode)
    10492              return ulReturnCode;
     
    10694      }
    10795      case DDCMD_STATUS: {
    108          ddprintf(("DDCMD_STATUS"));
    109          PDDCMDSTATUS p = (PDDCMDSTATUS) pCommon;
    110          PSTATUS_PARM p2 = (PSTATUS_PARM) p->pStatus;
    111          if (!pstream)
    112            return ERROR_INVALID_STREAM;
    113          p2->ulTime = pstream->GetCurrentTime();
    114 //         ddprintf(("DDCMD_STATUS time:%ld",p2->ulTime));
    115          break;
     96                PDDCMDSTATUS p = (PDDCMDSTATUS) pCommon;
     97                PSTATUS_PARM p2 = (PSTATUS_PARM) p->pStatus;
     98                if (!pstream)
     99                        return ERROR_INVALID_STREAM;
     100                p2->ulTime = pstream->GetCurrentTime();
     101                ddprintf(("DDCMD_STATUS time:%lx", p2->ulTime));
     102                break;
    116103      }
    117       case DDCMD_CONTROL: 
     104      case DDCMD_CONTROL:
    118105      {
    119106         PDDCMDCONTROL p = (PDDCMDCONTROL) pCommon;
     
    124111         }
    125112
    126          switch (p->ulCmd) 
     113         switch (p->ulCmd)
    127114         {
    128115         case DDCMD_START:
    129116             ddprintf(("DDCMD_START"));
    130117             ulReturnCode = pstream->StartStream();
    131              ddprintf(("DDCMD_START End rc=%ld",ulReturnCode));
     118             //ddprintf(("DDCMD_START End rc=%ld",ulReturnCode));
    132119             return ulReturnCode;
    133120         case DDCMD_STOP:
    134121             ddprintf(("DDCMD_STOP"));
    135 //             DevHelp_ProcBlock ((ULONG)p, 2, 0);
     122                        //DevHelp_ProcBlock ((ULONG)p, 2, 0);
    136123             p->ulParmSize=sizeof(ULONG);
    137124             return pstream->StopStream((PCONTROL_PARM)p->pParm);
     
    156143             return pstream->ResumeStreamTime();
    157144         default:
     145                ddprintf(("DDCMD INVALID REQUEST\n"));
    158146            return ERROR_INVALID_REQUEST;
    159147         } /* endswitch */
    160148      }
    161       case DDCMD_REG_STREAM: 
     149      case DDCMD_REG_STREAM:
    162150      {
    163151         ddprintf(("DDCMD_REG_STREAM size:%lx countbuf:%lx",((PDDCMDREGISTER) pCommon)->ulBufSize, ((PDDCMDREGISTER) pCommon)->ulNumBufs));
  • OCO/trunk/drv16/stream.cpp

    r468 r483  
    4646   PSTREAMBUFFER temp = (PSTREAMBUFFER)qhDone.PopHead();
    4747
    48    if (temp) 
     48   if (temp)
    4949   {
    5050            shdri.ulFunction = SHD_REPORT_INT;
     
    5252        // if this is a write (playback) then set the streamtype and
    5353        // tell the stream handler that we played all of the buffer.
    54         if (ulStreamType & STREAM_WRITE) 
    55        {
     54        if (ulStreamType & STREAM_WRITE)
     55        {
    5656                shdri.ulFlag = SHD_WRITE_COMPLETE;
    5757                shdri.ulStatus = temp->ulBuffsz;
     
    6666        shdri.pBuffer = temp->pBuffptr;
    6767        shdri.ulStreamTime = GetCurrentTime();
     68                //ddprintf(("Returning %lx Time=%lx", temp->pBuffptr, shdri.ulStreamTime));
    6869        pfnSHD(&shdri);
    6970        delete temp;
     
    9495//SvL: BUGFIX: check all events
    9596#if 1
    96    if (qhEvent.IsElements()) {
    97         PEVENT pnextevent = (PEVENT)qhEvent.Head();
    98         ULONG  time = GetCurrentTime();
    99         while(pnextevent) {
    100                 ULONG eventtime = pnextevent->GetEventTime();
    101                 if (eventtime <= time)
    102                         pnextevent->Report(time);
    103                 pnextevent = (PEVENT)pnextevent->pNext;
     97        if (qhEvent.IsElements()) {
     98                PEVENT pnextevent = (PEVENT)qhEvent.Head();
     99                ULONG  time = GetCurrentTime();
     100                while(pnextevent) {
     101                        ULONG eventtime = pnextevent->GetEventTime();
     102                        if (eventtime <= time)
     103                                pnextevent->Report(time);
     104                        pnextevent = (PEVENT)pnextevent->pNext;
     105                }
    104106        }
    105    }
    106107#else
    107108   if (qhEvent.IsElements()) {
     
    173174ULONG STREAM::Register(PDDCMDREGISTER p)
    174175{
    175    ddprintf(("STREAM::Register"));
     176//   ddprintf(("STREAM::Register"));
    176177   hstream             = p->hStream;
    177178   pfnSHD              = (PFN_SHD) p->pSHDEntryPoint;
     
    236237   // event to time out.. if it is not already on
    237238   // the head of the Event queue then put it there
    238    if (pele2 != qhEvent.Head()) 
     239   if (pele2 != qhEvent.Head())
    239240   {
    240241      cli();
     
    328329//******************************************************************************
    329330//******************************************************************************
    330 ULONG STREAM::GetProperty(int type) 
     331ULONG STREAM::GetProperty(int type)
    331332{
    332333   switch(type) {
     
    358359}
    359360//******************************************************************************
    360 static int streamtype[STREAM_MAX_TYPES] = {STREAM_WAVE_CAPTURE, STREAM_WAVE_PLAY, 
     361static int streamtype[STREAM_MAX_TYPES] = {STREAM_WAVE_CAPTURE, STREAM_WAVE_PLAY,
    361362                                           STREAM_MPU401_CAPTURE,
    362363                                           STREAM_MPU401_PLAY, STREAM_FMSYNTH_PLAY};
  • OCO/trunk/drv16/timer.cpp

    r473 r483  
    127127   pStream = (MIDISTREAM*) FindActiveStream( ulStreamType );
    128128
    129    dprintf(("TIMER::Ctx"));
     129//   dprintf(("TIMER::Ctx"));
    130130   if (pStream)   // Should always be a valid fn adr when timer is running.
    131131      pStream->Process();
     
    399399      uMSec = _uInterval_mSec;
    400400      _uCumulativeError += _uIntervalErr_uSec;
    401       if (_uCumulativeError >= 1000) 
     401      if (_uCumulativeError >= 1000)
    402402      {
    403403//PS++ begin
  • OCO/trunk/drv16/waudio.cpp

    r478 r483  
    559559        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    560560        pConfigInfo->pfnConvert = ConvertNone;
    561         dprintf(("CNV_NONE"));
     561//        dprintf(("CNV_NONE"));
    562562        break;
    563563
     
    566566        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    567567        pConfigInfo->pfnConvert = Convert8To8SignChange;
    568         dprintf(("CNV_8_U_TO_8_S/CNV_8_S_TO_8_U"));
     568//        dprintf(("CNV_8_U_TO_8_S/CNV_8_S_TO_8_U"));
    569569        break;
    570570
     
    573573        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);   //factor 2
    574574        pConfigInfo->pfnConvert = Convert8MonoTo8Stereo;
    575         dprintf(("CNV_8_U_TO_8_U_MN_ST/CNV_8_S_TO_8_S_MN_ST"));
     575//        dprintf(("CNV_8_U_TO_8_U_MN_ST/CNV_8_S_TO_8_S_MN_ST"));
    576576        break;
    577577
     
    580580        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);   //factor 2
    581581        pConfigInfo->pfnConvert = Convert8MonoTo8StereoSignChange;
    582         dprintf(("CNV_8_S_TO_8_U_MN_ST/CNV_8_U_TO_8_S_MN_ST"));
     582//        dprintf(("CNV_8_S_TO_8_U_MN_ST/CNV_8_U_TO_8_S_MN_ST"));
    583583        break;
    584584
     
    587587        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);   //factor 2
    588588        pConfigInfo->pfnConvert = Convert8To16;
    589         dprintf(("CNV_8_S_TO_16_S/CNV_8_U_TO_16_U"));
     589//        dprintf(("CNV_8_S_TO_16_S/CNV_8_U_TO_16_U"));
    590590        break;
    591591
     
    594594        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);   //factor 2
    595595        pConfigInfo->pfnConvert = Convert8To16SignChange;
    596         dprintf(("CNV_8_S_TO_16_U/CNV_8_U_TO_16_S"));
     596        //dprintf(("CNV_8_S_TO_16_U/CNV_8_U_TO_16_S"));
    597597        break;
    598598
     
    601601        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(2,0);   //factor 4
    602602        pConfigInfo->pfnConvert = Convert8MonoTo16Stereo;
    603         dprintf(("CNV_8_S_TO_16_S_MN_ST/CNV_8_U_TO_16_U_MN_ST"));
     603        //dprintf(("CNV_8_S_TO_16_S_MN_ST/CNV_8_U_TO_16_U_MN_ST"));
    604604        break;
    605605
     
    608608        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(2,0);   //factor 4
    609609        pConfigInfo->pfnConvert = Convert8MonoTo16StereoSignChange;
    610         dprintf(("CNV_8_S_TO_16_U_MN_ST/CNV_8_U_TO_16_S_MN_ST"));
     610        //dprintf(("CNV_8_S_TO_16_U_MN_ST/CNV_8_U_TO_16_S_MN_ST"));
    611611        break;
    612612
     
    614614        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    615615        pConfigInfo->pfnConvert = Convert8UnsignedTo8UnsignedStereoMono;
    616         dprintf(("CNV_8_U_TO_8_U_ST_MN"));
     616        //dprintf(("CNV_8_U_TO_8_U_ST_MN"));
    617617        break;
    618618
     
    620620        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    621621        pConfigInfo->pfnConvert = Convert8SignedTo8SignedStereoMono;
    622         dprintf(("CNV_8_S_TO_8_S_ST_MN"));
     622        //dprintf(("CNV_8_S_TO_8_S_ST_MN"));
    623623        break;
    624624
     
    626626        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    627627        pConfigInfo->pfnConvert = Convert8UnsignedTo8SignedStereoMono;
    628         dprintf(("CNV_8_U_TO_8_S_ST_MN"));
     628        //dprintf(("CNV_8_U_TO_8_S_ST_MN"));
    629629        break;
    630630
     
    632632        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    633633        pConfigInfo->pfnConvert = Convert8SignedTo8UnsignedStereoMono;
    634         dprintf(("CNV_8_S_TO_8_U_ST_MN"));
     634        //dprintf(("CNV_8_S_TO_8_U_ST_MN"));
    635635        break;
    636636
     
    638638        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    639639        pConfigInfo->pfnConvert = Convert8UnsignedTo16UnsignedStereoMono;
    640         dprintf(("CNV_8_U_TO_16_U_ST_MN"));
     640        //dprintf(("CNV_8_U_TO_16_U_ST_MN"));
    641641        break;
    642642
     
    644644        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    645645        pConfigInfo->pfnConvert = Convert8UnsignedTo16SignedStereoMono;
    646         dprintf(("CNV_8_U_TO_16_S_ST_MN"));
     646        //dprintf(("CNV_8_U_TO_16_S_ST_MN"));
    647647        break;
    648648
     
    650650        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    651651        pConfigInfo->pfnConvert = Convert8SignedTo16SignedStereoMono;
    652         dprintf(("CNV_8_S_TO_16_S_ST_MN"));
     652        //dprintf(("CNV_8_S_TO_16_S_ST_MN"));
    653653        break;
    654654
     
    656656        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    657657        pConfigInfo->pfnConvert = Convert8SignedTo16UnsignedStereoMono;
    658         dprintf(("CNV_8_S_TO_16_U_ST_MN"));
     658        //dprintf(("CNV_8_S_TO_16_U_ST_MN"));
    659659        break;
    660660
     
    663663        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    664664        pConfigInfo->pfnConvert = Convert16To16SignChange;
    665         dprintf(("CNV_16_U_TO_16_S/CNV_16_S_TO_16_U"));
     665        //dprintf(("CNV_16_U_TO_16_S/CNV_16_S_TO_16_U"));
    666666        break;
    667667
     
    670670        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    671671        pConfigInfo->pfnConvert = Convert16To8;
    672         dprintf(("CNV_16_U_TO_8_U/CNV_16_S_TO_8_S"));
     672        //dprintf(("CNV_16_U_TO_8_U/CNV_16_S_TO_8_S"));
    673673        break;
    674674
     
    677677        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    678678        pConfigInfo->pfnConvert = Convert16To8SignChange;
    679         dprintf(("CNV_16_U_TO_8_S/CNV_16_S_TO_8_U"));
     679        //dprintf(("CNV_16_U_TO_8_S/CNV_16_S_TO_8_U"));
    680680        break;
    681681
     
    684684        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);   //factor 2
    685685        pConfigInfo->pfnConvert = Convert16MonoTo16Stereo;
    686         dprintf(("CNV_16_U_TO_16_U_MN_ST/CNV_16_S_TO_16_S_MN_ST"));
     686        //dprintf(("CNV_16_U_TO_16_U_MN_ST/CNV_16_S_TO_16_S_MN_ST"));
    687687        break;
    688688
     
    691691        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(1,0);   //factor 2
    692692        pConfigInfo->pfnConvert = Convert16MonoTo16StereoSignChange;
    693         dprintf(("CNV_16_U_TO_16_S_MN_ST/CNV_16_S_TO_16_U_MN_ST"));
     693        //dprintf(("CNV_16_U_TO_16_S_MN_ST/CNV_16_S_TO_16_U_MN_ST"));
    694694        break;
    695695
     
    698698        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    699699        pConfigInfo->pfnConvert = Convert16MonoTo8Stereo;
    700         dprintf(("CNV_16_U_TO_8_U_MONO_ST/CNV_16_S_TO_8_U_MN_ST"));
     700        //dprintf(("CNV_16_U_TO_8_U_MONO_ST/CNV_16_S_TO_8_U_MN_ST"));
    701701        break;
    702702
     
    705705        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,0);   //factor 1
    706706        pConfigInfo->pfnConvert = Convert16MonoTo8StereoSignChange;
    707         dprintf(("CNV_16_U_TO_8_S_MN_ST/CNV_16_S_TO_8_S_MN_ST"));
     707        //dprintf(("CNV_16_U_TO_8_S_MN_ST/CNV_16_S_TO_8_S_MN_ST"));
    708708        break;
    709709
     
    711711        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    712712        pConfigInfo->pfnConvert = Convert16UnsignedTo16SignedStereoMono;
    713         dprintf(("CNV_16_U_TO_16_S_ST_MN"));
     713        //dprintf(("CNV_16_U_TO_16_S_ST_MN"));
    714714        break;
    715715
     
    717717        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    718718        pConfigInfo->pfnConvert = Convert16UnsignedTo16UnsignedStereoMono;
    719         dprintf(("CNV_16_U_TO_16_U_ST_MN"));
     719        //dprintf(("CNV_16_U_TO_16_U_ST_MN"));
    720720        break;
    721721
     
    723723        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    724724        pConfigInfo->pfnConvert = Convert16SignedTo16SignedStereoMono;
    725         dprintf(("CNV_16_S_TO_16_S_ST_MN"));
     725        //dprintf(("CNV_16_S_TO_16_S_ST_MN"));
    726726        break;
    727727
     
    729729        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,1);   //factor 0.5
    730730        pConfigInfo->pfnConvert = Convert16SignedTo16UnsignedStereoMono;
    731         dprintf(("CNV_16_S_TO_16_U_ST_MN"));
     731        //dprintf(("CNV_16_S_TO_16_U_ST_MN"));
    732732        break;
    733733
     
    735735        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);   //factor 0.25
    736736        pConfigInfo->pfnConvert = Convert16UnsignedTo8UnsignedStereoMono;
    737         dprintf(("CNV_16_U_TO_8_U_ST_MN"));
     737        //dprintf(("CNV_16_U_TO_8_U_ST_MN"));
    738738        break;
    739739
     
    741741        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);   //factor 0.25
    742742        pConfigInfo->pfnConvert = Convert16UnsignedTo8SignedStereoMono;
    743         dprintf(("CNV_16_U_TO_8_S_ST_MN"));
     743        //dprintf(("CNV_16_U_TO_8_S_ST_MN"));
    744744        break;
    745745
     
    747747        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);   //factor 0.25
    748748        pConfigInfo->pfnConvert = Convert16SignedTo8SignedStereoMono;
    749         dprintf(("CNV_16_S_TO_8_S_ST_MN"));
     749        //dprintf(("CNV_16_S_TO_8_S_ST_MN"));
    750750        break;
    751751
     
    753753        pConfigInfo->ulConversionFactor = CONVERSION_FACTOR(0,2);   //factor 0.25
    754754        pConfigInfo->pfnConvert = Convert16SignedTo8UnsignedStereoMono;
    755         dprintf(("CNV_16_S_TO_8_U_ST_MN"));
     755        //dprintf(("CNV_16_S_TO_8_U_ST_MN"));
    756756        break;
    757757
     
    826826        return TRUE;
    827827    }
    828     if(pConfigInfo->fSampleRateConversion) 
     828    if(pConfigInfo->fSampleRateConversion)
    829829    {
    830830        pConfigInfo->ulHwSampleRate = pConfigInfo->ulFixedSampleRate;
     
    10621062    }
    10631063
    1064     if(pCaps->ulOperation == OPERATION_PLAY) 
     1064    if(pCaps->ulOperation == OPERATION_PLAY)
    10651065    {
    10661066         pWaveCaps = &devCaps[ulDeviceNr].waveOutCaps;
     
    10711071    if (pCaps->ulChannels != 1 && pCaps->ulChannels != 2)
    10721072    {
    1073         if(pCaps->ulChannels > pWaveCaps->ulMaxChannels) 
     1073        if(pCaps->ulChannels > pWaveCaps->ulMaxChannels)
    10741074        {
    10751075            dprintf(("DevCaps1 not channel"));
     
    10781078        }
    10791079    }
    1080     if (pCaps->ulSamplingRate == 0) 
     1080    if (pCaps->ulSamplingRate == 0)
    10811081    {
    10821082        dprintf(("DevCaps1 not rate"));
     
    11341134            break;
    11351135        case 24:
    1136             if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS)) 
     1136            if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_24BPS))
    11371137            {
    11381138                dprintf(("DevCaps1 not 24BPS"));
     
    11421142            break;
    11431143        case 32:
    1144             if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS)) 
     1144            if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_32BPS))
    11451145            {
    11461146                pCaps->ulSupport = UNSUPPORTED_BPS;
     
    11641164    case DATATYPE_RIFF_ALAW:
    11651165    case A_LAW:
    1166         if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW)) 
     1166        if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ALAW))
    11671167        {
    11681168            dprintf(("DevCaps1 not ALAW"));
     
    11711171        }
    11721172        // supported bits per sample are 8 (for unsigned PCM, u-law or A-law )
    1173         if (pCaps->ulBitsPerSample != 8) 
     1173        if (pCaps->ulBitsPerSample != 8)
    11741174        {
    11751175            dprintf(("DevCaps1 not ALAW BPS8"));
     
    11841184    case DATATYPE_RIFF_MULAW:
    11851185    case MU_LAW:
    1186         if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW)) 
     1186        if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_MULAW))
    11871187        {
    11881188            dprintf(("DevCaps1 not MULAW"));
     
    11911191        }
    11921192        // supported bits per sample are 8 (for unsigned PCM, u-law or A-law )
    1193         if (pCaps->ulBitsPerSample != 8) 
     1193        if (pCaps->ulBitsPerSample != 8)
    11941194        {
    11951195            dprintf(("DevCaps1 not MULAW BPS8"));
     
    12031203    case DATATYPE_ADPCM_AVC:
    12041204    case DATATYPE_CT_ADPCM:
    1205         if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM)) 
     1205        if(!(pWaveCaps->ulDataFormats & OSS32_CAPS_PCM_FORMAT_ADPCM))
    12061206        {
    12071207            dprintf(("DevCaps1 not ADPCM"));
     
    12101210        }
    12111211        // supported bits per sample are 4
    1212         if (pCaps->ulBitsPerSample != 4) 
     1212        if (pCaps->ulBitsPerSample != 4)
    12131213        {
    12141214            dprintf(("DevCaps1 not ADPCM BPS4"));
     
    14301430#endif
    14311431
    1432     if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS) 
     1432    if(OSS16_WaveStop(StreamId) != OSSERR_SUCCESS)
    14331433    {
    14341434        DebugInt3();
     
    14361436    }
    14371437    //Reset cleans up waveout instance
    1438     if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS) 
     1438    if(OSS16_WaveReset(StreamId) != OSSERR_SUCCESS)
    14391439    {
    14401440        DebugInt3();
  • OCO/trunk/drv16/waveplay.cpp

    r478 r483  
    189189    }
    190190#ifdef DEBUG
    191     dprintf(("WAVEPLAY::ConfigDev1 SampleRate %ld", pConfigInfo->ulHwSampleRate));
    192     dprintf(("ulFirstBufSize %ld", ulFirstBufSize));
    193     dprintf(("ulFragsize %ld", pConfigInfo->ulFragsize));
     191    dprintf(("WAVEPLAY::ConfigDev SampleRate %ld", pConfigInfo->ulHwSampleRate));
     192    dprintf(("WAVEPLAY::ConfigDev ulFirstBufSize=%lx ulFragsize=%lx", ulFirstBufSize, pConfigInfo->ulFragsize));
    194193#endif
    195194
     
    197196    {
    198197        ulFirstBufSize = pConfigInfo->ulFragsize; //no conversion required (see below)
    199         if (ulFirstBufSize == 0) 
     198        if (ulFirstBufSize == 0)
    200199        {
    201200            DebugInt3();
     
    206205        }
    207206    }
    208     else 
     207    else
    209208    {
    210209        //convert size of first buffer
    211210        ulFirstBufSize = ConvertLength(ulFirstBufSize, pConfigInfo);
    212211#ifdef DEBUG
    213         dprintf(("ulFirstBufSize %ld", ulFirstBufSize));
     212        dprintf(("ulFirstBufSize %lx", ulFirstBufSize));
    214213#endif /* DEBUG */
    215214    }
     
    223222    ulPCMConsumeRate = ConvertLength(pConfigInfo->ulPCMConsumeRate, pConfigInfo);
    224223#ifdef DEBUG
    225     dprintf(("cons rate %ld buf size %ld init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate));
     224    dprintf(("cons rate %lx buf size %lx init rate %ld", ulPCMConsumeRate, ulFirstBufSize, pConfigInfo->ulHwSampleRate));
    226225#endif /* DEBUG */
    227226
     
    237236    {
    238237        while(minimumsize < fragsize) fragsize = fragsize / 2; //
    239  
     238
    240239            if(fragsize < ulPCMConsumeRate/256)
    241240            {//lower limit; don't accept extremely small buffers
     
    252251
    253252#ifdef DEBUG
    254     dprintf(("fragsize %ld", fragsize));
     253    dprintf(("fragsize %lx", fragsize));
    255254#endif
    256255    hwparam.ulSampleRate    = pConfigInfo->ulHwSampleRate;
     
    288287
    289288#ifdef DEBUG
    290 //    dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer));
     289    //dprintf(("WAVEPLAY::Transfer %ld",ulBytesToTransfer));
    291290#endif
    292291
     
    319318        }
    320319    }
    321     else 
    322     {
    323         if(pConfigInfo->pfnConvert) 
     320    else
     321    {
     322        if(pConfigInfo->pfnConvert)
    324323        {
    325324            ULONG ulCvtBufferSize;
     
    332331            ulBytesToTransfer = CONVERT_LENGTH(ulCvtBufferSize, CONVERSION_INVERT(pConfigInfo->ulConversionFactor));
    333332
    334             if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1)) 
     333            if(ulBytesToTransfer & (pConfigInfo->ulSampleSize-1))
    335334            {
    336335                dprintf(("Transfer New ulBr %ld" , ulBytesToTransfer));
     
    349348            //convert back from conversion to 'real'
    350349            *pulBytesTransferred = CONVERT_LENGTH(*pulBytesTransferred, CONVERSION_INVERT(pConfigInfo->ulConversionFactor));
    351             if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1)) 
     350            if(*pulBytesTransferred & (pConfigInfo->ulSampleSize-1))
    352351            {
    353352#ifdef DEBUG
     
    357356            }
    358357        }
    359         else 
     358        else
    360359        {
    361360            dprintf(("Transfer Zero pConfigInfo->pfnConvert"));
     
    374373    OSSRET rc;
    375374    ULONG  Space;
    376     ULONG i;
    377375//    if (!waveOpened) return TRUE;
    378376
     
    398396        ulCvtBufferSize &= ~(pConfigInfo->ulHwSampleSize - 1);
    399397
    400         if(ulCvtBufferSize == 0) 
     398        if(ulCvtBufferSize == 0)
    401399        {
    402400            *pulBytesTransferred = ulBytesToTransfer;
    403             if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement) 
     401            if(pConfigInfo->ulSRatePosition >= pConfigInfo->ulSRateIncrement)
    404402            {
    405403                pConfigInfo->ulSRatePosition -= pConfigInfo->ulSRateIncrement;
     
    423421                ulCvtBufferSize = Space & ~(pConfigInfo->ulHwSampleSize - 1);
    424422        }
    425         if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS 
     423        if ((rc = OSS16_WaveAddBuffer(StreamId, pConfigInfo->pSRateConvBuffer, ulCvtBufferSize, pulBytesTransferred)) != OSSERR_SUCCESS
    426424             ||  *pulBytesTransferred == 0)
    427425        {
    428             if(rc == OSSERR_BUFFER_FULL) 
     426            if(rc == OSSERR_BUFFER_FULL)
    429427            {
    430428                 GetSpace(StreamId, pConfigInfo, &Space);
     
    432430            }
    433431#ifdef DEBUG
    434             else 
     432            else
    435433                dprintf(("WPLAY::AddBuffer; %ld rc=%x failed", ulCvtBufferSize, (USHORT)rc));
    436434#endif
     
    452450        // if the last sample is still needed for the next run, then adjust sample count and
    453451        // sample rate conversion position
    454         if(lSRatePosition < 0) 
     452        if(lSRatePosition < 0)
    455453        {
    456454            dprintf4(("WAVEPLAY::AddBuffer; sratepos < 0"));
     
    458456            pConfigInfo->ulSRatePosition = 0;
    459457        }
    460         else 
     458        else
    461459        {
    462460            pConfigInfo->ulSRatePosition = (ULONG)lSRatePosition;
     
    507505//    if (!waveOpened) return TRUE;
    508506
    509     if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS) 
     507    if(OSS16_WaveGetSpace(StreamId, &space) != OSSERR_SUCCESS)
    510508    {
    511509        *pulStreamSpace = 0;
     
    529527    ULONG space,cvt;
    530528
    531     if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS) 
     529    if(OSS16_WaveGetHwPtr(StreamId, &space) != OSSERR_SUCCESS)
    532530    {
    533531        *pulHwPtr = 0;
  • OCO/trunk/drv16/waverec.cpp

    r468 r483  
    139139    hwparam.ulDataType      = QueryOSSDataFormat(OPERATION_RECORD, pConfigInfo->ulDataType, pConfigInfo->ulHwBitsPerSample);
    140140    if(OSS16_WaveSetFormat(StreamId, &hwparam) != OSSERR_SUCCESS) {
     141                dprintf(("WAVEREC::ConfigDev: WaveSetFormat failed"));
    141142        DebugInt3();
    142143        return FALSE;
     
    151152                       ULONG FAR *pulBytesTransferred)
    152153{
     154#ifdef DEBUG
     155    //dprintf(("WAVEREC::Transfer %lx bytes", ulBytesToTransfer));
     156#endif
    153157    if(pConfigInfo->usConversion == CONVERT_NONE)
    154158    {
  • OCO/trunk/drv16/wavestrm.cpp

    r478 r483  
    4040#endif
    4141
     42extern "C" ULONG  __cdecl __saveregs OSSIDC_EntryPoint(ULONG cmd, ULONG param1, ULONG param2);
     43
    4244
    4345//******************************************************************************
     
    5052// the data has been played and 1 if there is still some data left.
    5153//******************************************************************************
    52 USHORT  WAVESTREAM::_vRealignBuffer(ULONG endpos, PSTREAMBUFFER pbuffer)
    53 {
    54    ULONG streambuf_start, bufconsumed;
    55    USHORT usRC;
    56 
    57    streambuf_start = pbuffer->ulDonepos - pbuffer->ulBuffpos;
    58       // if none of the data in this stream buffer has been consumed
    59    if (endpos <= streambuf_start) {
    60       pbuffer->ulDonepos = 0;
    61       pbuffer->ulBuffpos = 0;
    62       usRC = 1;
    63    }
    64      // else some or all of the data has been consumed
    65    else {
    66       bufconsumed = endpos - streambuf_start;
    67         // some of the buffer has been consumed
    68       if (bufconsumed <= pbuffer->ulBuffsz) {
    69          pbuffer->ulDonepos = 0;
    70          pbuffer->ulBuffpos = pbuffer->ulBuffsz - bufconsumed;
    71          pbuffer->ulBuffpos &= 0xFFFFFFFC; //keep it on a dword boundary
    72          usRC = 1;
    73       }
    74         // all of the buffer has been consumed
    75       else {
    76          pbuffer->ulDonepos = 0;
    77          pbuffer->ulBuffpos = pbuffer->ulBuffsz;
    78          usRC = 0;
    79       }
    80    }
    81    return(usRC);
     54USHORT  WAVESTREAM::_vRealignBuffer(ULONG ulEndPos, PSTREAMBUFFER pBuffer)
     55{
     56        if (ulEndPos >= pBuffer->ulDonepos) { /* all of the data has been consumed */
     57                pBuffer->ulBuffpos = pBuffer->ulBuffsz;
     58                pBuffer->ulDonepos = 0;
     59                return(0);
     60        }
     61
     62        if (ulEndPos >= (pBuffer->ulDonepos - pBuffer->ulBuffpos)) { /* some of the data has been consumed */
     63                pBuffer->ulBuffpos = pBuffer->ulDonepos - ulEndPos;
     64                pBuffer->ulBuffpos &= 0xFFFFFFFC; //keep it on a dword boundary
     65                pBuffer->ulDonepos = 0;
     66                return(1);
     67        }
     68        /* none of the data in this buffer has been consumed */
     69        pBuffer->ulDonepos = 0;
     70        pBuffer->ulBuffpos = 0;
     71        return(1);
    8272}
    8373
     
    9989// and put the STREAMBUFFER on the Head queue.
    10090//******************************************************************************
    101 void WAVESTREAM::_vRealignPausedBuffers(ULONG endpos)
    102 {
    103    PQUEUEHEAD pTempHead = new QUEUEHEAD;
    104    PSTREAMBUFFER ptempbuff;
    105    USHORT usRC;
    106 
    107 
    108    switch (ulStreamType & STREAM_WRITE) {
    109    case STREAM_READ:
    110       _vReadAudioBuf();
    111       break;
    112 
    113    case STREAM_WRITE:
    114 
    115       // if there is a buffer on the InProcess Queue
    116       // only check the first one as any others are just waiting.....
    117       if (qhInProcess.IsElements())
    118       {
    119            // if any data has been written from this stream buffer
    120          ptempbuff = (PSTREAMBUFFER)qhInProcess.Head();
    121          if (ptempbuff->ulDonepos)
    122          {
    123              _vRealignBuffer(endpos, ptempbuff);
    124          }  /* end if ulDonepos */
    125       }
    126 
    127       // if there are bufferes on the done queue, pop them off the head and
    128       // push them on the head of qhTempHead.  This will reorder them so
    129       // that the more recently used ones will be in the front of the queue.
    130       // Pass them all to _vRealignBuffer. If the rc from _vRealignBuffer is
    131       // 0 then there is no unprocessed data in the buffer (it is ready to
    132       // be returned) so put it on the Tail of the done queue.
    133       // If the rc is 1 then put it on the head of the InProcess queue.
    134 
    135       while (qhDone.IsElements())
    136       {
    137          pTempHead->PushOnHead(qhDone.PopHead());
    138       } /* endwhile */
    139 
    140       while (pTempHead->IsElements())
    141       {
    142          usRC = _vRealignBuffer(endpos, (PSTREAMBUFFER)pTempHead->Head());
    143          if (usRC)
    144            qhInProcess.PushOnHead(pTempHead->PopHead());
    145          else
    146            qhDone.PushOnTail(pTempHead->PopHead());
    147       } /* endwhile */
    148       break;
    149    default:
    150       break;
    151    } /* endswitch */
    152    delete pTempHead; // free the memory this ain't no Java here !!
     91void WAVESTREAM::_vRealignPausedBuffers(ULONG ulEndPos)
     92{
     93        PQUEUEHEAD pTempHead = new QUEUEHEAD;
     94        PSTREAMBUFFER pTmpBuf;
     95        USHORT usRC;
     96
     97
     98        switch (ulStreamType & STREAM_WRITE) {
     99        case STREAM_READ:
     100                _vReadAudioBuf();
     101                break;
     102
     103        case STREAM_WRITE:
     104
     105                // if there is a buffer on the InProcess Queue
     106                // only check the first one as any others are just waiting.....
     107                if (qhInProcess.IsElements())
     108                {
     109                        // if any data has been written from this stream buffer
     110                        pTmpBuf = (PSTREAMBUFFER)qhInProcess.Head();
     111                        if (pTmpBuf->ulDonepos)
     112                        {
     113                                _vRealignBuffer(ulEndPos, pTmpBuf);
     114                        }
     115                }
     116
     117                // if there are buffere on the done queue, pop them off the head and
     118                // push them on the head of qhTempHead.  This will reorder them so
     119                // that the more recently used ones will be in the front of the queue.
     120                // Pass them all to _vRealignBuffer. If the rc from _vRealignBuffer is
     121                // 0 then there is no unprocessed data in the buffer (it is ready to
     122                // be returned) so put it on the Tail of the done queue.
     123                // If the rc is 1 then put it on the head of the InProcess queue.
     124
     125                while (qhDone.IsElements()) {
     126                        pTempHead->PushOnHead(qhDone.PopHead());
     127                }
     128
     129                while (pTempHead->IsElements())
     130                {
     131                        usRC = _vRealignBuffer(ulEndPos, (PSTREAMBUFFER)pTempHead->Head());
     132                        if (usRC)
     133                                qhInProcess.PushOnHead(pTempHead->PopHead());
     134                        else
     135                                qhDone.PushOnTail(pTempHead->PopHead());
     136                }
     137                while (qhDone.IsElements()) {
     138                        ReturnBuffer();
     139                }
     140                break;
     141        default:
     142                break;
     143        } /* endswitch */
    153144}
    154145
     
    163154#pragma on (unreferenced)
    164155{
    165     ULONG space, byteswritten, curspace,i;
    166 
    167 //    dgprintf(("AddBuffers %d",fFirst == TRUE?1:2));
    168 
    169     byteswritten = 0;
    170     if (ulStreamType & STREAM_WRITE)
     156    ULONG ulSpace, ulBytesWritten;
     157        ULONG ulDAZ;
     158
     159        //dgprintf(("WS:AddBuffers First=%d, SampleSize=%lx", fFirst, _configinfo.ulSampleSize));
     160
     161    ulBytesWritten = 0;
     162    if (ulStreamType & STREAM_WRITE)
    171163    {
    172164        // get the space available in the hardware buffer
     
    175167        // could keep us in this loop writing 4 or 8 bytes at a time.
    176168        // In extream cases we will stay stuck in this loop long enough to casue a trap rjj
    177          if (pahw->GetSpace(StreamId, &_configinfo, &space) == FALSE)
     169                if (pahw->GetSpace(StreamId, &_configinfo, &ulSpace) == FALSE)
    178170        {
    179 //            dgprintf(("WAVESTREAM::AddBuffers Error 1"));
     171                        dgprintf(("WAVESTREAM::AddBuffers GetSpace failed"));
    180172            return;
    181173        }
    182         space &= (~(_configinfo.ulSampleSize - 1));
    183 //        curspace = min(space, _configinfo.ulBytesPerIRQ/_configinfo.ulSampleSize * 2);
    184         curspace = space;
    185         while (space && qhInProcess.IsElements())
     174        ulSpace &= (~(_configinfo.ulSampleSize - 1));
     175                ulDAZ = 0;
     176        while (ulSpace && qhInProcess.IsElements())
    186177        {
    187             // Fisrt time going in task time
    188             // for I7 need give time for interrupt time
    189             if (fFirst == TRUE)  //PS+++
    190             {
    191                 cli();
    192 //                 DevHelp_ProcBlock (space, 20, 0);
    193             }
    194 //            dgprintf(("AddBuffers write %ld SSize:%ld %d",space, _configinfo.ulSampleSize, fFirst == TRUE?1:2));
    195             byteswritten = AddBuffer(space > curspace? curspace: space);
    196             if (pahw->GetSpace(StreamId, &_configinfo, &curspace) == FALSE)
    197             {
    198 //                dgprintf(("WAVESTREAM::AddBuffers Error 2"));
    199                 break;
    200             }
    201             if(byteswritten == (ULONG)-1)
    202                 break;
    203             if (!curspace)
    204             {
    205                 curspace = _configinfo.ulSampleSize;
    206             }
    207             space -= byteswritten;
    208             space &= ( ~(_configinfo.ulSampleSize - 1));
    209         }
    210 
    211     }
    212 //    dgprintf(("AddBuffers %d End",fFirst == TRUE?1:2));
    213 }
     178                        if (ulDAZ++ > 20) {
     179                                dgprintf(("WAVESTREAM::AddBuffers DAZ break")); // Temporary hack to prevent lockups when uniaud32 stops (underrun)
     180                                break;
     181                        }
     182                // First time is in task time. For I7 need to give time for interrupt time
     183                if (fFirst == TRUE)  //PS+++
     184            {
     185                                //cli();
     186                    DevHelp_ProcBlock (0x5541, 20, 0); // ok since the first call is at task time
     187                ulBytesWritten = AddBuffer(ulSpace);
     188                                return;
     189                        }
     190            ulBytesWritten = AddBuffer(ulSpace);
     191            if (ulBytesWritten == (ULONG)-1) break;
     192            ulSpace -= ulBytesWritten;
     193            ulSpace &= ( ~(_configinfo.ulSampleSize - 1));
     194        }
     195
     196    }
     197}
     198
    214199//******************************************************************************
    215200// write one buffer to the audio buffer                                           1
     
    218203// there are buffers on pHead... BEWARE
    219204//******************************************************************************
    220 ULONG WAVESTREAM::AddBuffer(ULONG space)
     205ULONG WAVESTREAM::AddBuffer(ULONG ulSpace)
    221206{
    222207    PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    223     ULONG pdataBuf;
    224     ULONG Buff_left, byteswritten, start_pos;
    225 
    226 //    ddprintf(("AddBuffer"));
    227     // make sure we have a buffer to copy from.....
    228     if (!pTemp)
     208    ULONG pDataBuf;
     209    ULONG ulBuffLeft;
     210        ULONG ulBytesWritten;
     211        ULONG ulStartPos;
     212
     213    /* make sure we have a buffer to copy from */
     214    if (!pTemp)
    229215    {
    230216        return (ULONG)-1;
    231217    }
    232218
    233     // get the starting position. Call WaveGetHwPtr. if we get a bad rc
    234     // then we bail out.
    235     if(pahw->GetHwPtr(StreamId, &_configinfo, &start_pos) == FALSE)
     219        /* make sure there is space in the output buffer */
     220    if (!ulSpace)
     221    {
     222        return (ULONG)-1;
     223    }
     224
     225        /* PS+++ if input buffer is ZERO do nothing and ask for give new buffer, See REMARK in mmpm2.inf */
     226    if (!pTemp->ulBuffsz)
     227    {
     228        qhDone.PushOnTail(qhInProcess.PopHead());
     229        return (ULONG)-1;
     230    }
     231
     232    // get the starting position. Call WaveGetHwPtr. if we get a bad rc then we bail out.
     233    if(pahw->GetHwPtr(StreamId, &_configinfo, &ulStartPos) == FALSE)
    236234    {
    237235        dgprintf(("WAVESTREAM::AddBuffer Err in GetHwPtr"));
     
    240238    }
    241239
    242     if (!pTemp->ulBuffsz || !space)
    243     {
    244         dgprintf(("WAVESTREAM::AddBuffer 0, Bufsz:%ld Space:%ld",pTemp->ulBuffsz, space));
    245         //PS+++ if is ZERO do nothing and ask for give new buffer, See REMARK in mmpm2.inf
     240    // get the buffer pointer and amount of data remaining
     241    pDataBuf  = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos; /* points to the beginning of data in src buffer */
     242    ulBuffLeft = pTemp->ulBuffsz - pTemp->ulBuffpos; /* amount of src data left to transfer */
     243    //dgprintf(("WS::AddBuffer buf=%lx remain=%lx, space=%lx bp=%lx dp=%lx size=%lx", pTemp->pBuffptr, ulBuffLeft, ulSpace, pTemp->ulBuffpos, pTemp->ulDonepos, pTemp->ulBuffsz));
     244    ulBuffLeft = min(ulBuffLeft, ulSpace); /* the smaller of src data left or dst space available */
     245
     246    if (pahw->Transfer(StreamId, &_configinfo, pDataBuf, ulBuffLeft, &ulBytesWritten) == FALSE)
     247    {
     248                // This could mean that the hardware has underrun TODO: implement underrun logic
     249        dgprintf(("WS::AddBuffer: pahw->Transfer failed"));
     250        return (ULONG)-1;
     251    }
     252    if (ulBytesWritten == 0)
     253    {
     254                // This could mean that the hardware has underrun TODO: implement underrun logic
     255        dgprintf(("WS::AddBuffer: 0 of %lx bytes written by transfer", ulBuffLeft));
     256                return (ULONG)-1; /* DAZ check into returning zero, returning 0 may cause lockup */
     257    }
     258        //dgprintf(("WS::AddBuffer added %lx from %lx BuffPos=%lx sz=%lx bw=%lx dp=%lx", ulBytesWritten, pTemp->pBuffptr, pTemp->ulBuffpos, pTemp->ulBuffsz, _ulBytesWritten, pTemp->ulDonepos));
     259
     260        _ulBytesWritten += ulBytesWritten; /* update the running counter */
     261    pTemp->ulBuffpos += ulBytesWritten; /* update the buffer pos counter */
     262    pTemp->ulDonepos = _ulBytesWritten; /* update the done Position for returning the buffer */
     263
     264    // check to see if the whole buffer has been copied and needs to be put on the done queue
     265    if (pTemp->ulBuffpos >= (pTemp->ulBuffsz /* & 0xFFFFFFFC*/)) /* DAZ */
     266    {
     267                //dgprintf(("WS::AddBuffer done with buffer %lx dp=%lx", pTemp->pBuffptr, pTemp->ulDonepos));
    246268        qhDone.PushOnTail(qhInProcess.PopHead());
    247 //        DebugInt3();
    248         return -1;
    249     }
    250     // get the buffer pointer and amount of data remaining
    251     pdataBuf  = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos;
    252     Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
    253     Buff_left = min(Buff_left, space);
    254 
    255     if (pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &byteswritten) == FALSE)
    256     {
    257         dgprintf(("AddBuffer: pahw->Transfer failed!!"));
    258 //        DebugInt3();
    259         return (ULONG)-1;
    260     }
    261     if (byteswritten == 0)
    262     {
    263         dgprintf(("AddBuffer: No more room!!"));
    264 //        DebugInt3();
    265 //PS+++        return (ULONG)-1; //no more room
    266         return 0;   //PS+++ may be in next time?
    267     }
    268     // update the buffer pos counter
    269     pTemp->ulBuffpos += byteswritten;
    270 
    271     // update the done Position
    272     pTemp->ulDonepos = start_pos + byteswritten;
    273 
    274     // check to see if the buffer has been copied and needs to be put on the done queue
    275     if (pTemp->ulBuffpos >= (pTemp->ulBuffsz & 0xFFFFFFFC))
    276     {
    277         qhDone.PushOnTail(qhInProcess.PopHead());
    278     }
    279 //    dgprintf(("WV::AddBuffer sz %lx, bywr %lx dp %lx", Buff_left, byteswritten,pTemp->ulDonepos));
    280     return byteswritten;
     269    }
     270    return ulBytesWritten;
    281271}
    282272//******************************************************************************
     
    287277{
    288278    PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    289     ULONG pdataBuf;
    290     ULONG Buff_left, bytesread;
    291 
    292     if(!pTemp)
    293         return FALSE;
     279    ULONG pDataBuf;
     280    ULONG ulBuffLeft, ulBytesRead;
     281
     282    if(!pTemp) return FALSE;
    294283
    295284    // get the buffer pointer and amount of data remaining
    296     pdataBuf  = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos;
    297     Buff_left = pTemp->ulBuffsz - pTemp->ulBuffpos;
     285    pDataBuf  = (ULONG)pTemp->pBuffptr + pTemp->ulBuffpos;
     286    ulBuffLeft = pTemp->ulBuffsz - pTemp->ulBuffpos;
    298287
    299288    // read wave data
    300     if(pahw->Transfer(StreamId, &_configinfo, pdataBuf, Buff_left, &bytesread) == FALSE)
    301     {
    302        dprintf(("_vReadAudioBuf: pahw->Transfer failed!!"));
    303        return FALSE;
    304     }
    305     if(bytesread == 0) {
    306        return FALSE; //no more data
    307     }
    308 
    309 //    dprintf4(("_vReadAudioBuf %lx size %ld, bytes read %ld", pdataBuf, Buff_left, bytesread));
     289    if(pahw->Transfer(StreamId, &_configinfo, pDataBuf, ulBuffLeft, &ulBytesRead) == FALSE)
     290    {
     291       return FALSE; /* No more data */
     292    }
     293    if(ulBytesRead == 0) {
     294       return FALSE; /* No more data */
     295    }
     296        if (ulBytesRead > ulBuffLeft) {
     297       return FALSE; /* Internal error */
     298        }
    310299
    311300    // update the buffer pos counter
    312     pTemp->ulBuffpos  += bytesread;
    313     _ulBytesProcessed += bytesread;
     301    pTemp->ulBuffpos  += ulBytesRead;
     302    _ulBytesProcessed += ulBytesRead;
     303
     304        //dprintf(("_vReadAudioBuf %lx Requested=%lx Read=%lx Remain=%lx Processed=%lx", pDataBuf, ulBuffLeft, ulBytesRead, pTemp->ulBuffsz-pTemp->ulBuffpos, _ulBytesProcessed));
    314305
    315306    if(pTemp->ulBuffpos == pTemp->ulBuffsz) {
    316307        qhDone.PushOnTail(qhInProcess.PopHead());
    317308            ReturnBuffer();
    318             dprintf(("_vReadAudioBuf return buffer %lx size %ld, bytes read %ld position %ld", (ULONG)pTemp->pBuffptr, pTemp->ulBuffsz, bytesread, _ulBytesProcessed));
    319309    }
    320310
     
    328318// can be returned and finally process any events pending.
    329319//******************************************************************************
    330 USHORT ProcNumber = 0;
    331320void DBGCALLCONV WAVESTREAM::Process(void)
    332321{
    333  PSTREAMBUFFER ptemp;
    334  ULONG         ulCurBytesProcessed = 0;
    335  USHORT        CurProcNumber = ProcNumber++;
    336  ULONG         space;
    337 
    338 #ifdef DEBUG
    339 //    ddprintf(("WAVESTREAM::Process %d",CurProcNumber));
    340 #endif
     322        PSTREAMBUFFER pTemp;
     323        ULONG   ulBytes;
     324        ULONG ulDAZ;
     325
     326        //ddprintf(("WAVESTREAM::Process Start"));
    341327
    342328    // get the stream position. if we get a bad rc or the position is 0
     
    344330    // GetPostiion returns the adjusted hw pointer from the ALSA status ioctl
    345331    // This is really a running total of bytes consumed by the hardware.
    346     if(pahw->GetPosition(StreamId, &_configinfo, &ulCurBytesProcessed) == FALSE)
     332        // DAZ - Note that this is a 32 bit counter and will wrap at sometime. ALSA
     333        // attempts to wrap this counter intelligently. I haven't determined what
     334        // effect, if any, the wrapping of this counter will have playing a stream.
     335    if(pahw->GetPosition(StreamId, &_configinfo, &ulBytes) == FALSE)
    347336    {
    348337        ddprintf(("Error No bytes processed"));
     
    350339        return;
    351340    }
    352 //    ddprintf(("StPos: %lx", ulCurBytesProcessed));
    353     // save the bytes processed in the stream object
    354     _ulBytesProcessed = ulCurBytesProcessed;
    355 
    356     switch (ulStreamType & STREAM_WRITE)
    357     {
    358 
    359         // if there are buffers that have been completly written to the audio buffer
    360         // check the first one on the done queue
    361         // if it's data has been consumed by the hardware return it.
    362         //
    363         // Bug #18 Sometimes MMPM gives us really small buffers. If we
    364         // wait for the buffer to be completly consumed and there is a tiny buffer
    365         // on the queue after this one, the sound part could underrun before we get a
    366         // chance to refill it. To fix this we will return the buffer if it will be
    367         // consumed before the next call to WAVESTREAM:Process().
    368         // rjj Fix for Bug #18 28082008
     341    _ulBytesProcessed = ulBytes;
     342
     343    switch (ulStreamType & STREAM_WRITE)
     344    {
    369345        case STREAM_WRITE:
    370         {
    371             if (qhDone.IsElements())
     346            if (qhInProcess.IsElements())
    372347            {
    373                 ptemp = (PSTREAMBUFFER)qhDone.Head();
    374                 while ((_ulBytesProcessed + _configinfo.ulBytesPerIRQ) >= ptemp->ulDonepos)
    375                 {
    376                     ReturnBuffer();
    377                     ptemp = (PSTREAMBUFFER)qhDone.Head();
    378                 }
     348                                AddBuffers(FALSE);
    379349            }
    380             if ((pahw->GetSpace(StreamId, &_configinfo, &space) != FALSE)
    381                && qhInProcess.IsElements())
    382             {
    383                AddBuffers(FALSE);
    384             }
    385 
    386         break;
    387 
    388         }
     350                // Return any buffers that have been completely written to uniaud32
     351                        while (qhDone.IsElements()) {
     352                pTemp = (PSTREAMBUFFER)qhDone.Head(); /* get a pointer to the first completed buffer */
     353                                // Hang on to the last buffer until the hardware is done writing the data
     354                                // We do this because MMPM uses the return of the last buffer to determine when we are
     355                                // done playing the stream
     356                                if ((qhDone.Head() == qhDone.Tail()) && !qhInProcess.IsElements() && (_ulBytesProcessed < pTemp->ulDonepos)) break; /* only one buffer left */
     357                                ReturnBuffer();
     358                        }
     359                break;
    389360        case STREAM_READ:
    390             while(_vReadAudioBuf());
    391             break;
     361                        ulDAZ = 0;
     362                    while(_vReadAudioBuf()) {
     363                                if (ulDAZ++ > 20) { /* temporary hack to prevent hangs when uniaud32 stops (overruns) */
     364                                ddprintf(("WAVESTREAM::Process Read DAZ Break"));
     365                                        break;
     366                                }
     367                        }
     368                    break;
    392369        default:
    393370            break;
     
    395372
    396373    ProcessEvents();
    397 //    ddprintf(("WAVESTREAM::Process %d End",CurProcNumber));
     374    //ddprintf(("WAVESTREAM::Process End"));
    398375}
    399376//******************************************************************************
     
    404381{
    405382    PSTREAMBUFFER pStreamBuf = new STREAMBUFFER(uLength, pbuf);
    406  
     383
    407384    return Write(pStreamBuf);
    408385}
     
    420397{
    421398    qhInProcess.PushOnTail((PQUEUEELEMENT)new STREAMBUFFER(uLength, pbuf));
    422 //    dprintf2(("WAVESTREAM::Read: Push on tail %lx %d", pbuf, uLength));
     399    //dprintf2(("WAVESTREAM::Read: Push on tail %lx %lx", pbuf, uLength));
    423400    return 0;
    424401}
     
    441418    ULONG Seconds, MilliSeconds, Overflow, Processed;
    442419
    443 //PS++ optimize code
     420        //PS++ optimize code
    444421    Processed = _ulBytesProcessed;
    445422    if (ulStreamState == STREAM_STREAMING)  // if the stream is active
     
    449426           if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE)
    450427           {
    451 //                DebugInt3();
     428                                //DebugInt3();
    452429                Processed = _ulBytesProcessed; //last known position
    453430           }
     
    455432    }
    456433
    457     // if we haven't processed anything then just return
    458     // _ulTimeBase
     434    // if we haven't processed anything then just return _ulTimeBase
    459435    if(Processed == 0)
    460436        return(_ulTimeBase);
     
    470446ULONG WAVESTREAM::GetCurrentPos(void)
    471447{
    472     ULONG Processed;
    473 
    474 //PS++ optimize code
    475     Processed = _ulBytesProcessed;
    476     if (ulStreamState == STREAM_STREAMING)  // if the stream is active
    477     {
    478         if (ulStreamType & STREAM_WRITE)
    479        {
    480            if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE)
    481            {
    482                 DebugInt3();
    483                 Processed = _ulBytesProcessed; //last known position
    484            }
     448        ULONG Processed;
     449
     450        //PS++ optimize code
     451        Processed = _ulBytesProcessed;
     452        if (ulStreamState == STREAM_STREAMING)  // if the stream is active
     453        {
     454                if (ulStreamType & STREAM_WRITE)
     455                {
     456                        if (pahw->GetPosition(StreamId, &_configinfo, &Processed) == FALSE)
     457                        {
     458                                DebugInt3();
     459                                Processed = _ulBytesProcessed; //last known position
     460                        }
     461                }
    485462        }
    486     }
    487 
    488     return Processed;
     463        return Processed;
    489464}
    490465//******************************************************************************
     
    498473   PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhDone.Tail();
    499474
    500    if(!pTemp) 
     475   if(!pTemp)
    501476   {
    502477       pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    503478   }
    504    if(pTemp) 
     479   if(pTemp)
    505480   {
    506481       writepos = pTemp->ulBuffpos;
     
    517492void  WAVESTREAM::SetCurrentTime(ULONG time)
    518493{
     494        //ddprintf(("SetCurrentTime: %lx", time));
    519495    _ulTimeBase = time;
    520496}
     
    525501    PSTREAMBUFFER pTemp = (PSTREAMBUFFER)qhInProcess.Head();
    526502
    527 #ifdef DEBUG
    528 //    ddprintf(("WAVESTREAM::StartStream"));
    529 #endif
    530 
    531     if(ulStreamState == STREAM_STREAMING)
     503    if(ulStreamState == STREAM_STREAMING)
    532504    {
    533505        ddprintf(("StartStream: already playing!!"));
     
    537509    // configure the wave device
    538510    // (NOTE: Must call this function; sample rate position is reset there)
    539     if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE) 
     511    if(pahw->ConfigDev(StreamId, &_configinfo, (pTemp) ? pTemp->ulBuffsz : 0) == FALSE)
    540512    {
    541513        ddprintf(("StartStream: ConfigDev failed!!"));
    542514        return ERROR_INSUFF_BUFFER;
    543 //        goto fail;
     515                //goto fail;
    544516    }
    545517    // prepare wave device for playback/recording
    546     if(pahw->Prepare(StreamId) == FALSE) 
     518    if(pahw->Prepare(StreamId) == FALSE)
    547519    {
    548520        ddprintf(("StartStream: Prepare failed!!"));
     
    551523
    552524    _ulBytesProcessed = 0;
     525        _ulBytesWritten = 0;
    553526
    554527    ulStreamState = STREAM_STREAMING;
    555528    //Adding the first buffer also starts playback
    556     if (ulStreamType == STREAM_WAVE_PLAY) 
    557     {
    558        pahw->SetVolume(StreamId, getMixerStreamId(), volume);    //PS
    559         AddBuffers(TRUE);
     529    if (ulStreamType == STREAM_WAVE_PLAY)
     530    {
     531                pahw->SetVolume(StreamId, getMixerStreamId(), volume);    //PS
     532                AddBuffers(TRUE);
    560533        //Must set volume after adding buffers (voices inside sblive driver might not
    561534        //be allocated otherwise (first start) )
    562535//        dprintf(("SetVolume %lx",volume));
    563536// PS, removing to high
    564 //       pahw->SetVolume(StreamId, getMixerStreamId(), volume);
    565     }
    566     else
    567     {
     537//      pahw->SetVolume(StreamId, getMixerStreamId(), volume);
     538    }
     539    else
     540    {
     541        //dprintf(("Starting Rec Stream"));
    568542        ulSavedInputGain = pahw->QueryVolume(StreamId, getMixerStreamId());
    569543        pahw->SetInputSrc(StreamId, getMixerStreamId(), inputsrc);
    570544        pahw->SetVolume(StreamId, getMixerStreamId(), inputgain);
    571545
    572         if(pahw->Start(StreamId) != TRUE)
    573        {
     546                if(pahw->Start(StreamId) != TRUE)
     547                {
    574548            dprintf(("pahw->Start failed!!"));
    575549            goto fail;
    576550        }
    577551    }
    578 //    ddprintf(("WAVESTREAM::StartStream %lx End", StreamId));
    579552    return NO_ERROR;
    580553
     
    602575
    603576    ulStreamState = STREAM_STOPPED;
    604 //    ddprintf(("WAVESTREAM::StopStream %lx", StreamId));
     577        //ddprintf(("WAVESTREAM::StopStream %lx", StreamId));
     578
    605579    ReturnBuffers();
    606580    pControl->ulTime = GetCurrentTime();
     
    610584    // DDCMD_ENABLE_EVENT the event time will get screwed up. rjj
    611585    _ulBytesProcessed = 0;
     586        _ulBytesWritten = 0;
    612587    return NO_ERROR;
    613588}
     
    616591ULONG  WAVESTREAM::PauseStream(PCONTROL_PARM pControl)
    617592{
    618     ULONG endpos;
    619 
    620     pahw->GetPosition(StreamId, &_configinfo, &endpos);
     593    ULONG ulEndPos, ulEndPos2;
     594
     595    if(ulStreamState == STREAM_PAUSED) {
     596        dprintf(("WAVESTREAM::PauseStream %lx (already paused)", StreamId));
     597            pControl->ulTime = GetCurrentTime();
     598            return NO_ERROR;
     599    }
     600
     601    pahw->GetPosition(StreamId, &_configinfo, &ulEndPos);
    621602    //silence wave stream before stopping it (removes clicks)
    622603    pahw->SetVolume(StreamId, getMixerStreamId(), 0);
    623604    pahw->Stop(StreamId);
    624605
     606        /* DAZ test code begin */
     607    if (pahw->GetPosition(StreamId, &_configinfo, &ulEndPos2) == FALSE) ulEndPos2 = 0;
     608        if (ulEndPos2 != ulEndPos) {
     609            ddprintf(("WAVESTREAM::PauseStream %lx!=%lx", ulEndPos, ulEndPos2));
     610                if (ulEndPos2) ulEndPos = ulEndPos2;
     611        }
     612        /* DAZ test code end */
     613
    625614    ulStreamState = STREAM_PAUSED;
    626615
    627616    ddprintf(("WAVESTREAM::PauseStream %lx", StreamId));
    628617
    629     _vRealignPausedBuffers(endpos);
    630 
    631     _ulBytesProcessed = endpos;
     618    _ulBytesProcessed = ulEndPos;
     619
     620    _vRealignPausedBuffers(ulEndPos);
     621
    632622    pControl->ulTime = GetCurrentTime();
     623
    633624    _ulBytesProcessed = 0;
     625        _ulBytesWritten = 0;
     626
    634627    return NO_ERROR;
    635628}
     
    639632{
    640633#ifdef DEBUG
    641     dprintf(("WAVESTREAM::ResumeStream %lx", StreamId));
     634    //dprintf(("WAVESTREAM::ResumeStream %lx", StreamId));
    642635#endif
    643636    return StartStream();
     
    647640BOOL WAVESTREAM::SetProperty(int type, ULONG value, ULONG reserved)
    648641{
    649 #ifdef DEBUG
    650 //    dprintf(("WAVESTREAM::SetProperty"));
    651 #endif
    652 
    653642    switch(type) {
    654643    case PROPERTY_VOLUME:
     
    677666ULONG WAVESTREAM::GetProperty(int type)
    678667{
    679 #ifdef DEBUG
    680 //    dprintf(("WAVESTREAM::GetProperty"));
    681 #endif
    682668    switch(type) {
    683669    case PROPERTY_FREQUENCY:
     
    699685   STREAM(streamtype, filesysnum, mixerStreamId)
    700686{
    701 #ifdef DEBUG
    702     dprintf(("WS::WS:S"));
    703 #endif
    704687    // get the pointer to the hardware object
    705688    pahw = (WAVEAUDIO*)GetHardwareDevice(streamtype);
     
    710693    _configinfo.ulNumChannels   = pinit->sChannels;
    711694    _configinfo.ulDataType      = pinit->sMode;
     695    _ulBytesWritten             = 0;
    712696    _ulBytesProcessed           = 0;
    713697    _ulTimeBase                 = 0;
    714     //_ulUnderrunBase             = 0;
    715698    ulSavedInputGain            = 0;
    716699
     
    746729    pinit->ulFlags |= pahw->QueryDataFlags(pinit->ulOperation, pinit->sMode, pinit->lBitsPerSRate);
    747730
    748     //fUnderrun   = FALSE;
    749731    StreamId    = 0;
    750732
     
    755737    }
    756738
    757 //    dprintf(("WAVESTREAM stream %lx ctor %lx: rate %d bps %d numchan %d type %x", hstream, StreamId, (USHORT)_configinfo.ulSampleRate, (USHORT)_configinfo.ulBitsPerSample, (USHORT)_configinfo.ulNumChannels, (USHORT)_configinfo.ulNumChannels, (USHORT)_configinfo.ulDataType));
     739        //dprintf(("WAVESTREAM stream %lx ctor %lx: rate %d bps %d numchan %d type %x", hstream, StreamId, (USHORT)_configinfo.ulSampleRate, (USHORT)_configinfo.ulBitsPerSample, (USHORT)_configinfo.ulNumChannels, (USHORT)_configinfo.ulNumChannels, (USHORT)_configinfo.ulDataType));
    758740}
    759741//******************************************************************************
     
    761743WAVESTREAM::~WAVESTREAM()
    762744{
    763 //    dprintf(("WAVESTREAM stream %x dtor %lx", hstream, StreamId));
     745        //dprintf(("WAVESTREAM stream %x dtor %lx", hstream, StreamId));
    764746    if(_configinfo.pConversionBuffer) {
    765747        if(DevHelp_VMFree(_configinfo.pConversionBuffer) != 0) {
  • OCO/trunk/drv16/wavestrm.hpp

    r396 r483  
    6161
    6262   WaveConfigInfo _configinfo;    // configuration info shared with the hardware
    63    ULONG   _ulBytesProcessed;     // number of bytes consumed or produces
     63   ULONG   _ulBytesWritten;       // number of bytes transferred to uniaud32
     64   ULONG   _ulBytesProcessed;     // number of bytes consumed or produced
    6465   ULONG   _ulTimeBase;           // value in ms. MMPM sends for stream time
    6566
  • OCO/trunk/include/dbgos2.h

    r469 r483  
    1919#endif
    2020
     21#ifdef DEBUG
    2122#define dprintf(a)  if(dbglevel >= 1) PrintfOut a
    2223#define dprintf2(a) if(dbglevel >= 2) PrintfOut a
     
    2526#define ddprintf(a) if(dbglevel >= 1) PrintfOut a
    2627#define dgprintf(a) if(dbglevel >= 1) PrintfOut a
     28#else
     29#define dprintf(a)  //if(dbglevel >= 1) PrintfOut a
     30#define dprintf2(a) //if(dbglevel >= 2) PrintfOut a
     31#define dprintf3(a) //if(dbglevel >= 3) PrintfOut a
     32#define dprintf4(a) //if(dbglevel >= 4) PrintfOut a
     33#define ddprintf(a) //if(dbglevel >= 1) PrintfOut a
     34#define dgprintf(a) //if(dbglevel >= 1) PrintfOut a
     35#endif
    2736
    2837#ifdef DEBUG
    29 #define DebugInt3() _asm int 3
     38#define DebugInt3() //_asm int 3 DAZ temporarily taken out of debug build to prevent traps
    3039#else
    3140#define DebugInt3() //_asm int 3
  • OCO/trunk/install/control.scr

    r409 r483  
    2525ssgroup=0
    2626ssname="mmbase"
    27 ssversion="1.1.4-RC7"
     27ssversion="1.9.1-SVNr483"
    2828sstermdll="ITERM.DLL"
    2929sstermdllentry="ITermEntry"
     
    4343ssgroup=17
    4444ssname="OS/2 Universal Audio: Wave"
    45 ssversion="1.1.4-RC7"
     45ssversion="1.9.1-SVNr483"
    4646sssize=680
    4747ssdll="genin.dll"
  • OCO/trunk/listerr.cmd

    r238 r483  
    22del all.txt
    33
    4 'dir *.err /s /m /h /k /f >tmp.xxx'
     4'dir *.err /f /s >tmp.xxx'
    55
    66LINEIN(tmp.xxx,1,0)
  • OCO/trunk/uniaud.inc

    r471 r483  
    77# BUILDVERSION must be 3 parts, and only numbers like 5.44.108
    88# It is best that 2'nd number is always 2 digits, eg at least 10
    9 BUILDVERSION = 1.9.0
     9BUILDVERSION = 1.9.1
    1010
    1111# Fixpack version
     
    1313# ex RC3  GA  FIXPACK2 beta_47
    1414# Comment out to avoid a fixpack line in bldlevel
    15 FIXPACK = SVNr471
     15FIXPACK = SVNr483
    1616
    1717# ALSA BUILD VERSION
Note: See TracChangeset for help on using the changeset viewer.