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

Rework buffer management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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"));
Note: See TracChangeset for help on using the changeset viewer.