diff options
author | Couriersud <couriersud@users.noreply.github.com> | 2009-10-02 21:48:42 +0000 |
---|---|---|
committer | Couriersud <couriersud@users.noreply.github.com> | 2009-10-02 21:48:42 +0000 |
commit | fdbc12eb493556d3e31434a9c7f87ae272efd647 (patch) | |
tree | 17fa7bef408946eca0ab1d8f66b76664ada527a3 | |
parent | e979d69b28fa21a60e7e5285d4cfc087b58d28fa (diff) |
Fix bug in DISCRETE_ONESHOT
-rw-r--r-- | src/emu/sound/disc_mth.c | 13 | ||||
-rw-r--r-- | src/emu/sound/discrete.h | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/emu/sound/disc_mth.c b/src/emu/sound/disc_mth.c index 59f3e7bb150..bfb74f14ff7 100644 --- a/src/emu/sound/disc_mth.c +++ b/src/emu/sound/disc_mth.c @@ -109,6 +109,7 @@ struct dst_oneshot_context double countdown; int state; int last_trig; + int type; }; struct dss_ramp_context @@ -1418,19 +1419,19 @@ static DISCRETE_STEP(dst_oneshot) context->last_trig = trigger; /* Is it the proper edge trigger */ - if ((DST_ONESHOT__TYPE & DISC_ONESHOT_REDGE) ? trigger : !trigger) + if ((context->type & DISC_ONESHOT_REDGE) ? trigger : !trigger) { if (!context->state) { /* We have first trigger */ context->state = 1; - node->output[0] = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? 0 : DST_ONESHOT__AMP; + node->output[0] = (context->type & DISC_OUT_ACTIVE_LOW) ? 0 : DST_ONESHOT__AMP; context->countdown = DST_ONESHOT__WIDTH; } else { /* See if we retrigger */ - if (DST_ONESHOT__TYPE & DISC_ONESHOT_RETRIG) + if (context->type & DISC_ONESHOT_RETRIG) { /* Retrigger */ context->countdown = DST_ONESHOT__WIDTH; @@ -1445,7 +1446,7 @@ static DISCRETE_STEP(dst_oneshot) context->countdown -= node->info->sample_time; if(context->countdown <= 0.0) { - node->output[0] = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0; + node->output[0] = (context->type & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0; context->countdown = 0; context->state = 0; } @@ -1462,7 +1463,9 @@ static DISCRETE_RESET(dst_oneshot) context->state = 0; context->last_trig = 0; - node->output[0] = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0; + context->type = DST_ONESHOT__TYPE; + + node->output[0] = (context->type & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0; } diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h index 4115fa285e3..5dcc515a372 100644 --- a/src/emu/sound/discrete.h +++ b/src/emu/sound/discrete.h @@ -4347,7 +4347,7 @@ enum #define DISCRETE_MULTIPLEX8(NODE,ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7) { NODE, DST_MULTIPLEX, 9, { ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, { ADDR,INP0,INP1,INP2,INP3,INP4,INP5,INP6,INP7 }, NULL, "DISCRETE_MULTIPLEX8" }, #define DISCRETE_MULTIPLY(NODE,INP0,INP1) { NODE, DST_GAIN , 3, { INP0,INP1,NODE_NC }, { INP0,INP1,0 }, NULL, "DISCRETE_MULTIPLY" }, #define DISCRETE_MULTADD(NODE,INP0,INP1,INP2) { NODE, DST_GAIN , 3, { INP0,INP1,INP2 }, { INP0,INP1,INP2 }, NULL, "DISCRETE_MULTADD" }, -#define DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE) { NODE, DST_ONESHOT , 5, { NODE_NC,TRIG,AMPL,WIDTH,NODE_NC }, { 0,TRIG,AMPL,WIDTH,TYPE }, NULL, "DISCRETE_ONESHOT" }, +#define DISCRETE_ONESHOT(NODE,TRIG,AMPL,WIDTH,TYPE) { NODE, DST_ONESHOT , 5, { 0,TRIG,AMPL,WIDTH,NODE_NC }, { 0,TRIG,AMPL,WIDTH,TYPE }, NULL, "DISCRETE_ONESHOT" }, #define DISCRETE_ONESHOTR(NODE,RESET,TRIG,AMPL,WIDTH,TYPE) { NODE, DST_ONESHOT , 5, { RESET,TRIG,AMPL,WIDTH,NODE_NC }, { RESET,TRIG,AMPL,WIDTH,TYPE }, NULL, "One Shot Resetable" }, #define DISCRETE_ONOFF(NODE,ENAB,INP0) { NODE, DST_GAIN , 3, { ENAB,INP0,NODE_NC }, { 0,1,0 }, NULL, "DISCRETE_ONOFF" }, #define DISCRETE_RAMP(NODE,ENAB,RAMP,GRAD,START,END,CLAMP) { NODE, DST_RAMP , 6, { ENAB,RAMP,GRAD,START,END,CLAMP }, { ENAB,RAMP,GRAD,START,END,CLAMP }, NULL, "DISCRETE_RAMP" }, |