X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/c926d3309ace0ecb51582617fb45c6297f22f886..8dc79b2cdfc3d2250707e65d2c355033203b8712:/src/sim/w_sound.c diff --git a/src/sim/w_sound.c b/src/sim/w_sound.c index a7dae78..7558e47 100644 --- a/src/sim/w_sound.c +++ b/src/sim/w_sound.c @@ -271,9 +271,22 @@ ShutDownSound() MakeSound(char *channel, char *id) { char filename[256], player[256]; + static struct timeval last = {0, 0}; + struct timeval now; + unsigned int diff; int i; pid_t pid; + gettimeofday(&now, NULL); + + diff = ((now.tv_sec - last.tv_sec) * 1000000) + + (now.tv_usec - last.tv_usec); + + if (diff < 100000) + return; + + last = now; + if (!UserSoundOn) return; if (!SoundInitialized) return; @@ -292,6 +305,7 @@ MakeSound(char *channel, char *id) switch(pid) { case 0: execl(player, player, filename, NULL); + exit(1); break; case -1: perror("fork failed");