diff options
Diffstat (limited to 'lib/rbcodec/codecs/libgme/opl_apu.h')
-rw-r--r-- | lib/rbcodec/codecs/libgme/opl_apu.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libgme/opl_apu.h b/lib/rbcodec/codecs/libgme/opl_apu.h new file mode 100644 index 0000000000..76fa766492 --- /dev/null +++ b/lib/rbcodec/codecs/libgme/opl_apu.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef OPL_APU_H | ||
2 | #define OPL_APU_H | ||
3 | |||
4 | #include "blargg_common.h" | ||
5 | #include "blargg_source.h" | ||
6 | #include "blip_buffer.h" | ||
7 | |||
8 | #include "emu8950.h" | ||
9 | #include "emu2413.h" | ||
10 | |||
11 | enum opl_type_t { type_opll = 0x10, type_msxmusic = 0x11, type_smsfmunit = 0x12, | ||
12 | type_vrc7 = 0x13, type_msxaudio = 0x21 }; | ||
13 | |||
14 | enum { opl_osc_count = 1 }; | ||
15 | |||
16 | struct Opl_Apu { | ||
17 | struct Blip_Buffer* output_; | ||
18 | enum opl_type_t type_; | ||
19 | |||
20 | blip_time_t next_time; | ||
21 | int last_amp; | ||
22 | int addr; | ||
23 | |||
24 | long clock_; | ||
25 | long rate_; | ||
26 | blip_time_t period_; | ||
27 | |||
28 | struct Blip_Synth synth; | ||
29 | |||
30 | // OPL chips | ||
31 | struct Y8950 opl; | ||
32 | OPLL opll; | ||
33 | |||
34 | unsigned char regs[ 0x100 ]; | ||
35 | unsigned char opl_memory[ 32768 ]; | ||
36 | }; | ||
37 | |||
38 | blargg_err_t Opl_init( struct Opl_Apu* this, long clock, long rate, blip_time_t period, enum opl_type_t type ); | ||
39 | void Opl_shutdown( struct Opl_Apu* this ); | ||
40 | |||
41 | void Opl_reset( struct Opl_Apu* this ); | ||
42 | static inline void Opl_volume( struct Opl_Apu* this, int v ) { Synth_volume( &this->synth, v / (4096 * 6) ); } | ||
43 | |||
44 | static inline void Opl_osc_output( struct Opl_Apu* this, int i, struct Blip_Buffer* buf ) | ||
45 | { | ||
46 | #if defined(ROCKBOX) | ||
47 | (void) i; | ||
48 | #endif | ||
49 | assert( (unsigned) i < opl_osc_count ); | ||
50 | this->output_ = buf; | ||
51 | } | ||
52 | |||
53 | static inline void Opl_set_output( struct Opl_Apu* this, struct Blip_Buffer* buf ) { Opl_osc_output( this, 0, buf ); } | ||
54 | void Opl_end_frame( struct Opl_Apu* this, blip_time_t ); | ||
55 | |||
56 | static inline void Opl_write_addr( struct Opl_Apu* this, int data ) { this->addr = data; } | ||
57 | void Opl_write_data( struct Opl_Apu* this, blip_time_t, int data ); | ||
58 | |||
59 | int Opl_read( struct Opl_Apu* this, blip_time_t, int port ); | ||
60 | |||
61 | static inline bool Opl_supported( void ) { return true; } | ||
62 | |||
63 | #endif | ||