Mercurial > audlegacy-plugins
diff src/console/Snes_Spc.h @ 316:fb513e10174e trunk
[svn] - merge libconsole-blargg into mainline libconsole:
+ obsoletes plugins-ugly:sapplug
| author | nenolod |
|---|---|
| date | Thu, 30 Nov 2006 19:54:33 -0800 |
| parents | 3da1b8942b8b |
| children | 986f098da058 |
line wrap: on
line diff
--- a/src/console/Snes_Spc.h Wed Nov 29 14:42:11 2006 -0800 +++ b/src/console/Snes_Spc.h Thu Nov 30 19:54:33 2006 -0800 @@ -1,8 +1,6 @@ - // Super Nintendo (SNES) SPC-700 APU Emulator -// Game_Music_Emu 0.3.0 - +// Game_Music_Emu 0.5.1 #ifndef SNES_SPC_H #define SNES_SPC_H @@ -12,31 +10,30 @@ class Snes_Spc { public: - typedef BOOST::uint8_t uint8_t; - - Snes_Spc(); // Load copy of SPC data into emulator. Clear echo buffer if 'clear_echo' is true. enum { spc_file_size = 0x10180 }; - blargg_err_t load_spc( const void* spc, long spc_size, bool clear_echo = 1 ); + blargg_err_t load_spc( const void* spc, long spc_size ); + + // Generate 'count' samples and optionally write to 'buf'. Count must be even. + // Sample output is 16-bit 32kHz, signed stereo pairs with the left channel first. + typedef short sample_t; + blargg_err_t play( long count, sample_t* buf = NULL ); + +// Optional functionality // Load copy of state into emulator. typedef Spc_Cpu::registers_t registers_t; blargg_err_t load_state( const registers_t& cpu_state, const void* ram_64k, const void* dsp_regs_128 ); - // Clear echo buffer + // Clear echo buffer, useful because many tracks have junk in the buffer. void clear_echo(); // Mute voice n if bit n (1 << n) of mask is set enum { voice_count = Spc_Dsp::voice_count }; void mute_voices( int mask ); - // Generate 'count' samples and optionally write to 'buf'. Count must be even. - // Sample output is 16-bit 32kHz, signed stereo pairs with the left channel first. - typedef short sample_t; - blargg_err_t play( long count, sample_t* buf = NULL ); - // Skip forward by the specified number of samples (64000 samples = 1 second) blargg_err_t skip( long count ); @@ -45,9 +42,17 @@ void set_gain( double ); // If true, prevent channels and global volumes from being phase-negated - void disable_surround( bool disable ); + void disable_surround( bool disable = true ); + + // Set 128 bytes to use for IPL boot ROM. Makes copy. Default is zero filled, + // to avoid including copyrighted code from the SPC-700. + void set_ipl_rom( const void* ); -// End of public interface + void set_tempo( double ); + +public: + Snes_Spc(); + typedef BOOST::uint8_t uint8_t; private: // timers struct Timer @@ -55,9 +60,9 @@ spc_time_t next_tick; int period; int count; - int shift; + int divisor; + int enabled; int counter; - int enabled; void run_until_( spc_time_t ); void run_until( spc_time_t time ) @@ -91,16 +96,16 @@ // boot rom enum { rom_size = 64 }; - enum { rom_addr = 0xffc0 }; + enum { rom_addr = 0xFFC0 }; bool rom_enabled; - uint8_t extra_ram [rom_size]; - static const uint8_t boot_rom [rom_size]; void enable_rom( bool ); // CPU and RAM (at end because it's large) Spc_Cpu cpu; enum { ram_size = 0x10000 }; + uint8_t extra_ram [rom_size]; uint8_t ram [ram_size + 0x100]; // padding for catching jumps past end + uint8_t boot_rom [rom_size]; }; inline void Snes_Spc::disable_surround( bool disable ) { dsp.disable_surround( disable ); } @@ -110,4 +115,3 @@ inline void Snes_Spc::set_gain( double v ) { dsp.set_gain( v ); } #endif -
