diff options
author | Derrick Renaud <derrickr@mamedev.org> | 2009-10-07 03:24:19 +0000 |
---|---|---|
committer | Derrick Renaud <derrickr@mamedev.org> | 2009-10-07 03:24:19 +0000 |
commit | 935e63f8aaaa17845c0a529dfa95b5bb1f97a835 (patch) | |
tree | b8f3f7c6bdfe5fb412c1cdcbdc267624335ed91a /src/emu | |
parent | 0d1660e579ec25a8ffad89ff9594a010e424e63e (diff) |
More sounds for Shuffleboard
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/sound/disc_mth.c | 37 | ||||
-rw-r--r-- | src/emu/sound/discrete.h | 13 |
2 files changed, 40 insertions, 10 deletions
diff --git a/src/emu/sound/disc_mth.c b/src/emu/sound/disc_mth.c index eb117875c20..eb9a8b58a48 100644 --- a/src/emu/sound/disc_mth.c +++ b/src/emu/sound/disc_mth.c @@ -175,10 +175,14 @@ struct dst_tvca_op_amp_context double exponent_d[2]; /* Discharge exponents based on function F3 */ double exponent2[2]; /* Discharge/charge exponents based on function F4 */ double exponent3[2]; /* Discharge/charge exponents based on function F5 */ + double exponent4; /* Discharge/charge exponents for c4 */ double v_cap1; /* charge on cap c1 */ double v_cap2; /* charge on cap c2 */ double v_cap3; /* charge on cap c3 */ + double v_cap4; /* charge on cap c4 */ double r67; /* = r6 + r7 (for easy use later) */ + UINT8 has_c4; + UINT8 has_r4; }; @@ -2023,12 +2027,32 @@ static DISCRETE_STEP(dst_tvca_op_amp) i_pos += context->v_cap3 / info->r11; } - /* Calculate output current. */ i_out = i_pos - i_neg; if (i_out < 0) i_out = 0; + /* Convert to voltage for final output. */ - node->output[0] = i_out * info->r4; + if (context->has_c4) + { + if (context->has_r4) + { + /* voltage across r4 charging cap */ + i_out *= info->r4; + /* exponential charge */ + context->v_cap4 += (i_out - context->v_cap4) * context->exponent4; + } + else + /* linear charge */ + context->v_cap4 += i_out / context->exponent4; + if (context->v_cap4 < 0) + context->v_cap4 = 0; + node->output[0] = context->v_cap4; + } + else + node->output[0] = i_out * info->r4; + + + /* Clip the output if needed. */ if (node->output[0] > context->v_out_max) node->output[0] = context->v_out_max; } @@ -2063,10 +2087,15 @@ static DISCRETE_RESET(dst_tvca_op_amp) context->v_trig2 = (info->v2 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r8, info->r9); context->exponent2[0] = RC_CHARGE_EXP(info->r9 * info->c2); context->exponent2[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r8, info->r9) * info->c2); - context->v_cap3 = 0; - context->v_trig3 = (info->v3 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r10, info->r11); + context->v_cap3 = 0; + context->v_trig3 = (info->v3 - 0.6 - OP_AMP_NORTON_VBE) * RES_VOLTAGE_DIVIDER(info->r10, info->r11); context->exponent3[0] = RC_CHARGE_EXP(info->r11 * info->c3); context->exponent3[1] = RC_CHARGE_EXP(RES_2_PARALLEL(info->r10, info->r11) * info->c3); + context->v_cap4 = 0; + if (info->r4 != 0) context->has_r4 = 1; + if (info->c4 != 0) context->has_c4 = 1; + if (context->has_r4 && context->has_c4) + context->exponent4 = RC_CHARGE_EXP(info->r4 * info->c4); DISCRETE_STEP_CALL(dst_tvca_op_amp); } diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h index cd863c74f9c..2abc171fe83 100644 --- a/src/emu/sound/discrete.h +++ b/src/emu/sound/discrete.h @@ -2115,7 +2115,7 @@ * input 1 node or static value, * address of discrete_op_amp_tvca_info structure) * - * discrete_op_amp_tvca_info = { r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, c1, c2, c3, v1, v2, v3, vP, f0, f1, f2, f3, f4, f5} + * discrete_op_amp_tvca_info = { r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, c1, c2, c3, c4, v1, v2, v3, vP, f0, f1, f2, f3, f4, f5} * * Note: Set all unused components to 0. * Set all unused functions to DISC_OP_AMP_TRIGGER_FUNCTION_NONE @@ -2125,11 +2125,11 @@ * vP is the op-amp B+. * * r2a - * IN0 >----ZZZZ-----. r1 - * .----. | vP >------ZZZZ---. - * | F0 |----+ | - * '----' | r2b | r4 - * r3a '---------------ZZZZ---+---ZZZZ--. + * IN0 >----ZZZZ-----. r1 c4 + * .----. | vP >------ZZZZ---+---||----. + * | F0 |----+ | | + * '----' | r2b | r4 | + * r3a '---------------ZZZZ---+---ZZZZ--+ * IN1 >----ZZZZ---. | | * .----. | r3b | |\ | * | F1 |--+-----------------ZZZZ---+ | \ | @@ -3984,6 +3984,7 @@ struct _discrete_op_amp_tvca_info double c1; double c2; double c3; + double c4; double v1; double v2; double v3; |