summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libgme/kss_scc_apu.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libgme/kss_scc_apu.h')
-rw-r--r--lib/rbcodec/codecs/libgme/kss_scc_apu.h51
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
10enum { scc_reg_count = 0xB0 }; // 0 <= reg < reg_count
11enum { scc_osc_count = 5 };
12enum { scc_amp_range = 0x8000 };
13
14struct scc_osc_t
15{
16 int delay;
17 int phase;
18 int last_amp;
19 struct Blip_Buffer* output;
20};
21
22struct 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
30void Scc_init( struct Scc_Apu* this );
31
32// Resets sound chip
33void Scc_reset( struct Scc_Apu* this );
34
35// Set overall volume, where 1.0 is normal
36void Scc_volume( struct Scc_Apu* this, int v );
37
38static 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
45void 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.
49void Scc_end_frame( struct Scc_Apu* this, blip_time_t end_time );
50
51#endif