1 // Konami VRC7 sound chip emulator
6 #include "blargg_common.h"
7 #include "blip_buffer.h"
11 enum { vrc7_osc_count
= 6 };
14 struct Blip_Buffer
* output
;
21 blip_time_t next_time
;
22 struct vrc7_osc_t osc
;
23 struct Blip_Synth synth
;
27 // See Nes_Apu.h for reference
28 void Vrc7_init( struct Nes_Vrc7_Apu
* this );
29 void Vrc7_reset( struct Nes_Vrc7_Apu
* this );
30 void Vrc7_set_rate( struct Nes_Vrc7_Apu
* this, int r
);
31 void Vrc7_end_frame( struct Nes_Vrc7_Apu
* this, blip_time_t
);
33 void Vrc7_write_reg( struct Nes_Vrc7_Apu
* this, int reg
);
34 void Vrc7_write_data( struct Nes_Vrc7_Apu
* this, blip_time_t
, int data
);
36 void output_changed( struct Nes_Vrc7_Apu
* this );
37 static inline void Vrc7_set_output( struct Nes_Vrc7_Apu
* this, int i
, struct Blip_Buffer
* buf
)
39 assert( (unsigned) i
< vrc7_osc_count
);
42 // Will use OPLL_setMask to mute voices
45 this->osc
.output
= buf
;
49 // DB2LIN_AMP_BITS == 11, * 2
50 static inline void Vrc7_volume( struct Nes_Vrc7_Apu
* this, int v
) { Synth_volume( &this->synth
, v
/ 3 / 4096 ); }