Debian Codegraph @

src/hardware/snd_pc98/sound/tms3631g.c

raw symbols SCIP
1 #include "np2glue.h"
2 //#include "compiler.h"
3 #include "sound.h"
4 #include "tms3631.h"
5
6
7 extern TMS3631CFG tms3631cfg;
8
9
10 void SOUNDCALL tms3631_getpcm(TMS3631 tms, SINT32 *pcm, UINT count) {
11
12 UINT i;
13
14 if (tms->enable == 0) {
15 return;
16 }
17 while(count--) {
18 UINT ch = 0;
19 SINT32 data = 0;
20 do { // centre
21 if ((tms->enable & (1 << ch)) && (tms->ch[ch].freq)) {
22 for (i=0; i<4; i++) {
23 tms->ch[ch].count += tms->ch[ch].freq;
24 data += (tms->ch[ch].count & 0x10000)?1:-1;
25 }
26 }
27 } while(++ch < 2);
28 pcm[0] += data * tms3631cfg.left;
29 pcm[1] += data * tms3631cfg.right;
30 do { // left
31 if ((tms->enable & (1 << ch)) && (tms->ch[ch].freq)) {
32 for (i=0; i<4; i++) {
33 tms->ch[ch].count += tms->ch[ch].freq;
34 pcm[0] += tms3631cfg.feet[(tms->ch[ch].count >> 16) & 15];
35 }
36 }
37 } while(++ch < 5);
38 do { // right
39 if ((tms->enable & (1 << ch)) && (tms->ch[ch].freq)) {
40 for (i=0; i<4; i++) {
41 tms->ch[ch].count += tms->ch[ch].freq;
42 pcm[1] += tms3631cfg.feet[(tms->ch[ch].count >> 16) & 15];
43 }
44 }
45 } while(++ch < 8);
46 pcm += 2;
47 }
48 }
49