-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsound.c
81 lines (71 loc) · 1.54 KB
/
sound.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
XMascot Ver 2.6
Copyright(c) 1996,1997 Go Watanabe [email protected]
Tsuyoshi IIda [email protected]
*/
#ifdef SOUND
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "xmascot.h"
extern AppData adat;
/* 音声再生 (1つだけ) */
void
sound_play(char *name)
{
pid_t pid;
char cmdline[1024];
name = search(name);
if (adat.snd_cmd != NULL && name != NULL) {
sprintf(cmdline, adat.snd_cmd, name);
if ((pid = fork()) == 0) {
system(cmdline);
exit(0);
}
}
}
/* 連続再生 */
void
sounds_play(char **names, int num)
{
int i;
pid_t p;
char cmdline[1024];
char *name;
if (adat.snd_cmd != NULL && num > 0) {
if ((p = fork()) == 0) {
for (i = 0; i < num; i++) {
if ((name = search(names[i])) != NULL) {
sprintf(cmdline, adat.snd_cmd, name);
system(cmdline);
}
}
exit(0);
}
}
}
void xmascot_sound(XMascotData *adat, SoundType num)
{
switch(num) {
case SOUND_START:
sound_play(adat->mascot_menus[adat->menu_no].
mascots[adat->mascot_number].start_snd);
break;
case SOUND_END:
sound_play(adat->mascot_menus[adat->menu_no].
mascots[adat->mascot_number].end_snd);
break;
case SOUND_CLICK:
sound_play(adat->mascot_menus[adat->menu_no].
mascots[adat->mascot_number].click_snd);
break;
#ifdef BIFF
case SOUND_MAIL:
sound_play(adat->mascot_menus[adat->menu_no].
mascots[adat->mascot_number].mail_snd);
break;
#endif
}
}
#endif