diff options
Diffstat (limited to 'apps/plugins/rockboy/rbsound.c')
-rw-r--r-- | apps/plugins/rockboy/rbsound.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/plugins/rockboy/rbsound.c b/apps/plugins/rockboy/rbsound.c new file mode 100644 index 0000000000..6d1b24fd9a --- /dev/null +++ b/apps/plugins/rockboy/rbsound.c | |||
@@ -0,0 +1,51 @@ | |||
1 | |||
2 | |||
3 | |||
4 | #include "rockmacros.h" | ||
5 | #include "defs.h" | ||
6 | #include "pcm.h" | ||
7 | #include "rc.h" | ||
8 | |||
9 | |||
10 | struct pcm pcm; | ||
11 | |||
12 | static byte buf[4096]; | ||
13 | |||
14 | |||
15 | rcvar_t pcm_exports[] = | ||
16 | { | ||
17 | RCV_END | ||
18 | }; | ||
19 | |||
20 | |||
21 | void pcm_init(void) | ||
22 | { | ||
23 | pcm.hz = 44100; | ||
24 | pcm.stereo = 1; | ||
25 | pcm.buf = buf; | ||
26 | pcm.len = sizeof buf; | ||
27 | pcm.pos = 0; | ||
28 | } | ||
29 | |||
30 | void pcm_close(void) | ||
31 | { | ||
32 | memset(&pcm, 0, sizeof pcm); | ||
33 | } | ||
34 | |||
35 | int pcm_submit(void) | ||
36 | { | ||
37 | #ifdef RBSOUND | ||
38 | rb->pcm_play_data(pcm.buf,pcm.pos,NULL); | ||
39 | while(rb->pcm_is_playing()); /* spinlock */ | ||
40 | pcm.pos = 0; | ||
41 | return 1; | ||
42 | #else | ||
43 | pcm.pos = 0; | ||
44 | return 0; | ||
45 | #endif | ||
46 | } | ||
47 | |||
48 | |||
49 | |||
50 | |||
51 | |||