From f40bfc9267b13b54e6379dfe7539447662879d24 Mon Sep 17 00:00:00 2001 From: Sean Bartell Date: Sat, 25 Jun 2011 21:32:25 -0400 Subject: Add codecs to librbcodec. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97 Reviewed-on: http://gerrit.rockbox.org/137 Reviewed-by: Nils Wallménius Tested-by: Nils Wallménius --- lib/rbcodec/codecs/libgme/kss_scc_apu.h | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lib/rbcodec/codecs/libgme/kss_scc_apu.h (limited to 'lib/rbcodec/codecs/libgme/kss_scc_apu.h') diff --git a/lib/rbcodec/codecs/libgme/kss_scc_apu.h b/lib/rbcodec/codecs/libgme/kss_scc_apu.h new file mode 100644 index 0000000000..a6962469ac --- /dev/null +++ b/lib/rbcodec/codecs/libgme/kss_scc_apu.h @@ -0,0 +1,51 @@ +// Konami SCC sound chip emulator + +// Game_Music_Emu 0.6-pre +#ifndef KSS_SCC_APU_H +#define KSS_SCC_APU_H + +#include "blargg_common.h" +#include "blip_buffer.h" + +enum { scc_reg_count = 0xB0 }; // 0 <= reg < reg_count +enum { scc_osc_count = 5 }; +enum { scc_amp_range = 0x8000 }; + +struct scc_osc_t +{ + int delay; + int phase; + int last_amp; + struct Blip_Buffer* output; +}; + +struct Scc_Apu { + struct scc_osc_t oscs [scc_osc_count]; + blip_time_t last_time; + unsigned char regs [scc_reg_count]; + + struct Blip_Synth synth; +}; + +void Scc_init( struct Scc_Apu* this ); + +// Resets sound chip +void Scc_reset( struct Scc_Apu* this ); + +// Set overall volume, where 1.0 is normal +void Scc_volume( struct Scc_Apu* this, int v ); + +static inline void Scc_set_output( struct Scc_Apu* this, int index, struct Blip_Buffer* b ) +{ + assert( (unsigned) index < scc_osc_count ); + this->oscs [index].output = b; +} + +// Emulates to time t, then writes data to reg +void Scc_write( struct Scc_Apu* this, blip_time_t time, int addr, int data ); + +// Emulates to time t, then subtracts t from the current time. +// OK if previous write call had time slightly after t. +void Scc_end_frame( struct Scc_Apu* this, blip_time_t end_time ); + +#endif -- cgit v1.2.3