while(cont && !speedup) {
while(cont && !speedup && !throttle) {
void systemWriteDataToSoundBuffer(){  if(SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)    SDL_PauseAudio(0);  bool cont = true;  while(cont && !speedup) {    SDL_mutexP(mutex);    //    printf("Waiting for len < 2048 (speed up %d)\n", speedup);    if(sdlSoundLen < 2048*2)      cont = false;    SDL_mutexV(mutex);  }  int len = soundBufferLen;  int copied = 0;  if((sdlSoundLen+len) >= 2048*2) {    //    printf("Case 1\n");    memcpy(&sdlBuffer[sdlSoundLen],soundFinalWave, 2048*2-sdlSoundLen);    copied = 2048*2 - sdlSoundLen;    sdlSoundLen = 2048*2;    SDL_CondSignal(cond);    cont = true;    if(!speedup) {      while(cont) {        SDL_mutexP(mutex);        if(sdlSoundLen < 2048*2)          cont = false;        SDL_mutexV(mutex);      }      memcpy(&sdlBuffer[0],&(((u8 *)soundFinalWave)[copied]),             soundBufferLen-copied);      sdlSoundLen = soundBufferLen-copied;    } else {      memcpy(&sdlBuffer[0], &(((u8 *)soundFinalWave)[copied]), soundBufferLen);    }  } else {    //    printf("case 2\n");    memcpy(&sdlBuffer[sdlSoundLen], soundFinalWave, soundBufferLen);    sdlSoundLen += soundBufferLen;  }}