diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-07 20:01:04 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-07 20:01:04 +0000 |
commit | acb0917556fc33681c1df5a530cf754193e67705 (patch) | |
tree | 052a47097009a210e4aed9c207bd6aa4828cc000 /apps/codecs/libgme/hes_apu.h | |
parent | 93c6f1329a5691a8be158cefe15641bd1daf9ef8 (diff) | |
download | rockbox-acb0917556fc33681c1df5a530cf754193e67705.tar.gz rockbox-acb0917556fc33681c1df5a530cf754193e67705.zip |
Submit initial patch from FS#12176. Adds support for several new game music formats (AY, GBS, HES, KSS, SGC, VGM and VGZ) and replaces the current NSF and NSFE with a new implementation based on a port of the Game Music Emu library 'GME'. This first submit does not cover the full functionality provided by the author's original patch: Coleco-SGV is not supported, some GME-specific m3u-support has been removed and IRAM is not used yet. Further changes are very likely to follow this submit. Thanks to Mauricio Garrido.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30264 a1c6a512-1295-4272-9138-f99709370657
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 | ||