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/multi_buffer.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/multi_buffer.h')
-rw-r--r-- | apps/codecs/libgme/multi_buffer.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/apps/codecs/libgme/multi_buffer.h b/apps/codecs/libgme/multi_buffer.h new file mode 100644 index 0000000000..26f302380c --- /dev/null +++ b/apps/codecs/libgme/multi_buffer.h | |||
@@ -0,0 +1,72 @@ | |||
1 | // Multi-channel sound buffer interface, and basic mono and stereo buffers | ||
2 | |||
3 | // Blip_Buffer 0.4.1 | ||
4 | #ifndef MULTI_BUFFER_H | ||
5 | #define MULTI_BUFFER_H | ||
6 | |||
7 | #include "blargg_common.h" | ||
8 | #include "blip_buffer.h" | ||
9 | |||
10 | // Get indexed channel, from 0 to channel count - 1 | ||
11 | struct channel_t { | ||
12 | struct Blip_Buffer* center; | ||
13 | struct Blip_Buffer* left; | ||
14 | struct Blip_Buffer* right; | ||
15 | }; | ||
16 | |||
17 | enum { type_index_mask = 0xFF }; | ||
18 | enum { wave_type = 0x100, noise_type = 0x200, mixed_type = wave_type | noise_type }; | ||
19 | enum { buf_count = 3 }; | ||
20 | |||
21 | struct Stereo_Buffer { | ||
22 | struct Blip_Buffer bufs [buf_count]; | ||
23 | struct channel_t chan; | ||
24 | int stereo_added; | ||
25 | int was_stereo; | ||
26 | |||
27 | unsigned channels_changed_count_; | ||
28 | long sample_rate_; | ||
29 | int length_; | ||
30 | int samples_per_frame_; | ||
31 | }; | ||
32 | |||
33 | // Initializes Stereo_Buffer structure | ||
34 | void Buffer_init( struct Stereo_Buffer* this ); | ||
35 | |||
36 | blargg_err_t Buffer_set_sample_rate( struct Stereo_Buffer* this, long, int msec ); | ||
37 | void Buffer_clock_rate( struct Stereo_Buffer* this, long ); | ||
38 | void Buffer_bass_freq( struct Stereo_Buffer* this, int ); | ||
39 | void Buffer_clear( struct Stereo_Buffer* this ); | ||
40 | struct channel_t Buffer_channel( struct Stereo_Buffer* this ); | ||
41 | void Buffer_end_frame( struct Stereo_Buffer* this, blip_time_t ) ICODE_ATTR; | ||
42 | |||
43 | long Buffer_read_samples( struct Stereo_Buffer* this, blip_sample_t*, long ) ICODE_ATTR; | ||
44 | |||
45 | // Count of changes to channel configuration. Incremented whenever | ||
46 | // a change is made to any of the Blip_Buffers for any channel. | ||
47 | unsigned Buffer_channels_changed_count( struct Stereo_Buffer* this ) ICODE_ATTR; | ||
48 | void Buffer_channels_changed( struct Stereo_Buffer* this ) ICODE_ATTR; | ||
49 | |||
50 | void Buffer_mix_stereo_no_center( struct Stereo_Buffer* this, blip_sample_t*, blargg_long ) ICODE_ATTR; | ||
51 | void Buffer_mix_stereo( struct Stereo_Buffer* this, blip_sample_t*, blargg_long ) ICODE_ATTR; | ||
52 | void Buffer_mix_mono( struct Stereo_Buffer* this, blip_sample_t*, blargg_long ) ICODE_ATTR; | ||
53 | |||
54 | // Number of samples per output frame (1 = mono, 2 = stereo) | ||
55 | static inline int Buffer_samples_per_frame( struct Stereo_Buffer* this ) | ||
56 | { | ||
57 | return this->samples_per_frame_; | ||
58 | } | ||
59 | |||
60 | // See Blip_Buffer.h | ||
61 | static inline long Buffer_sample_rate( struct Stereo_Buffer* this ) | ||
62 | { | ||
63 | return this->sample_rate_; | ||
64 | } | ||
65 | |||
66 | // Length of buffer, in milliseconds | ||
67 | static inline int Buffer_length( struct Stereo_Buffer* this ) | ||
68 | { | ||
69 | return this->length_; | ||
70 | } | ||
71 | |||
72 | #endif | ||