diff options
Diffstat (limited to 'apps/codecs/libgme/hes_apu.h')
-rw-r--r-- | apps/codecs/libgme/hes_apu.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/codecs/libgme/hes_apu.h b/apps/codecs/libgme/hes_apu.h new file mode 100644 index 0000000000..8a49a5afc7 --- /dev/null +++ b/apps/codecs/libgme/hes_apu.h | |||
@@ -0,0 +1,55 @@ | |||
1 | // Turbo Grafx 16 (PC Engine) PSG sound chip emulator | ||
2 | |||
3 | // Game_Music_Emu 0.5.2 | ||
4 | #ifndef HES_APU_H | ||
5 | #define HES_APU_H | ||
6 | |||
7 | #include "blargg_common.h" | ||
8 | #include "blip_buffer.h" | ||
9 | |||
10 | enum { amp_range = 0x8000 }; | ||
11 | enum { osc_count = 6 }; | ||
12 | enum { start_addr = 0x0800 }; | ||
13 | enum { end_addr = 0x0809 }; | ||
14 | |||
15 | struct Hes_Osc | ||
16 | { | ||
17 | unsigned char wave [32]; | ||
18 | short volume [2]; | ||
19 | int last_amp [2]; | ||
20 | int delay; | ||
21 | int period; | ||
22 | unsigned char noise; | ||
23 | unsigned char phase; | ||
24 | unsigned char balance; | ||
25 | unsigned char dac; | ||
26 | blip_time_t last_time; | ||
27 | |||
28 | struct Blip_Buffer* outputs [2]; | ||
29 | struct Blip_Buffer* chans [3]; | ||
30 | unsigned noise_lfsr; | ||
31 | unsigned char control; | ||
32 | }; | ||
33 | |||
34 | void Osc_run_until( struct Hes_Osc* this, struct Blip_Synth* synth, blip_time_t ) ICODE_ATTR; | ||
35 | |||
36 | struct Hes_Apu { | ||
37 | struct Hes_Osc oscs [osc_count]; | ||
38 | |||
39 | int latch; | ||
40 | int balance; | ||
41 | struct Blip_Synth synth; | ||
42 | }; | ||
43 | |||
44 | // Init HES apu sound chip | ||
45 | void Apu_init( struct Hes_Apu* this ); | ||
46 | |||
47 | // Reset HES apu couns chip | ||
48 | void Apu_reset( struct Hes_Apu* this ); | ||
49 | |||
50 | void Apu_osc_output( struct Hes_Apu* this, int index, struct Blip_Buffer* center, struct Blip_Buffer* left, struct Blip_Buffer* right ) ICODE_ATTR; | ||
51 | void Apu_write_data( struct Hes_Apu* this, blip_time_t, int addr, int data ) ICODE_ATTR; | ||
52 | void Apu_end_frame( struct Hes_Apu* this, blip_time_t ) ICODE_ATTR; | ||
53 | |||
54 | static inline void Apu_volume( struct Hes_Apu* this, double v ) { Synth_volume( &this->synth, 1.8 / osc_count / amp_range * v ); } | ||
55 | #endif | ||