Mercurial > audlegacy-plugins
diff src/console/Nes_Namco_Apu.cxx @ 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.cxx Wed Nov 29 14:42:11 2006 -0800 +++ b/src/console/Nes_Namco_Apu.cxx Thu Nov 30 19:54:33 2006 -0800 @@ -1,5 +1,4 @@ - -// Nes_Snd_Emu 0.1.7. http://www.slack.net/~ant/ +// Nes_Snd_Emu 0.1.8. http://www.slack.net/~ant/ #include "Nes_Namco_Apu.h" @@ -9,12 +8,12 @@ version 2.1 of the License, or (at your option) any later version. This module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for -more details. You should have received a copy of the GNU Lesser General -Public License along with this module; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. You should have received a copy of the GNU Lesser General Public +License along with this module; if not, write to the Free Software Foundation, +Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include BLARGG_SOURCE_BEGIN +#include "blargg_source.h" Nes_Namco_Apu::Nes_Namco_Apu() { @@ -23,10 +22,6 @@ reset(); } -Nes_Namco_Apu::~Nes_Namco_Apu() -{ -} - void Nes_Namco_Apu::reset() { last_time = 0; @@ -54,7 +49,7 @@ /* void Nes_Namco_Apu::reflect_state( Tagged_Data& data ) { - reflect_int16( data, 'ADDR', &addr_reg ); + reflect_int16( data, BLARGG_4CHAR('A','D','D','R'), &addr_reg ); static const char hex [17] = "0123456789ABCDEF"; int i; @@ -63,13 +58,13 @@ for ( i = 0; i < osc_count; i++ ) { - reflect_int32( data, 'DLY0' + i, &oscs [i].delay ); - reflect_int16( data, 'POS0' + i, &oscs [i].wave_pos ); + reflect_int32( data, BLARGG_4CHAR('D','L','Y','0') + i, &oscs [i].delay ); + reflect_int16( data, BLARGG_4CHAR('P','O','S','0') + i, &oscs [i].wave_pos ); } } */ -void Nes_Namco_Apu::end_frame( nes_time_t time ) +void Nes_Namco_Apu::end_frame( blip_time_t time ) { if ( time > last_time ) run_until( time ); @@ -78,9 +73,7 @@ last_time -= time; } -#include BLARGG_ENABLE_OPTIMIZER - -void Nes_Namco_Apu::run_until( nes_time_t nes_end_time ) +void Nes_Namco_Apu::run_until( blip_time_t nes_end_time ) { int active_oscs = (reg [0x7F] >> 4 & 7) + 1; for ( int i = osc_count - active_oscs; i < osc_count; i++ ) @@ -89,6 +82,7 @@ Blip_Buffer* output = osc.output; if ( !output ) continue; + output->set_modified(); blip_resampled_time_t time = output->resampled_time( last_time ) + osc.delay; @@ -104,7 +98,7 @@ if ( !volume ) continue; - long freq = (osc_reg [4] & 3) * 0x10000 + osc_reg [2] * 0x100L + osc_reg [0]; + blargg_long freq = (osc_reg [4] & 3) * 0x10000 + osc_reg [2] * 0x100L + osc_reg [0]; if ( freq < 64 * active_oscs ) continue; // prevent low frequencies from excessively delaying freq changes blip_resampled_time_t period =