1 // Turbo Grafx 16 (PC Engine) PSG sound chip emulator
3 // Game_Music_Emu 0.5.2
7 #include "blargg_common.h"
8 #include "blip_buffer.h"
10 enum { amp_range
= 0x8000 };
11 enum { osc_count
= 6 };
12 enum { start_addr
= 0x0800 };
13 enum { end_addr
= 0x0809 };
17 unsigned char wave
[32];
24 unsigned char balance
;
26 blip_time_t last_time
;
28 struct Blip_Buffer
* outputs
[2];
29 struct Blip_Buffer
* chans
[3];
31 unsigned char control
;
34 void Osc_run_until( struct Hes_Osc
* this, struct Blip_Synth
* synth
, blip_time_t
) ICODE_ATTR
;
37 struct Hes_Osc oscs
[osc_count
];
41 struct Blip_Synth synth
;
44 // Init HES apu sound chip
45 void Apu_init( struct Hes_Apu
* this );
47 // Reset HES apu couns chip
48 void Apu_reset( struct Hes_Apu
* this );
50 void Apu_osc_output( struct Hes_Apu
* this, int index
, struct Blip_Buffer
* center
, struct Blip_Buffer
* left
, struct Blip_Buffer
* right
) ICODE_ATTR
;
51 void Apu_write_data( struct Hes_Apu
* this, blip_time_t
, int addr
, int data
) ICODE_ATTR
;
52 void Apu_end_frame( struct Hes_Apu
* this, blip_time_t
) ICODE_ATTR
;
54 static inline void Apu_volume( struct Hes_Apu
* this, double v
) { Synth_volume( &this->synth
, 1.8 / osc_count
/ amp_range
* v
); }