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/sms_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/sms_apu.h')
-rw-r--r-- | apps/codecs/libgme/sms_apu.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/apps/codecs/libgme/sms_apu.h b/apps/codecs/libgme/sms_apu.h new file mode 100644 index 0000000000..25f4e74ae5 --- /dev/null +++ b/apps/codecs/libgme/sms_apu.h | |||
@@ -0,0 +1,63 @@ | |||
1 | // Sega Master System SN76489 PSG sound chip emulator | ||
2 | |||
3 | // Sms_Snd_Emu 0.1.2 | ||
4 | #ifndef SMS_APU_H | ||
5 | #define SMS_APU_H | ||
6 | |||
7 | #include "blargg_common.h" | ||
8 | #include "blip_buffer.h" | ||
9 | |||
10 | // 0: Square 1, 1: Square 2, 2: Square 3, 3: Noise | ||
11 | enum { sms_osc_count = 4 }; // 0 <= chan < osc_count | ||
12 | |||
13 | struct Osc | ||
14 | { | ||
15 | struct Blip_Buffer* outputs [4]; // NULL, right, left, center | ||
16 | struct Blip_Buffer* output; | ||
17 | int last_amp; | ||
18 | |||
19 | int volume; | ||
20 | int period; | ||
21 | int delay; | ||
22 | unsigned phase; | ||
23 | }; | ||
24 | |||
25 | struct Sms_Apu { | ||
26 | struct Osc oscs [sms_osc_count]; | ||
27 | int ggstereo; | ||
28 | int latch; | ||
29 | |||
30 | blip_time_t last_time; | ||
31 | int min_tone_period; | ||
32 | unsigned noise_feedback; | ||
33 | unsigned looped_feedback; | ||
34 | struct Blip_Synth synth; | ||
35 | }; | ||
36 | |||
37 | // Basics | ||
38 | |||
39 | void Sms_apu_init( struct Sms_Apu* this ); | ||
40 | |||
41 | // Sets buffer(s) to generate sound into, or 0 to mute. If only center is not 0, | ||
42 | // output is mono. | ||
43 | void Sms_apu_set_output( struct Sms_Apu* this, int i, struct Blip_Buffer* center, struct Blip_Buffer* left, struct Blip_Buffer* right); | ||
44 | |||
45 | // Emulates to time t, then writes data to Game Gear left/right assignment byte | ||
46 | void Sms_apu_write_ggstereo( struct Sms_Apu* this, blip_time_t t, int data ) ICODE_ATTR; | ||
47 | |||
48 | // Emulates to time t, then writes data | ||
49 | void Sms_apu_write_data( struct Sms_Apu* this, blip_time_t t, int data ) ICODE_ATTR; | ||
50 | |||
51 | // Emulates to time t, then subtracts t from the current time. | ||
52 | // OK if previous write call had time slightly after t. | ||
53 | void Sms_apu_end_frame( struct Sms_Apu* this, blip_time_t t ) ICODE_ATTR; | ||
54 | |||
55 | // More features | ||
56 | |||
57 | // Resets sound chip and sets noise feedback bits and width | ||
58 | void Sms_apu_reset( struct Sms_Apu* this, unsigned noise_feedback, int noise_width ); | ||
59 | |||
60 | // Sets overall volume, where 1.0 is normal | ||
61 | void Sms_apu_volume( struct Sms_Apu* this, double vol ); | ||
62 | |||
63 | #endif | ||