From 5a0fd74a128c1e802db9a51fd08fc5c5ebe78897 Mon Sep 17 00:00:00 2001 From: Couriersud Date: Sat, 8 Aug 2009 21:28:36 +0000 Subject: [PATCH] - Added "abs" function to DISCRETE_TRANSFORM - Fixed a bug in DISCRETE_RCDISC5 --- src/emu/sound/disc_flt.c | 3 +-- src/emu/sound/disc_mth.c | 3 +++ src/emu/sound/discrete.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/emu/sound/disc_flt.c b/src/emu/sound/disc_flt.c index c1189867cd8..420443f44d7 100644 --- a/src/emu/sound/disc_flt.c +++ b/src/emu/sound/disc_flt.c @@ -833,8 +833,7 @@ static DISCRETE_STEP( dst_rcdisc5) diff = u - node->output[0]; if(diff < 0) - //diff = diff - (diff * exp(discrete_current_context->sample_time / context->exponent0)); - diff = -node->output[0] + (node->output[0] * context->exponent0); + diff = diff * context->exponent0; node->output[0] += diff; } else diff --git a/src/emu/sound/disc_mth.c b/src/emu/sound/disc_mth.c index 244f3ea09c2..f0bf3c0970e 100644 --- a/src/emu/sound/disc_mth.c +++ b/src/emu/sound/disc_mth.c @@ -1680,6 +1680,9 @@ static DISCRETE_STEP(dst_transform) case 'P': dst_transform_push(trans_stack, &trans_stack_ptr, top); break; + case 'a': /* absolute value */ + top = fabs(top); + break; case 'i': /* * -1 */ top = -top; break; diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h index 68db0bb2dd8..9accc318e97 100644 --- a/src/emu/sound/discrete.h +++ b/src/emu/sound/discrete.h @@ -1650,6 +1650,7 @@ * + - Pop two values from stack, add and push result to stack * / - Pop two values from stack, divide and push result to stack * * - Pop two values from stack, multiply and push result to stack + * a - Pop one value from stack, multiply -1 if less than 0 and push result to stack * i - Pop one value from stack, multiply -1 and push result to stack * ! - Pop one value from stack, logical invert, push result to stack * = - Pop two values from stack, logical = and push result to stack