diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libgme/kss_scc_apu.h | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libgme/kss_scc_apu.h')
-rw-r--r-- | lib/rbcodec/codecs/libgme/kss_scc_apu.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libgme/kss_scc_apu.h b/lib/rbcodec/codecs/libgme/kss_scc_apu.h new file mode 100644 index 0000000000..a6962469ac --- /dev/null +++ b/lib/rbcodec/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, int 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 ); | ||
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 ); | ||
50 | |||
51 | #endif | ||