Mercurial > audlegacy-plugins
diff src/console/Nes_Namco_Apu.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 |
line wrap: on
line diff
--- a/src/console/Nes_Namco_Apu.h Wed Nov 29 14:42:11 2006 -0800 +++ b/src/console/Nes_Namco_Apu.h Thu Nov 30 19:54:33 2006 -0800 @@ -1,20 +1,16 @@ - // Namco 106 sound chip emulator -// Nes_Snd_Emu 0.1.7 - +// Nes_Snd_Emu 0.1.8 #ifndef NES_NAMCO_APU_H #define NES_NAMCO_APU_H -#include "Nes_Apu.h" +#include "blargg_common.h" +#include "Blip_Buffer.h" -struct namco_snapshot_t; +struct namco_state_t; class Nes_Namco_Apu { public: - Nes_Namco_Apu(); - ~Nes_Namco_Apu(); - // See Nes_Apu.h for reference. void volume( double ); void treble_eq( const blip_eq_t& ); @@ -22,11 +18,11 @@ enum { osc_count = 8 }; void osc_output( int index, Blip_Buffer* ); void reset(); - void end_frame( nes_time_t ); + void end_frame( blip_time_t ); // Read/write data register is at 0x4800 enum { data_reg_addr = 0x4800 }; - void write_data( nes_time_t, int ); + void write_data( blip_time_t, int ); int read_data(); // Write-only address register is at 0xF800 @@ -34,16 +30,19 @@ void write_addr( int ); // to do: implement save/restore - void save_snapshot( namco_snapshot_t* out ) const; - void load_snapshot( namco_snapshot_t const& ); + void save_state( namco_state_t* out ) const; + void load_state( namco_state_t const& ); +public: + Nes_Namco_Apu(); + BLARGG_DISABLE_NOTHROW private: // noncopyable Nes_Namco_Apu( const Nes_Namco_Apu& ); Nes_Namco_Apu& operator = ( const Nes_Namco_Apu& ); struct Namco_Osc { - long delay; + blargg_long delay; Blip_Buffer* output; short last_amp; short wave_pos; @@ -51,7 +50,7 @@ Namco_Osc oscs [osc_count]; - nes_time_t last_time; + blip_time_t last_time; int addr_reg; enum { reg_count = 0x80 }; @@ -59,10 +58,10 @@ Blip_Synth<blip_good_quality,15> synth; BOOST::uint8_t& access(); - void run_until( nes_time_t ); + void run_until( blip_time_t ); }; /* -struct namco_snapshot_t +struct namco_state_t { BOOST::uint8_t regs [0x80]; BOOST::uint8_t addr; @@ -74,7 +73,7 @@ inline BOOST::uint8_t& Nes_Namco_Apu::access() { - int addr = addr_reg & 0x7f; + int addr = addr_reg & 0x7F; if ( addr_reg & 0x80 ) addr_reg = (addr + 1) | 0x80; return reg [addr]; @@ -94,11 +93,10 @@ oscs [i].output = buf; } -inline void Nes_Namco_Apu::write_data( nes_time_t time, int data ) +inline void Nes_Namco_Apu::write_data( blip_time_t time, int data ) { run_until( time ); access() = data; } #endif -