Ignore:
Timestamp:
Feb 4, 2000, 8:29:17 PM (26 years ago)
Author:
hugh
Message:

some minor dsound fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/dsound/OS2SNDBUFFER.CPP

    r1744 r2637  
    1 /* $Id: OS2SNDBUFFER.CPP,v 1.5 1999-11-14 22:12:15 hugh Exp $ */
     1/* $Id: OS2SNDBUFFER.CPP,v 1.6 2000-02-04 19:29:16 hugh Exp $ */
    22
    33/*
     
    100100          bufferdesc.lpwfxFormat->cbSize + sizeof(WAVEFORMATEX));
    101101
     102  bufferdesc.lpwfxFormat = lpfxFormat;
     103
    102104  lpBuffer = (LPSTR)VirtualAlloc( 0, bufferdesc.dwBufferBytes, MEM_COMMIT, PAGE_READWRITE);
    103105  if(lpBuffer == NULL)
     
    108110      return;
    109111  }
     112
    110113}
    111114//******************************************************************************
     
    210213    Ticks = CurrentTicks-me->LastTickCnt;
    211214    dprintf(("  Is Playing, Ticks: Last %d Current %d Difference %d",me->LastTickCnt, CurrentTicks,Ticks));
    212     me->LastTickCnt = CurrentTicks;
    213 
    214     NewPos = ((me->frequency*Ticks)/1000)*(me->bufferdesc.lpwfxFormat->wBitsPerSample/8);
     215    dprintf(("  Frequency: %d Bits per Sample %d",me->frequency,me->lpfxFormat->wBitsPerSample));
     216
     217    NewPos = ((me->frequency*Ticks)/1000)*(me->lpfxFormat->wBitsPerSample/8);
    215218    dprintf(("  advance pos by %d bytes",NewPos));
     219
     220    if(NewPos)
     221      me->LastTickCnt = CurrentTicks;
    216222
    217223    if(me->playpos+NewPos >= me->bufferdesc.dwBufferBytes)
     
    235241    if(me->writepos >= me->bufferdesc.dwBufferBytes)
    236242      me->writepos = me->writepos % me->bufferdesc.dwBufferBytes;
    237 
     243    dprintf(("  new Pos Write: %d   Play: %d",me->writepos,me->playpos));
    238244  }
    239245  else
     
    361367    dwWriteCursor = me->writepos;
    362368  }
     369  dprintf(("  Buffer at 0x%08X Size %d",me->lpBuffer,me->bufferdesc.dwBufferBytes));
    363370  if(dwWriteCursor + dwWriteBytes > me->bufferdesc.dwBufferBytes )
    364371  {
    365372    *(DWORD *)lplpvAudioPtr1  = (DWORD)(me->lpBuffer + dwWriteCursor);
    366373    *lpdwAudioBytes1          = me->bufferdesc.dwBufferBytes - dwWriteCursor;
     374    dprintf(("  Lock1 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr1,*lpdwAudioBytes1));
    367375    if(lplpvAudioPtr2 && lpdwAudioBytes2)
    368376    {
    369         *(DWORD *)lplpvAudioPtr2   = (DWORD)me->lpBuffer;
    370         *lpdwAudioBytes2           = dwWriteBytes - *lpdwAudioBytes1;
     377      *(DWORD *)lplpvAudioPtr2   = (DWORD)me->lpBuffer;
     378      *lpdwAudioBytes2           = dwWriteBytes - *lpdwAudioBytes1;
     379      dprintf(("  Lock2 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr2,*lpdwAudioBytes2));
    371380    }
    372381  }
     
    375384    *(DWORD *)lplpvAudioPtr1  = (DWORD)(me->lpBuffer + dwWriteCursor);
    376385    *lpdwAudioBytes1          = dwWriteBytes;
     386    dprintf(("  Lock1 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr1,*lpdwAudioBytes1));
    377387    if(lplpvAudioPtr2 && lpdwAudioBytes2)
    378388    {
    379         *(DWORD *)lplpvAudioPtr2   = 0;
    380         *lpdwAudioBytes2           = 0;
     389      *(DWORD *)lplpvAudioPtr2   = 0;
     390      *lpdwAudioBytes2           = 0;
     391      dprintf(("  Lock2 at 0x%08X Size %d",*(DWORD *)lplpvAudioPtr2,*lpdwAudioBytes2));
    381392    }
    382393  }
     
    493504    me->LastTickCnt = CurrentTicks;
    494505
    495     NewPos = ((me->frequency*Ticks)/1000)*(me->bufferdesc.lpwfxFormat->wBitsPerSample>>8);
     506    NewPos = ((me->frequency*Ticks)/1000)*(me->lpfxFormat->wBitsPerSample>>8);
    496507    if(me->playpos+NewPos >= me->bufferdesc.dwBufferBytes)
    497508    {
     
    531542    return DSERR_INVALIDPARAM;
    532543  }
     544
    533545  return DS_OK;
    534546}
Note: See TracChangeset for help on using the changeset viewer.