if (iSoundLen + iLen >= 2048 * 2)
if (iSoundLen + iLen >= iSoundTotalLen)
void systemWriteDataToSoundBuffer(){  if (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)  {    SDL_PauseAudio(0);  }  bool bWait = true;  while (bWait && ! speedup && GUI()->iGetThrottle() == 0)  {    SDL_mutexP(pstSoundMutex);    if (iSoundLen < 2048 * 2)    {      bWait = false;    }    SDL_mutexV(pstSoundMutex);  }  int iLen = soundBufferLen;  int iCopied = 0;  if (iSoundLen + iLen >= 2048 * 2)  {    iCopied = 2048 * 2 - iSoundLen;    memcpy(&auiSoundBuffer[iSoundLen], soundFinalWave, iCopied);    iSoundLen = 2048 * 2;    SDL_CondSignal(pstSoundCond);    bWait = true;    if (! speedup && GUI()->iGetThrottle() == 0)    {      while(bWait)      {        SDL_mutexP(pstSoundMutex);        if (iSoundLen < 2048 * 2)        {          bWait = false;        }        SDL_mutexV(pstSoundMutex);      }      memcpy(auiSoundBuffer, ((u8 *)soundFinalWave) + iCopied,             soundBufferLen - iCopied);      iSoundLen = soundBufferLen - iCopied;    }    else    {      memcpy(auiSoundBuffer, ((u8 *)soundFinalWave) + iCopied,             soundBufferLen);    }  }  else  {    memcpy(&auiSoundBuffer[iSoundLen], soundFinalWave, soundBufferLen);    iSoundLen += soundBufferLen;  }}