Mercurial > hg > forks > pwpunix
comparison pwplib/snd-w32.c @ 54:85671798fdb3
Various code cleanups, cosmetics, warning fixes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 26 May 2010 01:22:51 +0300 |
parents | e2b6a35bcb0c |
children |
comparison
equal
deleted
inserted
replaced
53:f0c596c5905b | 54:85671798fdb3 |
---|---|
3 #ifdef DRIVE_WIN32 | 3 #ifdef DRIVE_WIN32 |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | |
9 #include <windows.h> | 8 #include <windows.h> |
10 | 9 |
11 #define TIMERHZ 72 | 10 #include "sound.h" |
12 | |
13 #include "pwplib.h" | |
14 #include "gb.h" | |
15 | 11 |
16 #define NUMBUFS 2 | 12 #define NUMBUFS 2 |
17 | |
18 #define HARDBUFSIZE 65536 | 13 #define HARDBUFSIZE 65536 |
19 | 14 |
20 struct | 15 struct { |
21 { | |
22 int buffersize; | 16 int buffersize; |
23 HWAVEOUT outHandle; | 17 HWAVEOUT outHandle; |
24 WAVEHDR waveHdr[NUMBUFS]; | 18 WAVEHDR waveHdr[NUMBUFS]; |
25 char *bufData[NUMBUFS]; | 19 char *bufData[NUMBUFS]; |
26 int currbuf; | 20 int currbuf; |
27 int bufferptr; | 21 int bufferptr; |
28 int letsgo; | 22 int letsgo; |
29 } | 23 } pwp_w32snd; |
30 pwp_w32snd; | |
31 | 24 |
32 void win32snd_fill() | 25 |
26 static void win32snd_fill(void) | |
33 { | 27 { |
34 while(pwp_w32snd.bufferptr<(HARDBUFSIZE-pwp_w32snd.buffersize)) | 28 while (pwp_w32snd.bufferptr < (HARDBUFSIZE - pwp_w32snd.buffersize)) |
35 { | 29 { |
36 pwplib.player(); | 30 pwplib.player(); |
37 | 31 |
38 gb_genwave(pwp_w32snd.bufData[pwp_w32snd.currbuf] + | 32 gb_genwave(pwp_w32snd.bufData[pwp_w32snd.currbuf] + |
39 pwp_w32snd.bufferptr, | 33 pwp_w32snd.bufferptr, |
74 sizeof(WAVEHDR)); | 68 sizeof(WAVEHDR)); |
75 */ | 69 */ |
76 win32snd_fill(); | 70 win32snd_fill(); |
77 } | 71 } |
78 | 72 |
79 void win32snd_restore() | 73 static void win32snd_restore() |
80 { | 74 { |
81 } | 75 } |
82 | 76 |
83 void win32snd_start() | 77 static void win32snd_start() |
84 { | 78 { |
85 if(pwp_w32snd.letsgo==0) | 79 if(pwp_w32snd.letsgo==0) |
86 { | 80 { |
87 {int i=0; | 81 {int i=0; |
88 for(;i<NUMBUFS;i++) win32snd_fill(); | 82 for(;i<NUMBUFS;i++) win32snd_fill(); |
90 | 84 |
91 pwp_w32snd.letsgo++; | 85 pwp_w32snd.letsgo++; |
92 } | 86 } |
93 } | 87 } |
94 | 88 |
95 int win32snd_init() | 89 int win32snd_init(void) |
96 { | 90 { |
97 HANDLE bufHandle,waveHdrHandle; | 91 HANDLE bufHandle,waveHdrHandle; |
98 WAVEFORMATEX waveFormat; | 92 WAVEFORMATEX waveFormat; |
99 | 93 |
100 /************/ | 94 /************/ |