Mix_Chunk *rumble;
-InitializeSound()
+void
+InitializeSound(void)
{
int reserved_chans;
char buf[256];
}
+void
ShutDownSound()
{
int i;
}
+void
MakeSound(char *channel, char *id)
{
char buf[256];
fprintf(stderr, "Mix_PlayChannel: %s\n", Mix_GetError());
}
+void
StartBulldozer(void)
{
if (!UserSoundOn) return;
}
+void
StopBulldozer(void)
{
if (!UserSoundOn) return;
}
#else /* WITH_SDL_MIXER */
+void
InitializeSound()
{
SoundInitialized = 1;
}
+void
ShutDownSound()
{
SoundInitialized = 0;
}
+void
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;
switch(pid) {
case 0:
execl(player, player, filename, NULL);
+ exit(1);
break;
case -1:
perror("fork failed");
}
}
+void
StartBulldozer(void)
{
MakeSound(0, "Rumble");
}
+void
StopBulldozer(void)
{
}
#endif
+void
MakeSoundOn(SimView *view, char *channel, char *id)
{
if (!UserSoundOn) return;
/* XXX comefrom: doKeyEvent */
+void
SoundOff(void)
{
ShutDownSound();
}
+void
DoStartSound(char *channel, char *id)
{
MakeSound(channel, id);
}
+void
DoStopSound(char *id)
{
StopBulldozer();
}
+int
SoundCmd(CLIENT_ARGS)
{
if (!strcmp(argv[2], "Rumble"))
return 0;
}
+int
DozerCmd(CLIENT_ARGS)
{
StopBulldozer();
return 0;
}
-sound_command_init()
+void
+sound_command_init(void)
{
Tcl_CreateCommand(tk_mainInterp, "playsound", SoundCmd,
(ClientData)NULL, (void (*)()) NULL);