Esempio n. 1
0
int DSoundUpdate(const void *buff, int blocking)
{
  DWORD play = 0;
  int pos;

  LoopBuffer->GetCurrentPosition(&play, NULL);
  pos = play;

  // 'LoopWrite' is the next seg in the loop that we want to write
  // First check that the sound 'play' pointer has moved out of it:
  if (blocking) {
    while (LoopWrite <= pos && pos < LoopWrite + LoopSeg) {
      WaitForSingleObject(seg_played_event, 5000);
      LoopBuffer->GetCurrentPosition(&play, NULL);
      pos = play;
    }
  }
  else {
    if (LoopWrite <= pos && pos < LoopWrite + LoopSeg)
      return 1;
  }

  WriteSeg(buff);

  // Advance LoopWrite to next seg:
  LoopWrite += LoopSeg;
  if (LoopWrite + LoopSeg > LoopLen)
    LoopWrite = 0;

  return 0;
}
Esempio n. 2
0
int DSoundUpdate()
{
  DWORD play=0;
  int pos=0;

  if (LoopBuffer==NULL) return 1;

  LoopBuffer->GetCurrentPosition(&play,NULL);
  pos=play>>((PicoOpt&8) ? 2 : 1);

  // 'LoopWrite' is the next seg in the loop that we want to write
  // First check that the sound 'play' pointer has moved out of it:
  if (pos>=LoopWrite && pos<LoopWrite+PsndLen) return 1; // No, it hasn't

  WriteSeg();

  // Advance LoopWrite to next seg:
  LoopWrite+=PsndLen; if (LoopWrite+PsndLen>LoopLen) LoopWrite=0;

  return 0;
}