diff options
Diffstat (limited to 'apps/codecs/libgme/kss_scc_apu.h')
-rw-r--r-- | apps/codecs/libgme/kss_scc_apu.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/codecs/libgme/kss_scc_apu.h b/apps/codecs/libgme/kss_scc_apu.h new file mode 100644 index 0000000000..f31228a39d --- /dev/null +++ b/apps/codecs/libgme/kss_scc_apu.h | |||
@@ -0,0 +1,51 @@ | |||
1 | // Konami SCC sound chip emulator | ||
2 | |||
3 | // Game_Music_Emu 0.6-pre | ||
4 | #ifndef KSS_SCC_APU_H | ||
5 | #define KSS_SCC_APU_H | ||
6 | |||
7 | #include "blargg_common.h" | ||
8 | #include "blip_buffer.h" | ||
9 | |||
10 | enum { scc_reg_count = 0xB0 }; // 0 <= reg < reg_count | ||
11 | enum { scc_osc_count = 5 }; | ||
12 | enum { scc_amp_range = 0x8000 }; | ||
13 | |||
14 | struct scc_osc_t | ||
15 | { | ||
16 | int delay; | ||
17 | int phase; | ||
18 | int last_amp; | ||
19 | struct Blip_Buffer* output; | ||
20 | }; | ||
21 | |||
22 | struct Scc_Apu { | ||
23 | struct scc_osc_t oscs [scc_osc_count]; | ||
24 | blip_time_t last_time; | ||
25 | unsigned char regs [scc_reg_count]; | ||
26 | |||
27 | struct Blip_Synth synth; | ||
28 | }; | ||
29 | |||
30 | void Scc_init( struct Scc_Apu* this ); | ||
31 | |||
32 | // Resets sound chip | ||
33 | void Scc_reset( struct Scc_Apu* this ); | ||
34 | |||
35 | // Set overall volume, where 1.0 is normal | ||
36 | void Scc_volume( struct Scc_Apu* this, double v ); | ||
37 | |||
38 | static inline void Scc_set_output( struct Scc_Apu* this, int index, struct Blip_Buffer* b ) | ||
39 | { | ||
40 | assert( (unsigned) index < scc_osc_count ); | ||
41 | this->oscs [index].output = b; | ||
42 | } | ||
43 | |||
44 | // Emulates to time t, then writes data to reg | ||
45 | void Scc_write( struct Scc_Apu* this, blip_time_t time, int addr, int data ) ICODE_ATTR; | ||
46 | |||
47 | // Emulates to time t, then subtracts t from the current time. | ||
48 | // OK if previous write call had time slightly after t. | ||
49 | void Scc_end_frame( struct Scc_Apu* this, blip_time_t end_time ) ICODE_ATTR; | ||
50 | |||
51 | #endif | ||