-
Notifications
You must be signed in to change notification settings - Fork 1
/
sound-old.c
111 lines (66 loc) · 1.62 KB
/
sound-old.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "sound.h"
#include "plateform.h"
#include "emu2149.h"
#ifdef SOUNDV2
void ProcSound(void);
PSG psg;
#define CPC_CLK 2000000
u8 PlaySound( core_crocods_t *gb )
{
return 1;
}
void PauseSound( core_crocods_t *gb )
{
}
void Reset8912( core_crocods_t *gb )
{
PSG_reset(&psg);
}
void Write8912( core_crocods_t *gb, int reg, int val )
{
PSG_writeReg(&psg, reg, val);
return;
}
int Read8912( core_crocods_t *gb, int r )
{
return (u8) (psg.reg[r & 0x1f]);
}
void initSound(core_crocods_t *gb, int r) {
printf("\nSound V2vi\n");
// PSG initialize
PSG *_psg = PSG_new(CPC_CLK,r);
memcpy(&psg, _psg, sizeof(PSG));
PSG_reset( &psg );
}
void crocods_copy_sound_buffer(core_crocods_t *gb, GB_sample_t *dest, unsigned int snd_bufsize) {
int i;
for ( i = 0; i < snd_bufsize; i++ )
{
e_uint8 cl,cr,cc;
PSG_calc(&psg, &cl, &cc, &cr);
// cc=cc/2;
dest[i].left = (cl + cc) * 100; // ( (Wave[2][i] + Wave[1][i]) * SND_VOLUME ) >> 8 ;
dest[i].right = (cr + cc) * 100; // ( (Wave[0][i] + Wave[1][i]) * SND_VOLUME ) >> 8 ;
//
//
// dest[i].left = canal[0] ;
// dest[i].right = canal[1] ;
}
}
void procSound(core_crocods_t *gb, int us) {
u16 canal[2];
// PSG_calc(&psg, canal);
// if (wptr>= SOUNDBUFCNT ) {
// return;
// }
//
// *sbuf = canal[0];
// sbuf ++;
//
// *sbuf = canal[1];
// sbuf ++;
//
// wptr ++ ;
//
}
#endif