Mercurial > audlegacy-plugins
diff src/console/Nes_Fme7_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 | 986f098da058 |
line wrap: on
line diff
--- a/src/console/Nes_Fme7_Apu.cxx Wed Nov 29 14:42:11 2006 -0800 +++ b/src/console/Nes_Fme7_Apu.cxx Thu Nov 30 19:54:33 2006 -0800 @@ -1,5 +1,4 @@ - -// Game_Music_Emu 0.3.0. http://www.slack.net/~ant/ +// Game_Music_Emu 0.5.1. http://www.slack.net/~ant/ #include "Nes_Fme7_Apu.h" @@ -11,12 +10,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" void Nes_Fme7_Apu::reset() { @@ -25,13 +24,11 @@ for ( int i = 0; i < osc_count; i++ ) oscs [i].last_amp = 0; - fme7_snapshot_t* state = this; + fme7_apu_state_t* state = this; memset( state, 0, sizeof *state ); } -#include BLARGG_ENABLE_OPTIMIZER - -unsigned char Nes_Fme7_Apu::amp_table [16] = +unsigned char const Nes_Fme7_Apu::amp_table [16] = { #define ENTRY( n ) (unsigned char) (n * amp_range + 0.5) ENTRY(0.0000), ENTRY(0.0078), ENTRY(0.0110), ENTRY(0.0156), @@ -51,8 +48,10 @@ int vol_mode = regs [010 + index]; int volume = amp_table [vol_mode & 0x0f]; - if ( !oscs [index].output ) + Blip_Buffer* const osc_output = oscs [index].output; + if ( !osc_output ) continue; + osc_output->set_modified(); // check for unsupported mode #ifndef NDEBUG @@ -83,15 +82,13 @@ if ( delta ) { oscs [index].last_amp = amp; - synth.offset( last_time, delta, oscs [index].output ); + synth.offset( last_time, delta, osc_output ); } blip_time_t time = last_time + delays [index]; if ( time < end_time ) { - Blip_Buffer* const osc_output = oscs [index].output; int delta = amp * 2 - volume; - if ( volume ) { do @@ -110,7 +107,7 @@ // maintain phase when silent int count = (end_time - time + period - 1) / period; phases [index] ^= count & 1; - time += (long) count * period; + time += (blargg_long) count * period; } }