mirror of
https://github.com/holub/mame
synced 2025-05-21 21:29:15 +03:00
DISCRETE_CRFILTER, DISCRETE_RCFILTER
- optimized my recent changes. Not worth mentioning.
This commit is contained in:
parent
37443dbc67
commit
0d1660e579
@ -99,6 +99,7 @@ struct dst_rcfilter_context
|
|||||||
double vCap;
|
double vCap;
|
||||||
double rc;
|
double rc;
|
||||||
double exponent;
|
double exponent;
|
||||||
|
UINT8 has_rc_nodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dst_rcfilter_sw_context
|
struct dst_rcfilter_sw_context
|
||||||
@ -147,13 +148,15 @@ static DISCRETE_STEP(dst_crfilter)
|
|||||||
{
|
{
|
||||||
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
||||||
|
|
||||||
|
if (context->has_rc_nodes)
|
||||||
|
{
|
||||||
double rc = DST_CRFILTER__R * DST_CRFILTER__C;
|
double rc = DST_CRFILTER__R * DST_CRFILTER__C;
|
||||||
|
|
||||||
if (rc != context->rc)
|
if (rc != context->rc)
|
||||||
{
|
{
|
||||||
context->rc = rc;
|
context->rc = rc;
|
||||||
context->exponent = RC_CHARGE_EXP(rc);
|
context->exponent = RC_CHARGE_EXP(rc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node->output[0] = DST_CRFILTER__IN - context->vCap;
|
node->output[0] = DST_CRFILTER__IN - context->vCap;
|
||||||
//context->vCap += ((DST_CRFILTER__IN - context->vRef) - context->vCap) * context->exponent;
|
//context->vCap += ((DST_CRFILTER__IN - context->vRef) - context->vCap) * context->exponent;
|
||||||
@ -164,6 +167,7 @@ static DISCRETE_RESET(dst_crfilter)
|
|||||||
{
|
{
|
||||||
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
||||||
|
|
||||||
|
context->has_rc_nodes = node->input_is_node & 0x6;
|
||||||
context->rc = DST_CRFILTER__R * DST_CRFILTER__C;
|
context->rc = DST_CRFILTER__R * DST_CRFILTER__C;
|
||||||
context->exponent = RC_CHARGE_EXP(context->rc);
|
context->exponent = RC_CHARGE_EXP(context->rc);
|
||||||
context->vCap = 0;
|
context->vCap = 0;
|
||||||
@ -1029,13 +1033,15 @@ static DISCRETE_STEP(dst_rcfilter)
|
|||||||
{
|
{
|
||||||
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
||||||
|
|
||||||
|
if (context->has_rc_nodes)
|
||||||
|
{
|
||||||
double rc = DST_RCFILTER__R * DST_RCFILTER__C;
|
double rc = DST_RCFILTER__R * DST_RCFILTER__C;
|
||||||
|
|
||||||
if (rc != context->rc)
|
if (rc != context->rc)
|
||||||
{
|
{
|
||||||
context->rc = rc;
|
context->rc = rc;
|
||||||
context->exponent = RC_CHARGE_EXP(rc);
|
context->exponent = RC_CHARGE_EXP(rc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Next Value = PREV + (INPUT_VALUE - PREV)*(1-(EXP(-TIMEDELTA/RC))) */
|
/* Next Value = PREV + (INPUT_VALUE - PREV)*(1-(EXP(-TIMEDELTA/RC))) */
|
||||||
@ -1049,6 +1055,7 @@ static DISCRETE_RESET(dst_rcfilter)
|
|||||||
{
|
{
|
||||||
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
struct dst_rcfilter_context *context = (struct dst_rcfilter_context *)node->context;
|
||||||
|
|
||||||
|
context->has_rc_nodes = node->input_is_node & 0x6;
|
||||||
context->rc = DST_RCFILTER__R * DST_RCFILTER__C;
|
context->rc = DST_RCFILTER__R * DST_RCFILTER__C;
|
||||||
context->exponent = RC_CHARGE_EXP(context->rc);
|
context->exponent = RC_CHARGE_EXP(context->rc);
|
||||||
context->vCap = 0;
|
context->vCap = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user