From 13cbade08a07296d92e7a7d3e20475de0032cba1 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Wed, 31 Aug 2011 19:19:49 +0000 Subject: Update libgme to Blargg's Game_Music_Emu 0.6-pre. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30397 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libgme/nes_apu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'apps/codecs/libgme/nes_apu.c') diff --git a/apps/codecs/libgme/nes_apu.c b/apps/codecs/libgme/nes_apu.c index 7d2814b3d8..630e71f450 100644 --- a/apps/codecs/libgme/nes_apu.c +++ b/apps/codecs/libgme/nes_apu.c @@ -39,19 +39,19 @@ void Apu_init( struct Nes_Apu* this ) this->oscs [4] = &this->dmc.osc; Apu_output( this, NULL ); + this->dmc.nonlinear = false; Apu_volume( this, (int)FP_ONE_VOLUME ); Apu_reset( this, false, 0 ); } -void Apu_enable_nonlinear( struct Nes_Apu* this, int v ) +void Apu_enable_nonlinear_( struct Nes_Apu* this, double sq, double tnd ) { this->dmc.nonlinear = true; - Synth_volume( &this->square_synth, (int)((long long)(1.3 * 0.25751258 / 0.742467605 * 0.25 * FP_ONE_VOLUME) / amp_range * v) ); + Synth_volume( &this->square_synth, (int)((long long)(sq * FP_ONE_VOLUME) / amp_range) ); - const int tnd = (int)(0.48 / 202 * 0.75 * FP_ONE_VOLUME); - Synth_volume( &this->triangle.synth, 3 * tnd ); - Synth_volume( &this->noise.synth, 2 * tnd ); - Synth_volume( &this->dmc.synth, tnd ); + Synth_volume( &this->triangle.synth, tnd * 2.752 ); + Synth_volume( &this->noise.synth , tnd * 1.849 ); + Synth_volume( &this->dmc.synth , tnd ); this->square1 .osc.last_amp = 0; this->square2 .osc.last_amp = 0; @@ -62,11 +62,13 @@ void Apu_enable_nonlinear( struct Nes_Apu* this, int v ) void Apu_volume( struct Nes_Apu* this, int v ) { - this->dmc.nonlinear = false; - Synth_volume( &this->square_synth, (int)((long long)(0.1128 *FP_ONE_VOLUME) * v / amp_range / FP_ONE_VOLUME) ); - Synth_volume( &this->triangle.synth,(int)((long long)(0.12765*FP_ONE_VOLUME) * v / amp_range / FP_ONE_VOLUME) ); - Synth_volume( &this->noise.synth, (int)((long long)(0.0741 *FP_ONE_VOLUME) * v / amp_range / FP_ONE_VOLUME) ); - Synth_volume( &this->dmc.synth, (int)((long long)(0.42545*FP_ONE_VOLUME) * v / 127 / FP_ONE_VOLUME) ); + if ( !this->dmc.nonlinear ) + { + Synth_volume( &this->square_synth, (int)((long long)((0.125 * (1.0 /1.11)) * FP_ONE_VOLUME) * v / amp_range / FP_ONE_VOLUME) ); // was 0.1128 1.108 + Synth_volume( &this->triangle.synth,(int)((long long)((0.150 * (1.0 /1.11)) * FP_ONE_VOLUME) * v / amp_range / FP_ONE_VOLUME) ); // was 0.12765 1.175 + Synth_volume( &this->noise.synth, (int)((long long)((0.095 * (1.0 /1.11)) * FP_ONE_VOLUME) * v / amp_range / FP_ONE_VOLUME) ); // was 0.0741 1.282 + Synth_volume( &this->dmc.synth, (int)((long long)((0.450 * (1.0 /1.11)) * FP_ONE_VOLUME) * v / 2048 / FP_ONE_VOLUME) ); // was 0.42545 1.058 + } } void Apu_output( struct Nes_Apu* this, struct Blip_Buffer* buffer ) -- cgit v1.2.3