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