diff options
Diffstat (limited to 'apps/codecs/libgme/opl_apu.h')
-rw-r--r-- | apps/codecs/libgme/opl_apu.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/codecs/libgme/opl_apu.h b/apps/codecs/libgme/opl_apu.h new file mode 100644 index 0000000000..3f5a751976 --- /dev/null +++ b/apps/codecs/libgme/opl_apu.h | |||
@@ -0,0 +1,62 @@ | |||
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 | |||
40 | void Opl_reset( struct Opl_Apu* this ); | ||
41 | static inline void Opl_volume( struct Opl_Apu* this, double v ) { Synth_volume( &this->synth, 1.0 / (4096 * 6) * v ); } | ||
42 | |||
43 | static inline void Opl_osc_output( struct Opl_Apu* this, int i, struct Blip_Buffer* buf ) | ||
44 | { | ||
45 | #if defined(ROCKBOX) | ||
46 | (void) i; | ||
47 | #endif | ||
48 | assert( (unsigned) i < opl_osc_count ); | ||
49 | this->output_ = buf; | ||
50 | } | ||
51 | |||
52 | static inline void Opl_set_output( struct Opl_Apu* this, struct Blip_Buffer* buf ) { Opl_osc_output( this, 0, buf ); } | ||
53 | void Opl_end_frame( struct Opl_Apu* this, blip_time_t ) ICODE_ATTR; | ||
54 | |||
55 | static inline void Opl_write_addr( struct Opl_Apu* this, int data ) { this->addr = data; } | ||
56 | void Opl_write_data( struct Opl_Apu* this, blip_time_t, int data ) ICODE_ATTR; | ||
57 | |||
58 | int Opl_read( struct Opl_Apu* this, blip_time_t, int port ) ICODE_ATTR; | ||
59 | |||
60 | static inline bool Opl_supported( void ) { return true; } | ||
61 | |||
62 | #endif | ||