45 printf(
"Loading sounds from '%s'...\n", g_getenv(
"CF_SOUND_DIR"));
46 fp = fopen(g_getenv(
"CF_SOUND_CONF"),
"r");
49 fprintf(stderr,
"Could not find sound definitions; aborting!\n");
57 while (fgets(buf,
sizeof(buf), fp) != NULL) {
62 if (buf[0] ==
'#' || buf[0] ==
'\n') {
68 newline = strchr(buf,
'\n');
70 if (newline != NULL) {
75 sounds[i].
symbolic = g_strdup(strsep(&line,
":"));
76 sounds[i].
volume = atoi(strsep(&line,
":"));
77 sounds[i].
filename = g_strdup(strsep(&line,
":"));
98 if (g_getenv(
"HOME") == NULL) {
99 fprintf(stderr,
"Couldn't read $HOME environmental variable.\n" 100 "Please set it to something reasonable.\n");
106 perror(
"Couldn't set $CF_SOUND_DIR");
111 snprintf(path,
sizeof(path),
"%s/sounds.conf", g_getenv(
"CF_SOUND_DIR"));
113 if (g_setenv(
"CF_SOUND_CONF", path, 0) != 0) {
114 perror(
"Couldn't set $CF_SOUND_CONF");
int init()
Initialize sound server.
int init_audio()
Initialize the sound subsystem.
Sound_Info sounds[MAX_SOUNDS]
#define MAXSOCKBUF
Maximum size of a packet the client expects to get and that the server can send.
Includes various dependencies header files needed by most everything.
#define CLIENT_SOUNDS_PATH
static void init_sounds()
Load sound definitions from a file.