mirror of
https://github.com/holub/mame
synced 2025-05-25 23:35:26 +03:00
This one requires a "make clean"
Discrete sound - removed global variable discrete_current_context - discrete_info is now passed instead of device, we may get device by using disc_info->device - Added DISCRETE_IMPORT(*block): imports another discrete block - Added DISCRETE_REMOVE(node1, node2): removes a range of nodes - Added DISCRETE_REPLACE: next node replaces existing node, thus preserving run order - Added DISCRETE_NOP(node): does nothing, to be replaced. - Added a prescanning stage to build final block list after execution of the above. - The additions provide an easy way to document subtle difference between boards. - Please see audio/galaxian.c for an example
This commit is contained in:
parent
ff6bd235a1
commit
3608d0e4e2
@ -234,7 +234,7 @@ static DISCRETE_STEP(dsd_555_astbl)
|
||||
* dt = R*C(log(1/(1-(Vc/Vr))))
|
||||
*/
|
||||
|
||||
dt = discrete_current_context->sample_time;
|
||||
dt = disc_info->sample_time;
|
||||
|
||||
/* Sometimes a switching network is used to setup the capacitance.
|
||||
* These may select no capacitor, causing oscillation to stop.
|
||||
@ -338,7 +338,7 @@ static DISCRETE_STEP(dsd_555_astbl)
|
||||
}
|
||||
|
||||
/* Convert last switch time to a ratio */
|
||||
x_time = x_time / discrete_current_context->sample_time;
|
||||
x_time = x_time / disc_info->sample_time;
|
||||
|
||||
switch (context->output_type)
|
||||
{
|
||||
@ -387,7 +387,7 @@ static DISCRETE_RESET(dsd_555_astbl)
|
||||
context->v_out_high = (info->v_out_high == DEFAULT_555_HIGH) ? info->v_pos - 1.2 : info->v_out_high;
|
||||
|
||||
/* setup v_charge or node */
|
||||
v_charge_node = discrete_find_node(NULL, info->v_charge);
|
||||
v_charge_node = discrete_find_node(disc_info, info->v_charge);
|
||||
if (v_charge_node)
|
||||
context->v_charge_node = &(v_charge_node->output[NODE_CHILD_NODE_NUM(info->v_charge)]);
|
||||
else
|
||||
@ -548,7 +548,7 @@ static DISCRETE_RESET(dsd_555_mstbl)
|
||||
context->output_type = info->options & DISC_555_OUT_MASK;
|
||||
if ((context->output_type == DISC_555_OUT_COUNT_F) || (context->output_type == DISC_555_OUT_COUNT_R))
|
||||
{
|
||||
discrete_log("Invalid Output type in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(disc_info, "Invalid Output type in NODE_%d.\n", node->node - NODE_00);
|
||||
context->output_type = DISC_555_OUT_SQW;
|
||||
}
|
||||
|
||||
@ -642,7 +642,7 @@ static DISCRETE_STEP(dsd_555_cc)
|
||||
return;
|
||||
}
|
||||
|
||||
dt = discrete_current_context->sample_time; /* Change in time */
|
||||
dt = disc_info->sample_time; /* Change in time */
|
||||
v_cap = context->cap_voltage; /* Set to voltage before change */
|
||||
v_vcharge_limit = DSD_555_CC__VIN + info->v_cc_junction; /* the max v_cap can be and still be charged by i */
|
||||
/* Calculate charging current */
|
||||
@ -888,7 +888,7 @@ static DISCRETE_STEP(dsd_555_cc)
|
||||
context->cap_voltage = v_cap_next;
|
||||
|
||||
/* Convert last switch time to a ratio */
|
||||
x_time = x_time / discrete_current_context->sample_time;
|
||||
x_time = x_time / disc_info->sample_time;
|
||||
|
||||
switch (context->output_type)
|
||||
{
|
||||
@ -1171,7 +1171,7 @@ static DISCRETE_STEP(dsd_555_vco1)
|
||||
double v_cap; /* Current voltage on capacitor, before dt */
|
||||
double v_cap_next = 0; /* Voltage on capacitor, after dt */
|
||||
|
||||
dt = discrete_current_context->sample_time; /* Change in time */
|
||||
dt = disc_info->sample_time; /* Change in time */
|
||||
v_cap = context->cap_voltage;
|
||||
|
||||
/* Check: if the Control Voltage node is connected. */
|
||||
@ -1275,7 +1275,7 @@ static DISCRETE_STEP(dsd_555_vco1)
|
||||
context->cap_voltage = v_cap_next;
|
||||
|
||||
/* Convert last switch time to a ratio. No x_time in reset. */
|
||||
x_time = x_time / discrete_current_context->sample_time;
|
||||
x_time = x_time / disc_info->sample_time;
|
||||
if (!DSD_555_VCO1__RESET) x_time = 0;
|
||||
|
||||
switch (context->output_type)
|
||||
@ -1403,7 +1403,7 @@ static DISCRETE_STEP(dsd_566)
|
||||
|
||||
if (DSD_566__ENABLE && !context->error)
|
||||
{
|
||||
dt = discrete_current_context->sample_time; /* Change in time */
|
||||
dt = disc_info->sample_time; /* Change in time */
|
||||
v_cap = context->cap_voltage; /* Set to voltage before change */
|
||||
|
||||
/* get the v_charge and update each step if it is a node */
|
||||
@ -1528,7 +1528,7 @@ static DISCRETE_RESET(dsd_566)
|
||||
}
|
||||
|
||||
/* setup v_charge or node */
|
||||
v_charge_node = discrete_find_node(NULL, info->v_charge);
|
||||
v_charge_node = discrete_find_node(disc_info, info->v_charge);
|
||||
if (v_charge_node)
|
||||
context->v_charge_node = &(v_charge_node->output[NODE_CHILD_NODE_NUM(info->v_charge)]);
|
||||
else
|
||||
@ -1608,7 +1608,7 @@ static DISCRETE_STEP(dsd_ls624)
|
||||
double en = 0.0f;
|
||||
int cntf = 0, cntr = 0;
|
||||
|
||||
sample_t = discrete_current_context->sample_time; /* Change in time */
|
||||
sample_t = disc_info->sample_time; /* Change in time */
|
||||
//dt = LS624_T(DSD_LS624__C, DSD_LS624__VRNG, DSD_LS624__VMOD) / 2.0;
|
||||
dt = 1.0f / (2.0f * LS624_F(DSD_LS624__C, DSD_LS624__VMOD, DSD_LS624__VRNG));
|
||||
t = context->remain;
|
||||
|
@ -179,15 +179,15 @@ static DISCRETE_RESET(dst_crfilter)
|
||||
#define DST_FILTER1__FREQ (*(node->input[2]))
|
||||
#define DST_FILTER1__TYPE (*(node->input[3]))
|
||||
|
||||
static void calculate_filter1_coefficients(double fc, double type,
|
||||
static void calculate_filter1_coefficients(const discrete_info *disc_info, double fc, double type,
|
||||
double *a1, double *b0, double *b1)
|
||||
{
|
||||
double den, w, two_over_T;
|
||||
|
||||
/* calculate digital filter coefficents */
|
||||
/*w = 2.0*M_PI*fc; no pre-warping */
|
||||
w = discrete_current_context->sample_rate*2.0*tan(M_PI*fc/discrete_current_context->sample_rate); /* pre-warping */
|
||||
two_over_T = 2.0*discrete_current_context->sample_rate;
|
||||
w = disc_info->sample_rate*2.0*tan(M_PI*fc/disc_info->sample_rate); /* pre-warping */
|
||||
two_over_T = 2.0*disc_info->sample_rate;
|
||||
|
||||
den = w + two_over_T;
|
||||
*a1 = (w - two_over_T)/den;
|
||||
@ -202,7 +202,7 @@ static void calculate_filter1_coefficients(double fc, double type,
|
||||
}
|
||||
else
|
||||
{
|
||||
discrete_log("calculate_filter1_coefficients() - Invalid filter type for 1st order filter.");
|
||||
discrete_log(disc_info, "calculate_filter1_coefficients() - Invalid filter type for 1st order filter.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ static DISCRETE_RESET(dst_filter1)
|
||||
{
|
||||
struct dss_filter1_context *context = (struct dss_filter1_context *)node->context;
|
||||
|
||||
calculate_filter1_coefficients(DST_FILTER1__FREQ, DST_FILTER1__TYPE, &context->a1, &context->b0, &context->b1);
|
||||
calculate_filter1_coefficients(disc_info, DST_FILTER1__FREQ, DST_FILTER1__TYPE, &context->a1, &context->b0, &context->b1);
|
||||
node->output[0] = 0;
|
||||
}
|
||||
|
||||
@ -249,19 +249,20 @@ static DISCRETE_RESET(dst_filter1)
|
||||
#define DST_FILTER2__DAMP (*(node->input[3]))
|
||||
#define DST_FILTER2__TYPE (*(node->input[4]))
|
||||
|
||||
static void calculate_filter2_coefficients(double fc, double d, double type,
|
||||
static void calculate_filter2_coefficients(const discrete_info *disc_info,
|
||||
double fc, double d, double type,
|
||||
double *a1, double *a2,
|
||||
double *b0, double *b1, double *b2)
|
||||
{
|
||||
double w; /* cutoff freq, in radians/sec */
|
||||
double w_squared;
|
||||
double den; /* temp variable */
|
||||
double two_over_T = 2*discrete_current_context->sample_rate;
|
||||
double two_over_T = 2*disc_info->sample_rate;
|
||||
double two_over_T_squared = two_over_T * two_over_T;
|
||||
|
||||
/* calculate digital filter coefficents */
|
||||
/*w = 2.0*M_PI*fc; no pre-warping */
|
||||
w = discrete_current_context->sample_rate * 2.0 * tan(M_PI * fc / discrete_current_context->sample_rate); /* pre-warping */
|
||||
w = disc_info->sample_rate * 2.0 * tan(M_PI * fc / disc_info->sample_rate); /* pre-warping */
|
||||
w_squared = w * w;
|
||||
|
||||
den = two_over_T_squared + d*w*two_over_T + w_squared;
|
||||
@ -287,7 +288,7 @@ static void calculate_filter2_coefficients(double fc, double d, double type,
|
||||
}
|
||||
else
|
||||
{
|
||||
discrete_log("calculate_filter2_coefficients() - Invalid filter type for 2nd order filter.");
|
||||
discrete_log(disc_info, "calculate_filter2_coefficients() - Invalid filter type for 2nd order filter.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,7 +316,7 @@ static DISCRETE_RESET(dst_filter2)
|
||||
{
|
||||
struct dss_filter2_context *context = (struct dss_filter2_context *)node->context;
|
||||
|
||||
calculate_filter2_coefficients(DST_FILTER2__FREQ, DST_FILTER2__DAMP, DST_FILTER2__TYPE,
|
||||
calculate_filter2_coefficients(disc_info, DST_FILTER2__FREQ, DST_FILTER2__DAMP, DST_FILTER2__TYPE,
|
||||
&context->a1, &context->a2,
|
||||
&context->b0, &context->b1, &context->b2);
|
||||
node->output[0] = 0;
|
||||
@ -487,7 +488,7 @@ static DISCRETE_RESET(dst_op_amp_filt)
|
||||
double d = (info->c1 + info->c2) / sqrt(info->rF / context->rTotal * info->c1 * info->c2);
|
||||
double gain = -info->rF / context->rTotal * info->c2 / (info->c1 + info->c2);
|
||||
|
||||
calculate_filter2_coefficients(fc, d, DISC_FILTER_BANDPASS,
|
||||
calculate_filter2_coefficients(disc_info, fc, d, DISC_FILTER_BANDPASS,
|
||||
&context->a1, &context->a2,
|
||||
&context->b0, &context->b1, &context->b2);
|
||||
context->b0 *= gain;
|
||||
@ -556,7 +557,7 @@ static DISCRETE_STEP(dst_rcdisc)
|
||||
if (DST_RCDISC__ENABLE)
|
||||
{
|
||||
node->output[0] = DST_RCDISC__IN * exp(context->t / context->exponent0);
|
||||
context->t += discrete_current_context->sample_time;
|
||||
context->t += disc_info->sample_time;
|
||||
} else
|
||||
{
|
||||
context->state = 0;
|
||||
@ -740,17 +741,17 @@ static DISCRETE_RESET( dst_rcdisc4)
|
||||
/* some error checking. */
|
||||
if (DST_RCDISC4__R1 <= 0 || DST_RCDISC4__R2 <= 0 || DST_RCDISC4__C1 <= 0 || (DST_RCDISC4__R3 <= 0 && context->type == 1))
|
||||
{
|
||||
discrete_log("Invalid component values in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(disc_info, "Invalid component values in NODE_%d.\n", node->node - NODE_00);
|
||||
return;
|
||||
}
|
||||
if (DST_RCDISC4__VP < 3)
|
||||
{
|
||||
discrete_log("vP must be >= 3V in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(disc_info, "vP must be >= 3V in NODE_%d.\n", node->node - NODE_00);
|
||||
return;
|
||||
}
|
||||
if (DST_RCDISC4__TYPE < 1 || DST_RCDISC4__TYPE > 3)
|
||||
{
|
||||
discrete_log("Invalid circuit type in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(disc_info, "Invalid circuit type in NODE_%d.\n", node->node - NODE_00);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1190,7 +1191,7 @@ static DISCRETE_RESET(dst_rcintegrate)
|
||||
struct dst_rcintegrate_context *context = (struct dst_rcintegrate_context *)node->context;
|
||||
|
||||
double r;
|
||||
double dt = discrete_current_context->sample_time;
|
||||
double dt = disc_info->sample_time;
|
||||
|
||||
context->type = DST_RCINTEGRATE__TYPE;
|
||||
|
||||
@ -1266,7 +1267,7 @@ static DISCRETE_RESET(dst_sallen_key)
|
||||
fatalerror("Unknown sallen key filter type");
|
||||
}
|
||||
|
||||
calculate_filter2_coefficients(freq, 1.0 / q, DISC_FILTER_LOWPASS,
|
||||
calculate_filter2_coefficients(disc_info, freq, 1.0 / q, DISC_FILTER_LOWPASS,
|
||||
&context->a1, &context->a2,
|
||||
&context->b0, &context->b1, &context->b2);
|
||||
node->output[0] = 0;
|
||||
@ -1414,8 +1415,8 @@ static DISCRETE_RESET(dst_rcdisc2N)
|
||||
f1 = 1.0 / (2 * M_PI * DST_RCDISC2N__R0 * DST_RCDISC2N__C);
|
||||
f2 = 1.0 / (2 * M_PI * DST_RCDISC2N__R1 * DST_RCDISC2N__C);
|
||||
|
||||
calculate_filter1_coefficients(f1, DISC_FILTER_LOWPASS, &context->a1_0, &context->b0_0, &context->b1_0);
|
||||
calculate_filter1_coefficients(f2, DISC_FILTER_LOWPASS, &context->a1_1, &context->b0_1, &context->b1_1);
|
||||
calculate_filter1_coefficients(disc_info, f1, DISC_FILTER_LOWPASS, &context->a1_0, &context->b0_0, &context->b1_0);
|
||||
calculate_filter1_coefficients(disc_info, f2, DISC_FILTER_LOWPASS, &context->a1_1, &context->b0_1, &context->b1_1);
|
||||
|
||||
/* Initialize the object */
|
||||
node->output[0] = 0;
|
||||
|
@ -60,11 +60,20 @@ READ8_DEVICE_HANDLER(discrete_sound_r)
|
||||
}
|
||||
}
|
||||
else
|
||||
discrete_log("discrete_sound_r read from non-existent NODE_%02d\n", offset-NODE_00);
|
||||
discrete_log(info, "discrete_sound_r read from non-existent NODE_%02d\n", offset-NODE_00);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static STREAM_BACKGROUND_CALLBACK( disc_cb )
|
||||
{
|
||||
node_description *node = (node_description *) ptr;
|
||||
|
||||
node->output[0] = param * DSS_INPUT__GAIN + DSS_INPUT__OFFSET;
|
||||
}
|
||||
#endif
|
||||
|
||||
WRITE8_DEVICE_HANDLER(discrete_sound_w)
|
||||
{
|
||||
discrete_info *info = get_safe_token(device);
|
||||
@ -90,8 +99,10 @@ WRITE8_DEVICE_HANDLER(discrete_sound_w)
|
||||
new_data = data ? 0 : 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (last_data != new_data)
|
||||
{
|
||||
#if 1
|
||||
/* Bring the system up to now */
|
||||
stream_update(info->discrete_stream);
|
||||
|
||||
@ -99,11 +110,17 @@ WRITE8_DEVICE_HANDLER(discrete_sound_w)
|
||||
|
||||
/* Update the node output here so we don't have to do it each step */
|
||||
node->output[0] = *node_data * DSS_INPUT__GAIN + DSS_INPUT__OFFSET;
|
||||
#else
|
||||
*node_data = new_data;
|
||||
/* Bring the system up to now */
|
||||
stream_update_background(info->discrete_stream, disc_cb, (void *) node, *node_data);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
discrete_log("discrete_sound_w write to non-existent NODE_%02d\n", offset-NODE_00);
|
||||
discrete_log(info, "discrete_sound_w write to non-existent NODE_%02d\n", offset-NODE_00);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,12 +172,12 @@ static DISCRETE_RESET(dss_adjustment)
|
||||
|
||||
if (node->custom)
|
||||
{
|
||||
context->port = input_port_by_tag(device->machine->portconfig, (const char *)node->custom);
|
||||
context->port = input_port_by_tag(disc_info->device->machine->portconfig, (const char *)node->custom);
|
||||
if (context->port == NULL)
|
||||
fatalerror("DISCRETE_ADJUSTMENT_TAG - NODE_%d has invalid tag", node->node-NODE_00);
|
||||
}
|
||||
else
|
||||
context->port = input_port_by_index(device->machine->portconfig, DSS_ADJUSTMENT__PORT);
|
||||
context->port = input_port_by_index(disc_info->device->machine->portconfig, DSS_ADJUSTMENT__PORT);
|
||||
|
||||
context->lastpval = 0x7fffffff;
|
||||
context->pmin = DSS_ADJUSTMENT__PMIN;
|
||||
@ -270,6 +287,6 @@ static DISCRETE_RESET(dss_input_stream)
|
||||
{
|
||||
int istream = DSS_INPUT_STREAM__STREAM;
|
||||
/* we will use the node's context pointer to point to the input stream data */
|
||||
assert(istream < discrete_current_context->discrete_input_streams);
|
||||
node->context = &discrete_current_context->input_stream_data[istream];
|
||||
assert(istream < disc_info->discrete_input_streams);
|
||||
node->context = (discrete_info *) &disc_info->input_stream_data[istream];
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ static DISCRETE_STEP(dst_dac_r1)
|
||||
struct dst_dac_r1_context *context = (struct dst_dac_r1_context *)node->context;
|
||||
|
||||
int bit, bit_val, data;
|
||||
double v, i_bit, i_total, x_time;
|
||||
double v, i_bit, i_total, x_time, von;
|
||||
|
||||
i_total = context->i_bias;
|
||||
|
||||
@ -311,6 +311,7 @@ static DISCRETE_STEP(dst_dac_r1)
|
||||
|
||||
if (DST_DAC_R1__ENABLE)
|
||||
{
|
||||
von = DST_DAC_R1__VON;
|
||||
for (bit=0; bit < info->ladderLength; bit++)
|
||||
{
|
||||
/* Add up currents of ON circuits per Millman. */
|
||||
@ -318,10 +319,10 @@ static DISCRETE_STEP(dst_dac_r1)
|
||||
/* ignore if no resistor present */
|
||||
if (info->r[bit] != 0)
|
||||
{
|
||||
i_bit = DST_DAC_R1__VON / info->r[bit];
|
||||
i_bit = von / info->r[bit];
|
||||
bit_val = (data >> bit) & 0x01;
|
||||
|
||||
if ((x_time != 0) && (bit_val != ((context->last_data >> bit) & 0x01)))
|
||||
if ((x_time != 0.0) && (bit_val != ((context->last_data >> bit) & 0x01)))
|
||||
{
|
||||
/* there is x_time and a change in bit,
|
||||
* so anti-alias the current */
|
||||
@ -331,9 +332,10 @@ static DISCRETE_STEP(dst_dac_r1)
|
||||
{
|
||||
/* there is no x_time or a change in bit,
|
||||
* so 0 the current if the bit value is 0 */
|
||||
if (bit_val == 0) i_bit = 0;
|
||||
if (bit_val == 0)
|
||||
i_bit = 0;
|
||||
}
|
||||
i_total += i_bit;
|
||||
i_total += i_bit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,11 +376,11 @@ static DISCRETE_RESET(dst_dac_r1)
|
||||
if (info->ladderLength < 2)
|
||||
{
|
||||
/* You need at least 2 resistors for a ladder */
|
||||
discrete_log("dst_dac_r1_reset - Ladder length too small");
|
||||
discrete_log(disc_info, "dst_dac_r1_reset - Ladder length too small");
|
||||
}
|
||||
if (info->ladderLength > DISC_LADDER_MAXRES )
|
||||
{
|
||||
discrete_log("dst_dac_r1_reset - Ladder length exceeds DISC_LADDER_MAXRES");
|
||||
discrete_log(disc_info, "dst_dac_r1_reset - Ladder length exceeds DISC_LADDER_MAXRES");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -481,7 +483,7 @@ static DISCRETE_STEP(dst_divide)
|
||||
if(DST_DIVIDE__DIV == 0)
|
||||
{
|
||||
node->output[0 ]= DBL_MAX; /* Max out but don't break */
|
||||
discrete_log("dst_divider_step() - Divide by Zero attempted in NODE_%02d.\n",NODE_INDEX(node->node));
|
||||
discrete_log(disc_info, "dst_divider_step() - Divide by Zero attempted in NODE_%02d.\n",NODE_INDEX(node->node));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -599,7 +601,7 @@ static DISCRETE_STEP(dst_integrate)
|
||||
i_neg = context->v_max_in / info->r1;
|
||||
i_pos = (DST_INTEGRATE__TRG0 - OP_AMP_NORTON_VBE) / info->r2;
|
||||
if (i_pos < 0) i_pos = 0;
|
||||
node->output[0] += (i_pos - i_neg) / discrete_current_context->sample_rate / info->c;
|
||||
node->output[0] += (i_pos - i_neg) / disc_info->sample_rate / info->c;
|
||||
break;
|
||||
|
||||
case DISC_INTEGRATE_OP_AMP_2 | DISC_OP_AMP_IS_NORTON:
|
||||
@ -608,7 +610,7 @@ static DISCRETE_STEP(dst_integrate)
|
||||
i_neg = dst_trigger_function(trig0, trig1, 0, info->f0) ? context->v_max_in_d / info->r1 : 0;
|
||||
i_pos = dst_trigger_function(trig0, trig1, 0, info->f1) ? context->v_max_in / info->r2 : 0;
|
||||
i_pos += dst_trigger_function(trig0, trig1, 0, info->f2) ? context->v_max_in_d / info->r3 : 0;
|
||||
node->output[0] += (i_pos - i_neg) / discrete_current_context->sample_rate / info->c;
|
||||
node->output[0] += (i_pos - i_neg) / disc_info->sample_rate / info->c;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -636,7 +638,7 @@ static DISCRETE_RESET(dst_integrate)
|
||||
v = info->v1 * info->r3 / (info->r2 + info->r3); /* vRef */
|
||||
v = info->v1 - v; /* actual charging voltage */
|
||||
i = v / info->r1;
|
||||
context->change = i / discrete_current_context->sample_rate / info->c;
|
||||
context->change = i / disc_info->sample_rate / info->c;
|
||||
}
|
||||
node->output[0] = 0;
|
||||
}
|
||||
@ -1179,7 +1181,7 @@ static DISCRETE_RESET(dst_mixer)
|
||||
context->r_node_bit_flag = 0;
|
||||
for (bit = 0; bit < 8; bit++)
|
||||
{
|
||||
r_node = discrete_find_node(NULL, info->r_node[bit]);
|
||||
r_node = discrete_find_node(disc_info, info->r_node[bit]);
|
||||
if (r_node != NULL)
|
||||
{
|
||||
context->r_node[bit] = &(r_node->output[NODE_CHILD_NODE_NUM(info->r_node[bit])]);
|
||||
@ -1306,7 +1308,7 @@ static DISCRETE_STEP(dst_multiplex)
|
||||
else
|
||||
{
|
||||
/* Bad address. We will leave the output alone. */
|
||||
discrete_log("NODE_%02d - Address = %d. Out of bounds\n", node->node-NODE_00, addr);
|
||||
discrete_log(disc_info, "NODE_%02d - Address = %d. Out of bounds\n", node->node-NODE_00, addr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1391,7 +1393,7 @@ static DISCRETE_STEP(dst_oneshot)
|
||||
|
||||
if (do_count)
|
||||
{
|
||||
context->countdown -= discrete_current_context->sample_time;
|
||||
context->countdown -= disc_info->sample_time;
|
||||
if(context->countdown <= 0.0)
|
||||
{
|
||||
node->output[0] = (DST_ONESHOT__TYPE & DISC_OUT_ACTIVE_LOW) ? DST_ONESHOT__AMP : 0;
|
||||
@ -1466,7 +1468,7 @@ static DISCRETE_RESET(dst_ramp)
|
||||
struct dss_ramp_context *context = (struct dss_ramp_context *)node->context;
|
||||
|
||||
node->output[0] = DST_RAMP__CLAMP;
|
||||
context->step = DST_RAMP__GRAD / discrete_current_context->sample_rate;
|
||||
context->step = DST_RAMP__GRAD / disc_info->sample_rate;
|
||||
context->dir = ((DST_RAMP__END - DST_RAMP__START) == abs(DST_RAMP__END - DST_RAMP__START));
|
||||
context->last_en = 0;
|
||||
}
|
||||
@ -1512,7 +1514,7 @@ static DISCRETE_STEP(dst_samphold)
|
||||
if (DST_SAMPHOLD__CLOCK == 0) node->output[0] = DST_SAMPHOLD__IN0;
|
||||
break;
|
||||
default:
|
||||
discrete_log("dst_samphold_step - Invalid clocktype passed");
|
||||
discrete_log(disc_info, "dst_samphold_step - Invalid clocktype passed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1714,7 +1716,7 @@ static DISCRETE_STEP(dst_transform)
|
||||
top = (int)number1 ^ (int)top;
|
||||
break;
|
||||
default:
|
||||
discrete_log("dst_transform_step - Invalid function type/variable passed");
|
||||
discrete_log(disc_info, "dst_transform_step - Invalid function type/variable passed");
|
||||
node->output[0] = 0;
|
||||
break;
|
||||
}
|
||||
@ -1821,7 +1823,7 @@ static DISCRETE_RESET(dst_op_amp)
|
||||
}
|
||||
else
|
||||
/* linear charge */
|
||||
context->exponent = discrete_current_context->sample_rate * info->c;
|
||||
context->exponent = disc_info->sample_rate * info->c;
|
||||
}
|
||||
|
||||
if (info->r3 >= 0)
|
||||
|
@ -197,10 +197,10 @@ static DISCRETE_STEP(dss_counter)
|
||||
if (context->clock_type == DISC_CLK_IS_FREQ)
|
||||
{
|
||||
/* We need to keep clocking the internal clock even if disabled. */
|
||||
cycles = (context->t_left + discrete_current_context->sample_time) / context->t_clock;
|
||||
cycles = (context->t_left + disc_info->sample_time) / context->t_clock;
|
||||
inc = (int)cycles;
|
||||
context->t_left = (cycles - inc) * context->t_clock;
|
||||
if (inc) x_time = context->t_left / discrete_current_context->sample_time;
|
||||
if (inc) x_time = context->t_left / disc_info->sample_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -326,7 +326,7 @@ static DISCRETE_RESET(dss_counter)
|
||||
#define DSS_LFSR_NOISE__FEED (*(node->input[4]))
|
||||
#define DSS_LFSR_NOISE__BIAS (*(node->input[5]))
|
||||
|
||||
static int dss_lfsr_function(int myfunc, int in0, int in1, int bitmask)
|
||||
INLINE int dss_lfsr_function(const discrete_info *disc_info, int myfunc, int in0, int in1, int bitmask)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@ -381,7 +381,7 @@ static int dss_lfsr_function(int myfunc, int in0, int in1, int bitmask)
|
||||
retval = retval ^ in0; /* xor in0 */
|
||||
break;
|
||||
default:
|
||||
discrete_log("dss_lfsr_function - Invalid function type passed");
|
||||
discrete_log(disc_info, "dss_lfsr_function - Invalid function type passed");
|
||||
retval=0;
|
||||
break;
|
||||
}
|
||||
@ -402,7 +402,7 @@ static DISCRETE_STEP(dss_lfsr)
|
||||
if (lfsr_desc->clock_type == DISC_CLK_IS_FREQ)
|
||||
{
|
||||
/* We need to keep clocking the internal clock even if disabled. */
|
||||
cycles = (context->t_left + discrete_current_context->sample_time) / context->t_clock;
|
||||
cycles = (context->t_left + disc_info->sample_time) / context->t_clock;
|
||||
inc = (int)cycles;
|
||||
context->t_left = (cycles - inc) * context->t_clock;
|
||||
}
|
||||
@ -443,22 +443,22 @@ static DISCRETE_STEP(dss_lfsr)
|
||||
fbresult = (context->lfsr_reg >> lfsr_desc->bitlength) & 0x01;
|
||||
|
||||
/* Stage 2 feedback combine fbresultNew with infeed bit */
|
||||
fbresult = dss_lfsr_function(lfsr_desc->feedback_function1, fbresult, (DSS_LFSR_NOISE__FEED ? 0x01 : 0x00), 0x01);
|
||||
fbresult = dss_lfsr_function(disc_info, lfsr_desc->feedback_function1, fbresult, (DSS_LFSR_NOISE__FEED ? 0x01 : 0x00), 0x01);
|
||||
|
||||
/* Stage 3 first we setup where the bit is going to be shifted into */
|
||||
fbresult = fbresult * lfsr_desc->feedback_function2_mask;
|
||||
/* Then we left shift the register, */
|
||||
context->lfsr_reg = context->lfsr_reg << 1;
|
||||
/* Now move the fbresult into the shift register and mask it to the bitlength */
|
||||
context->lfsr_reg = dss_lfsr_function(lfsr_desc->feedback_function2, fbresult, context->lfsr_reg, (1 << lfsr_desc->bitlength) - 1 );
|
||||
context->lfsr_reg = dss_lfsr_function(disc_info, lfsr_desc->feedback_function2, fbresult, context->lfsr_reg, (1 << lfsr_desc->bitlength) - 1 );
|
||||
|
||||
/* Now get and store the new feedback result */
|
||||
/* Fetch the feedback bits */
|
||||
fb0 = (context->lfsr_reg >> lfsr_desc->feedback_bitsel0) & 0x01;
|
||||
fb1 = (context->lfsr_reg >> lfsr_desc->feedback_bitsel1) & 0x01;
|
||||
/* Now do the combo on them */
|
||||
fbresult = dss_lfsr_function(lfsr_desc->feedback_function0, fb0, fb1, 0x01);
|
||||
context->lfsr_reg = dss_lfsr_function(DISC_LFSR_REPLACE, context->lfsr_reg, fbresult << lfsr_desc->bitlength, (2 << lfsr_desc->bitlength) - 1);
|
||||
fbresult = dss_lfsr_function(disc_info, lfsr_desc->feedback_function0, fb0, fb1, 0x01);
|
||||
context->lfsr_reg = dss_lfsr_function(disc_info, DISC_LFSR_REPLACE, context->lfsr_reg, fbresult << lfsr_desc->bitlength, (2 << lfsr_desc->bitlength) - 1);
|
||||
|
||||
/* Now select the output bit */
|
||||
if (context->out_is_f0)
|
||||
@ -492,7 +492,8 @@ static DISCRETE_RESET(dss_lfsr)
|
||||
context->out_is_f0 = (lfsr_desc->flags & DISC_LFSR_FLAG_OUTPUT_F0) ? 1 : 0;
|
||||
|
||||
if ((lfsr_desc->clock_type < DISC_CLK_ON_F_EDGE) || (lfsr_desc->clock_type > DISC_CLK_IS_FREQ))
|
||||
discrete_log("Invalid clock type passed in NODE_%d\n", NODE_INDEX(node->node));
|
||||
discrete_log(disc_info, "Invalid clock type passed in NODE_%d\n", NODE_INDEX(node->node));
|
||||
|
||||
context->last = (DSS_COUNTER__CLOCK != 0);
|
||||
if (lfsr_desc->clock_type == DISC_CLK_IS_FREQ) context->t_clock = 1.0 / DSS_LFSR_NOISE__CLOCK;
|
||||
context->t_left = 0;
|
||||
@ -504,8 +505,8 @@ static DISCRETE_RESET(dss_lfsr)
|
||||
fb0 = (context->lfsr_reg >> lfsr_desc->feedback_bitsel0) & 0x01;
|
||||
fb1=(context->lfsr_reg >> lfsr_desc->feedback_bitsel1) & 0x01;
|
||||
/* Now do the combo on them */
|
||||
fbresult = dss_lfsr_function(lfsr_desc->feedback_function0, fb0, fb1, 0x01);
|
||||
context->lfsr_reg=dss_lfsr_function(DISC_LFSR_REPLACE, context->lfsr_reg, fbresult << lfsr_desc->bitlength, (2<< lfsr_desc->bitlength ) - 1);
|
||||
fbresult = dss_lfsr_function(disc_info, lfsr_desc->feedback_function0, fb0, fb1, 0x01);
|
||||
context->lfsr_reg=dss_lfsr_function(disc_info, DISC_LFSR_REPLACE, context->lfsr_reg, fbresult << lfsr_desc->bitlength, (2<< lfsr_desc->bitlength ) - 1);
|
||||
|
||||
/* Now select and setup the output bit */
|
||||
node->output[0] = (context->lfsr_reg >> lfsr_desc->output_bit) & 0x01;
|
||||
@ -545,7 +546,7 @@ static DISCRETE_STEP(dss_noise)
|
||||
if(context->phase > (2.0 * M_PI))
|
||||
{
|
||||
/* GCC's rand returns a RAND_MAX value of 0x7fff */
|
||||
int newval = (mame_rand(device->machine) & 0x7fff) - 16384;
|
||||
int newval = (mame_rand(disc_info->device->machine) & 0x7fff) - 16384;
|
||||
|
||||
/* make sure the peak to peak values are the amplitude */
|
||||
node->output[0] = DSS_NOISE__AMP / 2;
|
||||
@ -568,7 +569,7 @@ static DISCRETE_STEP(dss_noise)
|
||||
|
||||
/* The enable input only curtails output, phase rotation still occurs. */
|
||||
/* We allow the phase to exceed 2Pi here, so we can tell when to sample the noise. */
|
||||
context->phase += ((2.0 * M_PI * DSS_NOISE__FREQ) / discrete_current_context->sample_rate);
|
||||
context->phase += ((2.0 * M_PI * DSS_NOISE__FREQ) / disc_info->sample_rate);
|
||||
}
|
||||
|
||||
|
||||
@ -612,10 +613,10 @@ static DISCRETE_STEP(dss_note)
|
||||
if (context->clock_type == DISC_CLK_IS_FREQ)
|
||||
{
|
||||
/* We need to keep clocking the internal clock even if disabled. */
|
||||
cycles = (context->t_left + discrete_current_context->sample_time) / context->t_clock;
|
||||
cycles = (context->t_left + disc_info->sample_time) / context->t_clock;
|
||||
inc = (int)cycles;
|
||||
context->t_left = (cycles - inc) * context->t_clock;
|
||||
if (inc) x_time = context->t_left / discrete_current_context->sample_time;
|
||||
if (inc) x_time = context->t_left / disc_info->sample_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -745,7 +746,7 @@ static DISCRETE_STEP(dss_op_amp_osc)
|
||||
UINT8 force_charge = 0;
|
||||
UINT8 enable = DSS_OP_AMP_OSC__ENABLE;
|
||||
|
||||
dt = discrete_current_context->sample_time; /* Change in time */
|
||||
dt = disc_info->sample_time; /* Change in time */
|
||||
vC = context->v_cap; /* Set to voltage before change */
|
||||
|
||||
/* work out the charge currents for the VCOs. */
|
||||
@ -922,7 +923,7 @@ static DISCRETE_RESET(dss_op_amp_osc)
|
||||
{
|
||||
if IS_VALUE_A_NODE(*r_info_ptr)
|
||||
{
|
||||
r_node = discrete_find_node(NULL, *r_info_ptr);
|
||||
r_node = discrete_find_node(disc_info, *r_info_ptr);
|
||||
*r_context_ptr = &(r_node->output[NODE_CHILD_NODE_NUM((int)*r_info_ptr)]);
|
||||
}
|
||||
else
|
||||
@ -1069,7 +1070,7 @@ static DISCRETE_STEP(dss_sawtoothwave)
|
||||
/* boils out to */
|
||||
/* phase step = (2Pi*output freq)/sample freq) */
|
||||
/* Also keep the new phasor in the 2Pi range. */
|
||||
context->phase = fmod((context->phase + ((2.0 * M_PI * DSS_SAWTOOTHWAVE__FREQ) / discrete_current_context->sample_rate)), 2.0 * M_PI);
|
||||
context->phase = fmod((context->phase + ((2.0 * M_PI * DSS_SAWTOOTHWAVE__FREQ) / disc_info->sample_rate)), 2.0 * M_PI);
|
||||
}
|
||||
|
||||
static DISCRETE_RESET(dss_sawtoothwave)
|
||||
@ -1248,7 +1249,7 @@ static DISCRETE_STEP(dss_sinewave)
|
||||
/* boils out to */
|
||||
/* phase step = (2Pi*output freq)/sample freq) */
|
||||
/* Also keep the new phasor in the 2Pi range. */
|
||||
context->phase=fmod((context->phase + ((2.0 * M_PI * DSS_SINEWAVE__FREQ) / discrete_current_context->sample_rate)), 2.0 * M_PI);
|
||||
context->phase=fmod((context->phase + ((2.0 * M_PI * DSS_SINEWAVE__FREQ) / disc_info->sample_rate)), 2.0 * M_PI);
|
||||
}
|
||||
|
||||
static DISCRETE_RESET(dss_sinewave)
|
||||
@ -1314,7 +1315,7 @@ static DISCRETE_STEP(dss_squarewave)
|
||||
/* boils out to */
|
||||
/* phase step = (2Pi*output freq)/sample freq) */
|
||||
/* Also keep the new phasor in the 2Pi range. */
|
||||
context->phase=fmod(context->phase + ((2.0 * M_PI * DSS_SQUAREWAVE__FREQ) / discrete_current_context->sample_rate), 2.0 * M_PI);
|
||||
context->phase=fmod(context->phase + ((2.0 * M_PI * DSS_SQUAREWAVE__FREQ) / disc_info->sample_rate), 2.0 * M_PI);
|
||||
}
|
||||
|
||||
static DISCRETE_RESET(dss_squarewave)
|
||||
@ -1383,7 +1384,7 @@ static DISCRETE_RESET(dss_squarewfix)
|
||||
{
|
||||
struct dss_squarewfix_context *context = (struct dss_squarewfix_context *)node->context;
|
||||
|
||||
context->sample_step = 1.0 / discrete_current_context->sample_rate;
|
||||
context->sample_step = 1.0 / disc_info->sample_rate;
|
||||
context->flip_flop = 1;
|
||||
|
||||
/* Do the intial time shift and convert freq to off/on times */
|
||||
@ -1445,7 +1446,7 @@ static DISCRETE_STEP(dss_squarewave2)
|
||||
/* phase step = 2Pi/(output period/sample period) */
|
||||
/* boils out to */
|
||||
/* phase step = 2Pi/(output period*sample freq) */
|
||||
newphase = context->phase + ((2.0 * M_PI) / ((DSS_SQUAREWAVE2__T_OFF + DSS_SQUAREWAVE2__T_ON) * discrete_current_context->sample_rate));
|
||||
newphase = context->phase + ((2.0 * M_PI) / ((DSS_SQUAREWAVE2__T_OFF + DSS_SQUAREWAVE2__T_ON) * disc_info->sample_rate));
|
||||
/* Keep the new phasor in the 2Pi range.*/
|
||||
context->phase = fmod(newphase, 2.0 * M_PI);
|
||||
|
||||
@ -1598,7 +1599,7 @@ static DISCRETE_STEP(dss_inverter_osc)
|
||||
vMix = rMix* ( (vG3-vG2) / context->r1 + (DSS_INVERTER_OSC__MOD-vG2) / context->r2 + (vI-0.7-vG2)/context->rp);
|
||||
}
|
||||
diff = vMix - context->v_cap;
|
||||
diff = diff - diff * exp(-discrete_current_context->sample_time / (context->c * rMix));
|
||||
diff = diff - diff * exp(-disc_info->sample_time / (context->c * rMix));
|
||||
break;
|
||||
case DISC_OSC_INVERTER_IS_TYPE5:
|
||||
if ((info->clamp >= 0.0) && ((vI< - info->clamp) || (vI> info->vB+info->clamp)))
|
||||
@ -1616,7 +1617,7 @@ static DISCRETE_STEP(dss_inverter_osc)
|
||||
vMix = rMix* ( (vG3 - vG2) / context->r1 + (DSS_INVERTER_OSC__MOD-vG2) / context->r2 + (vI+0.7-vG2)/context->rp);
|
||||
}
|
||||
diff = vMix - context->v_cap;
|
||||
diff = diff - diff * exp(-discrete_current_context->sample_time/(context->c * rMix));
|
||||
diff = diff - diff * exp(-disc_info->sample_time/(context->c * rMix));
|
||||
break;
|
||||
default:
|
||||
fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", node->node - NODE_00);
|
||||
@ -1639,8 +1640,8 @@ static DISCRETE_RESET(dss_inverter_osc)
|
||||
int i;
|
||||
|
||||
/* exponent */
|
||||
context->w = exp(-discrete_current_context->sample_time / (DSS_INVERTER_OSC__RC * DSS_INVERTER_OSC__C));
|
||||
context->wc = exp(-discrete_current_context->sample_time / ((DSS_INVERTER_OSC__RC * DSS_INVERTER_OSC__RP) / (DSS_INVERTER_OSC__RP + DSS_INVERTER_OSC__RC) * DSS_INVERTER_OSC__C));
|
||||
context->w = exp(-disc_info->sample_time / (DSS_INVERTER_OSC__RC * DSS_INVERTER_OSC__C));
|
||||
context->wc = exp(-disc_info->sample_time / ((DSS_INVERTER_OSC__RC * DSS_INVERTER_OSC__RP) / (DSS_INVERTER_OSC__RP + DSS_INVERTER_OSC__RC) * DSS_INVERTER_OSC__C));
|
||||
node->output[0] = 0;
|
||||
context->v_cap = 0;
|
||||
context->v_g2_old = 0;
|
||||
@ -1699,7 +1700,7 @@ static DISCRETE_STEP(dss_trianglewave)
|
||||
/* boils out to */
|
||||
/* phase step = (2Pi*output freq)/sample freq) */
|
||||
/* Also keep the new phasor in the 2Pi range. */
|
||||
context->phase=fmod((context->phase + ((2.0 * M_PI * DSS_TRIANGLEWAVE__FREQ) / discrete_current_context->sample_rate)), 2.0 * M_PI);
|
||||
context->phase=fmod((context->phase + ((2.0 * M_PI * DSS_TRIANGLEWAVE__FREQ) / disc_info->sample_rate)), 2.0 * M_PI);
|
||||
}
|
||||
|
||||
static DISCRETE_RESET(dss_trianglewave)
|
||||
|
@ -51,11 +51,11 @@
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Global variables
|
||||
* Profiling Nodes
|
||||
*
|
||||
*************************************/
|
||||
|
||||
discrete_info *discrete_current_context = NULL;
|
||||
#define DISCRETE_PROFILING (0)
|
||||
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ static void init_nodes(discrete_info *info, discrete_sound_block *block_list, co
|
||||
static void find_input_nodes(discrete_info *info, discrete_sound_block *block_list);
|
||||
static void setup_output_nodes(const device_config *device, discrete_info *info);
|
||||
static void setup_disc_logs(discrete_info *info);
|
||||
static node_description *discrete_find_node(const discrete_info *info, int node);
|
||||
static DEVICE_RESET( discrete );
|
||||
|
||||
|
||||
@ -79,17 +80,17 @@ static DEVICE_RESET( discrete );
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void CLIB_DECL ATTR_PRINTF(1,2) discrete_log(const char *text, ...)
|
||||
static void CLIB_DECL ATTR_PRINTF(2,3) discrete_log(const discrete_info *disc_info, const char *text, ...)
|
||||
{
|
||||
if (DISCRETE_DEBUGLOG)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, text);
|
||||
|
||||
if(discrete_current_context->disclogfile)
|
||||
if(disc_info->disclogfile)
|
||||
{
|
||||
vfprintf(discrete_current_context->disclogfile, text, arg);
|
||||
fprintf(discrete_current_context->disclogfile, "\n");
|
||||
vfprintf(disc_info->disclogfile, text, arg);
|
||||
fprintf(disc_info->disclogfile, "\n");
|
||||
}
|
||||
|
||||
va_end(arg);
|
||||
@ -123,7 +124,11 @@ static const discrete_module module_list[] =
|
||||
{ DSO_OUTPUT ,"DSO_OUTPUT" , 0 ,0 ,NULL ,NULL },
|
||||
{ DSO_CSVLOG ,"DSO_CSVLOG" , 0 ,0 ,NULL ,NULL },
|
||||
{ DSO_WAVELOG ,"DSO_WAVELOG" , 0 ,0 ,NULL ,NULL },
|
||||
{ DSO_IMPORT ,"DSO_IMPORT" , 0 ,0 ,NULL ,NULL },
|
||||
|
||||
/* nop */
|
||||
{ DSS_NOP ,"DSS_NOP" , 0 ,0 ,NULL ,NULL },
|
||||
|
||||
/* from disc_inp.c */
|
||||
{ DSS_ADJUSTMENT ,"DSS_ADJUSTMENT" , 1 ,sizeof(struct dss_adjustment_context) ,dss_adjustment_reset ,dss_adjustment_step },
|
||||
{ DSS_CONSTANT ,"DSS_CONSTANT" , 1 ,0 ,dss_constant_reset ,NULL },
|
||||
@ -230,14 +235,78 @@ static const discrete_module module_list[] =
|
||||
*
|
||||
*************************************/
|
||||
|
||||
node_description *discrete_find_node(void *chip, int node)
|
||||
static node_description *discrete_find_node(const discrete_info *info, int node)
|
||||
{
|
||||
discrete_info *info = chip ? (discrete_info *)chip : discrete_current_context;
|
||||
if (node < NODE_START || node > NODE_END) return NULL;
|
||||
return info->indexed_node[NODE_INDEX(node)];
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Build import list
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static int discrete_build_list(discrete_info *info, discrete_sound_block *intf, discrete_sound_block *out, int offset)
|
||||
{
|
||||
int node_count = 0;
|
||||
|
||||
for (; intf[node_count].type != DSS_NULL; )
|
||||
{
|
||||
/* scan imported */
|
||||
if (intf[node_count].type == DSO_IMPORT)
|
||||
{
|
||||
offset = discrete_build_list(info, (discrete_sound_block *) intf[node_count].custom, out, offset);
|
||||
}
|
||||
else if (intf[node_count].type == DSO_REPLACE)
|
||||
{
|
||||
int i;
|
||||
|
||||
node_count++;
|
||||
if (intf[node_count].type == DSS_NULL)
|
||||
fatalerror("discrete_build_list: DISCRETE_REPLACE at end of node_list");
|
||||
|
||||
for (i = 0; i < offset; i++)
|
||||
if (out[i].type != NODE_SPECIAL )
|
||||
if (out[i].node == intf[node_count].node)
|
||||
{
|
||||
out[i] = intf[node_count];
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= offset)
|
||||
fatalerror("discrete_build_list: DISCRETE_REPLACE did not found node %d", NODE_INDEX(intf[node_count].node));
|
||||
|
||||
}
|
||||
else if (intf[node_count].type == DSO_DELETE)
|
||||
{
|
||||
int i,p,deleted;
|
||||
|
||||
p = 0;
|
||||
deleted = 0;
|
||||
for (i = 0; i < offset; i++)
|
||||
{
|
||||
if ((out[i].node >= intf[node_count].input_node[0]) &&
|
||||
(out[i].node <= intf[node_count].input_node[1]))
|
||||
{
|
||||
discrete_log(info, "discrete_build_list() - DISCRETE_DELETE deleted NODE_%02d", NODE_INDEX(out[i].node) );
|
||||
deleted++;
|
||||
}
|
||||
else
|
||||
{
|
||||
out[p++] = out[i];
|
||||
}
|
||||
}
|
||||
offset -= deleted;
|
||||
}
|
||||
else
|
||||
out[offset++] = intf[node_count];
|
||||
|
||||
node_count++;
|
||||
}
|
||||
out[offset] = intf[node_count];
|
||||
return offset;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -247,7 +316,8 @@ node_description *discrete_find_node(void *chip, int node)
|
||||
|
||||
static DEVICE_START( discrete )
|
||||
{
|
||||
discrete_sound_block *intf = (discrete_sound_block *)device->static_config;
|
||||
discrete_sound_block *intf;
|
||||
discrete_sound_block *intf_start = (discrete_sound_block *)device->static_config;
|
||||
discrete_info *info = get_safe_token(device);
|
||||
char name[32];
|
||||
|
||||
@ -260,16 +330,20 @@ static DEVICE_START( discrete )
|
||||
info->sample_rate = device->machine->sample_rate;
|
||||
info->sample_time = 1.0 / info->sample_rate;
|
||||
info->neg_sample_time = - info->sample_time;
|
||||
|
||||
info->total_samples = 0;
|
||||
|
||||
/* create the logfile */
|
||||
sprintf(name, "discrete%s.log", device->tag);
|
||||
if (DISCRETE_DEBUGLOG && !info->disclogfile)
|
||||
info->disclogfile = fopen(name, "w");
|
||||
|
||||
discrete_current_context = info;
|
||||
|
||||
/* Build the final block list */
|
||||
intf = auto_alloc_array_clear(device->machine, discrete_sound_block, DISCRETE_MAX_NODES);
|
||||
discrete_build_list(info, intf_start, intf, 0);
|
||||
|
||||
/* first pass through the nodes: sanity check, fill in the indexed_nodes, and make a total count */
|
||||
discrete_log("discrete_start() - Doing node list sanity check");
|
||||
discrete_log(info, "discrete_start() - Doing node list sanity check");
|
||||
for (info->node_count = 0; intf[info->node_count].type != DSS_NULL; info->node_count++)
|
||||
{
|
||||
/* make sure we don't have too many nodes overall */
|
||||
@ -289,7 +363,7 @@ static DEVICE_START( discrete )
|
||||
fatalerror("discrete_start() - Child node number on NODE_%02d", NODE_INDEX(intf[info->node_count].node) );
|
||||
}
|
||||
info->node_count++;
|
||||
discrete_log("discrete_start() - Sanity check counted %d nodes", info->node_count);
|
||||
discrete_log(info, "discrete_start() - Sanity check counted %d nodes", info->node_count);
|
||||
|
||||
/* allocate memory for the array of actual nodes */
|
||||
info->node_list = auto_alloc_array_clear(device->machine, node_description, info->node_count);
|
||||
@ -310,8 +384,6 @@ static DEVICE_START( discrete )
|
||||
setup_output_nodes(device, info);
|
||||
|
||||
setup_disc_logs(info);
|
||||
|
||||
discrete_current_context = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -327,12 +399,13 @@ static DEVICE_STOP( discrete )
|
||||
discrete_info *info = get_safe_token(device);
|
||||
int log_num;
|
||||
|
||||
#if (DISCRETE_PROFILING)
|
||||
if (DISCRETE_PROFILING)
|
||||
{
|
||||
int nodenum;
|
||||
osd_ticks_t total = 0;
|
||||
osd_ticks_t tresh;
|
||||
|
||||
printf("Total Samples: %d\n", info->total_samples);
|
||||
/* calculate total time */
|
||||
for (nodenum = 0; nodenum < info->node_count; nodenum++)
|
||||
{
|
||||
@ -348,12 +421,9 @@ static DEVICE_STOP( discrete )
|
||||
node_description *node = info->running_order[nodenum];
|
||||
|
||||
if (node->run_time > tresh)
|
||||
printf("%3d: %20s %8.2f\n", NODE_INDEX(node->node), node->module.name, (float) node->run_time / (float) total * 100.0);
|
||||
/* Now step the node */
|
||||
total += node->run_time;
|
||||
printf("%3d: %20s %8.2f %10d\n", NODE_INDEX(node->node), node->module.name, (float) node->run_time / (float) total * 100.0, ((int) node->run_time) / info->total_samples);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* close any csv files */
|
||||
for (log_num = 0; log_num < info->num_csvlogs; log_num++)
|
||||
@ -387,8 +457,6 @@ static DEVICE_RESET( discrete )
|
||||
discrete_info *info = get_safe_token(device);
|
||||
int nodenum;
|
||||
|
||||
discrete_current_context = info;
|
||||
|
||||
/* loop over all nodes */
|
||||
for (nodenum = 0; nodenum < info->node_count; nodenum++)
|
||||
{
|
||||
@ -398,18 +466,94 @@ static DEVICE_RESET( discrete )
|
||||
|
||||
/* if the node has a reset function, call it */
|
||||
if (node->module.reset)
|
||||
(*node->module.reset)(device, node);
|
||||
(*node->module.reset)(info, node);
|
||||
|
||||
/* otherwise, just step it */
|
||||
else if (node->module.step)
|
||||
(*node->module.step)(device, node);
|
||||
(*node->module.step)(info, node);
|
||||
}
|
||||
|
||||
discrete_current_context = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This was a try which unfortunately did not provide
|
||||
* any improvement. Left here for reference
|
||||
*/
|
||||
#if 0
|
||||
INLINE void bigselect(const device_config *device, node_description *node)
|
||||
{
|
||||
switch (node->module.type)
|
||||
{
|
||||
case DSS_ADJUSTMENT : dss_adjustment_step(device, node); break;
|
||||
case DSS_INPUT_PULSE : dss_input_pulse_step(device, node); break;
|
||||
case DSS_INPUT_STREAM: dss_input_stream_step(device, node); break;
|
||||
case DSS_COUNTER : dss_counter_step(device, node); break;
|
||||
case DSS_LFSR_NOISE : dss_lfsr_step(device, node); break;
|
||||
case DSS_NOISE : dss_noise_step(device, node); break;
|
||||
case DSS_NOTE : dss_note_step(device, node); break;
|
||||
case DSS_SAWTOOTHWAVE: dss_sawtoothwave_step(device, node); break;
|
||||
case DSS_SINEWAVE : dss_sinewave_step(device, node); break;
|
||||
case DSS_SQUAREWAVE : dss_squarewave_step(device, node); break;
|
||||
case DSS_SQUAREWFIX : dss_squarewfix_step(device, node); break;
|
||||
case DSS_SQUAREWAVE2 : dss_squarewave2_step(device, node); break;
|
||||
case DSS_TRIANGLEWAVE: dss_trianglewave_step(device, node); break;
|
||||
case DSS_INVERTER_OSC : dss_inverter_osc_step(device, node); break;
|
||||
case DSS_OP_AMP_OSC : dss_op_amp_osc_step(device, node); break;
|
||||
case DSS_SCHMITT_OSC : dss_schmitt_osc_step(device, node); break;
|
||||
case DSS_ADSR : dss_adsrenv_step(device, node); break;
|
||||
case DST_ADDER : dst_adder_step(device, node); break;
|
||||
case DST_CLAMP : dst_clamp_step(device, node); break;
|
||||
case DST_DIVIDE : dst_divide_step(device, node); break;
|
||||
case DST_GAIN : dst_gain_step(device, node); break;
|
||||
case DST_LOGIC_INV : dst_logic_inv_step(device, node); break;
|
||||
case DST_LOGIC_AND : dst_logic_and_step(device, node); break;
|
||||
case DST_LOGIC_NAND : dst_logic_nand_step(device, node); break;
|
||||
case DST_LOGIC_OR : dst_logic_or_step(device, node); break;
|
||||
case DST_LOGIC_NOR : dst_logic_nor_step(device, node); break;
|
||||
case DST_LOGIC_XOR : dst_logic_xor_step(device, node); break;
|
||||
case DST_LOGIC_NXOR : dst_logic_nxor_step(device, node); break;
|
||||
case DST_LOGIC_DFF : dst_logic_dff_step(device, node); break;
|
||||
case DST_LOGIC_JKFF : dst_logic_jkff_step(device, node); break;
|
||||
case DST_LOOKUP_TABLE: dst_lookup_table_step(device, node); break;
|
||||
case DST_MULTIPLEX : dst_multiplex_step(device, node); break;
|
||||
case DST_ONESHOT : dst_oneshot_step(device, node); break;
|
||||
case DST_RAMP : dst_ramp_step(device, node); break;
|
||||
case DST_SAMPHOLD : dst_samphold_step(device, node); break;
|
||||
case DST_SWITCH : dst_switch_step(device, node); break;
|
||||
case DST_ASWITCH : dst_aswitch_step(device, node); break;
|
||||
case DST_TRANSFORM : dst_transform_step(device, node); break;
|
||||
case DST_COMP_ADDER : dst_comp_adder_step(device, node); break;
|
||||
case DST_DAC_R1 : dst_dac_r1_step(device, node); break;
|
||||
case DST_DIODE_MIX : dst_diode_mix_step(device, node); break;
|
||||
case DST_INTEGRATE : dst_integrate_step(device, node); break;
|
||||
case DST_MIXER : dst_mixer_step(device, node); break;
|
||||
case DST_OP_AMP : dst_op_amp_step(device, node); break;
|
||||
case DST_OP_AMP_1SHT : dst_op_amp_1sht_step(device, node); break;
|
||||
case DST_TVCA_OP_AMP : dst_tvca_op_amp_step(device, node); break;
|
||||
case DST_FILTER1 : dst_filter1_step(device, node); break;
|
||||
case DST_FILTER2 : dst_filter2_step(device, node); break;
|
||||
case DST_SALLEN_KEY : dst_sallen_key_step(device, node); break;
|
||||
case DST_CRFILTER : dst_crfilter_step(device, node); break;
|
||||
case DST_OP_AMP_FILT : dst_op_amp_filt_step(device, node); break;
|
||||
case DST_RCDISC : dst_rcdisc_step(device, node); break;
|
||||
case DST_RCDISC2 : dst_rcdisc2_step(device, node); break;
|
||||
case DST_RCDISC3 : dst_rcdisc3_step(device, node); break;
|
||||
case DST_RCDISC4 : dst_rcdisc4_step(device, node); break;
|
||||
case DST_RCDISC5 : dst_rcdisc5_step(device, node); break;
|
||||
case DST_RCINTEGRATE : dst_rcintegrate_step(device, node); break;
|
||||
case DST_RCDISC_MOD : dst_rcdisc_mod_step(device, node); break;
|
||||
case DST_RCFILTER : dst_rcfilter_step(device, node); break;
|
||||
case DST_RCFILTER_SW : dst_rcfilter_sw_step(device, node); break;
|
||||
case DST_RCFILTERN : dst_filter1_step(device, node); break;
|
||||
case DST_RCDISCN : dst_rcdiscN_step(device, node); break;
|
||||
case DST_RCDISC2N : dst_rcdisc2N_step(device, node); break;
|
||||
case DSD_555_ASTBL : dsd_555_astbl_step(device, node); break;
|
||||
case DSD_555_MSTBL : dsd_555_mstbl_step(device, node); break;
|
||||
case DSD_555_CC : dsd_555_cc_step(device, node); break;
|
||||
case DSD_555_VCO1 : dsd_555_vco1_step(device, node); break;
|
||||
case DSD_566 : dsd_566_step(device, node); break;
|
||||
case DSD_LS624 : dsd_ls624_step(device, node); break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*************************************
|
||||
*
|
||||
* Stream update functions
|
||||
@ -423,8 +567,6 @@ static STREAM_UPDATE( discrete_stream_update )
|
||||
double val;
|
||||
INT16 wave_data_l, wave_data_r;
|
||||
|
||||
discrete_current_context = info;
|
||||
|
||||
/* Setup any input streams */
|
||||
for (nodenum = 0; nodenum < info->discrete_input_streams; nodenum++)
|
||||
{
|
||||
@ -434,20 +576,23 @@ static STREAM_UPDATE( discrete_stream_update )
|
||||
/* Now we must do samples iterations of the node list, one output for each step */
|
||||
for (samplenum = 0; samplenum < samples; samplenum++)
|
||||
{
|
||||
info->total_samples++;
|
||||
/* loop over all nodes */
|
||||
for (nodenum = 0; nodenum < info->node_count; nodenum++)
|
||||
{
|
||||
node_description *node = info->running_order[nodenum];
|
||||
|
||||
/* Now step the node */
|
||||
#if (DISCRETE_PROFILING)
|
||||
node->run_time -= osd_profiling_ticks();
|
||||
#endif
|
||||
if (DISCRETE_PROFILING)
|
||||
node->run_time -= osd_profiling_ticks();
|
||||
|
||||
if (node->module.step)
|
||||
(*node->module.step)(info->device, node);
|
||||
#if (DISCRETE_PROFILING)
|
||||
node->run_time += osd_profiling_ticks();
|
||||
#endif
|
||||
(*node->module.step)(info, node);
|
||||
//bigselect(info->device, node);
|
||||
|
||||
if (DISCRETE_PROFILING)
|
||||
node->run_time += osd_profiling_ticks();
|
||||
|
||||
}
|
||||
|
||||
/* Add gain to the output and put into the buffers */
|
||||
@ -499,7 +644,6 @@ static STREAM_UPDATE( discrete_stream_update )
|
||||
}
|
||||
}
|
||||
|
||||
discrete_current_context = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -665,7 +809,7 @@ static void find_input_nodes(discrete_info *info, discrete_sound_block *block_li
|
||||
/* warn if trying to use a node for an input that can only be static */
|
||||
if IS_VALUE_A_NODE(block->initial[inputnum])
|
||||
{
|
||||
discrete_log("Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_INDEX(node->node), inputnum);
|
||||
discrete_log(info, "Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_INDEX(node->node), inputnum);
|
||||
/* also report it in the error log so it is not missed */
|
||||
logerror("Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_INDEX(node->node), inputnum);
|
||||
}
|
||||
|
@ -3261,13 +3261,13 @@
|
||||
*************************************/
|
||||
|
||||
/* calculate charge exponent using discrete sample time */
|
||||
#define RC_CHARGE_EXP(rc) (1.0 - exp(discrete_current_context->neg_sample_time / (rc)))
|
||||
#define RC_CHARGE_EXP(rc) (1.0 - exp(disc_info->neg_sample_time / (rc)))
|
||||
/* calculate charge exponent using given sample time */
|
||||
#define RC_CHARGE_EXP_DT(rc, dt) (1.0 - exp(-(dt) / (rc)))
|
||||
#define RC_CHARGE_NEG_EXP_DT(rc, dt) (1.0 - exp((dt) / (rc)))
|
||||
|
||||
/* calculate discharge exponent using discrete sample time */
|
||||
#define RC_DISCHARGE_EXP(rc) (exp(discrete_current_context->neg_sample_time / (rc)))
|
||||
#define RC_DISCHARGE_EXP(rc) (exp(disc_info->neg_sample_time / (rc)))
|
||||
/* calculate discharge exponent using given sample time */
|
||||
#define RC_DISCHARGE_EXP_DT(rc, dt) (exp(-(dt) / (rc)))
|
||||
#define RC_DISCHARGE_NEG_EXP_DT(rc, dt) (exp((dt) / (rc)))
|
||||
@ -3281,19 +3281,19 @@
|
||||
#define DISCRETE_STEP_NAME( _func ) _func ## _step
|
||||
#define DISCRETE_RESET_NAME( _func ) _func ## _reset
|
||||
|
||||
#define DISCRETE_STEP(_func) void DISCRETE_STEP_NAME(_func) (const discrete_info *disc_info, node_description *node)
|
||||
#define DISCRETE_RESET(_func) void DISCRETE_RESET_NAME(_func) (const discrete_info *disc_info, node_description *node)
|
||||
|
||||
#define DISCRETE_STEP_CALL(_func) DISCRETE_STEP_NAME(_func) (disc_info, node)
|
||||
#define DISCRETE_RESET_CALL(_func) DISCRETE_RESET_NAME(_func) (disc_info, node)
|
||||
|
||||
#if 0
|
||||
#define DISCRETE_STEP(_func) void DISCRETE_STEP_NAME(_func) (const device_config *device, node_description *node)
|
||||
#define DISCRETE_RESET(_func) void DISCRETE_RESET_NAME(_func) (const device_config *device, node_description *node)
|
||||
|
||||
#define DISCRETE_STEP_CALL(_func) DISCRETE_STEP_NAME(_func) (device, node)
|
||||
#define DISCRETE_RESET_CALL(_func) DISCRETE_RESET_NAME(_func) (device, node)
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Profiling Nodes
|
||||
*
|
||||
*************************************/
|
||||
|
||||
#define DISCRETE_PROFILING (0)
|
||||
#endif
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -3532,6 +3532,7 @@ typedef struct _discrete_sound_block discrete_sound_block;
|
||||
*************************************/
|
||||
|
||||
typedef struct _node_description node_description;
|
||||
typedef struct _discrete_info discrete_info;
|
||||
|
||||
typedef struct _discrete_module discrete_module;
|
||||
struct _discrete_module
|
||||
@ -3540,8 +3541,8 @@ struct _discrete_module
|
||||
const char * name;
|
||||
int num_output; /* Total number of output nodes, i.e. Master node + 1 */
|
||||
size_t contextsize;
|
||||
void (*reset)(const device_config *device, node_description *node); /* Called to reset a node after creation or system reset */
|
||||
void (*step)(const device_config *device, node_description *node); /* Called to execute one time delta of output update */
|
||||
void (*reset)(const discrete_info *disc_info, node_description *node); /* Called to reset a node after creation or system reset */
|
||||
void (*step)(const discrete_info *disc_info, node_description *node); /* Called to execute one time delta of output update */
|
||||
};
|
||||
|
||||
|
||||
@ -3565,9 +3566,7 @@ struct _node_description
|
||||
void * context; /* Contextual information specific to this node type */
|
||||
const char * name; /* Text name string for identification/debug */
|
||||
const void * custom; /* Custom function specific initialisation data */
|
||||
#if (DISCRETE_PROFILING)
|
||||
osd_ticks_t run_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -3581,7 +3580,6 @@ struct _node_description
|
||||
*
|
||||
*************************************/
|
||||
|
||||
typedef struct _discrete_info discrete_info;
|
||||
struct _discrete_info
|
||||
{
|
||||
const device_config *device;
|
||||
@ -3621,6 +3619,9 @@ struct _discrete_info
|
||||
int num_wavelogs;
|
||||
wav_file *disc_wav_file[DISCRETE_MAX_WAVELOGS];
|
||||
node_description *wavelog_node[DISCRETE_MAX_WAVELOGS];
|
||||
|
||||
/* profiling */
|
||||
int total_samples;
|
||||
};
|
||||
|
||||
|
||||
@ -3882,8 +3883,8 @@ struct _discrete_adsr
|
||||
typedef struct _discrete_custom_info discrete_custom_info;
|
||||
struct _discrete_custom_info
|
||||
{
|
||||
void (*reset)(const device_config *device, node_description *node); /* Called to reset a node after creation or system reset */
|
||||
void (*step)(const device_config *device, node_description *node); /* Called to execute one time delta of output update */
|
||||
void (*reset)(const discrete_info *disc_info, node_description *node); /* Called to reset a node after creation or system reset */
|
||||
void (*step)(const discrete_info *disc_info, node_description *node); /* Called to execute one time delta of output update */
|
||||
size_t contextsize;
|
||||
const void *custom; /* Custom function specific initialisation data */
|
||||
};
|
||||
@ -4000,6 +4001,7 @@ enum {
|
||||
enum
|
||||
{
|
||||
DSS_NULL, /* Nothing, nill, zippo, only to be used as terminating node */
|
||||
DSS_NOP, /* just do nothing, placeholder for potential DISCRETE_REPLACE in parent block */
|
||||
|
||||
/* from disc_inp.c */
|
||||
DSS_ADJUSTMENT, /* Adjustment node */
|
||||
@ -4105,7 +4107,15 @@ enum
|
||||
DSO_WAVELOG, /* Dump nodes as wav file */
|
||||
|
||||
/* Output Node -- this must be the last entry in this enum! */
|
||||
DSO_OUTPUT /* The final output node */
|
||||
DSO_OUTPUT, /* The final output node */
|
||||
|
||||
/* Import another blocklist */
|
||||
DSO_IMPORT, /* import from another discrete block */
|
||||
DSO_REPLACE, /* replace next node */
|
||||
DSO_DELETE, /* delete nodes */
|
||||
|
||||
/* Marks end of this enum -- must be last entry ! */
|
||||
DSO_LAST
|
||||
};
|
||||
|
||||
|
||||
@ -4267,6 +4277,9 @@ enum
|
||||
#define DISCRETE_566(NODE,ENAB,VMOD,R,C,OPTIONS) { NODE, DSD_566 , 4, { ENAB,VMOD,R,C }, { ENAB,VMOD,R,C }, OPTIONS, "DISCRETE_566" },
|
||||
#define DISCRETE_74LS624(NODE,ENAB,VMOD,VRNG,C,OUTTYPE) { NODE, DSD_LS624 , 5, { ENAB,VMOD,VRNG,C,NODE_NC }, { ENAB,VMOD,VRNG,C, OUTTYPE }, NULL, "DISCRETE_74LS624" },
|
||||
|
||||
/* NOP */
|
||||
#define DISCRETE_NOP(NODE) { NODE, DSS_NOP , 0, { }, { }, NULL, "DISCRETE_NOP" },
|
||||
|
||||
/* logging */
|
||||
#define DISCRETE_CSVLOG1(NODE1) { NODE_SPECIAL, DSO_CSVLOG , 1, { NODE1 }, { NODE1 }, NULL, "DISCRETE_CSVLOG1" },
|
||||
#define DISCRETE_CSVLOG2(NODE1,NODE2) { NODE_SPECIAL, DSO_CSVLOG , 2, { NODE1,NODE2 }, { NODE1,NODE2 }, NULL, "DISCRETE_CSVLOG2" },
|
||||
@ -4275,6 +4288,13 @@ enum
|
||||
#define DISCRETE_CSVLOG5(NODE1,NODE2,NODE3,NODE4,NODE5) { NODE_SPECIAL, DSO_CSVLOG , 5, { NODE1,NODE2,NODE3,NODE4,NODE5 }, { NODE1,NODE2,NODE3,NODE4,NODE5 }, NULL, "DISCRETE_CSVLOG5" },
|
||||
#define DISCRETE_WAVELOG1(NODE1,GAIN1) { NODE_SPECIAL, DSO_WAVELOG , 2, { NODE1,NODE_NC }, { NODE1,GAIN1 }, NULL, "DISCRETE_WAVELOG1" },
|
||||
#define DISCRETE_WAVELOG2(NODE1,GAIN1,NODE2,GAIN2) { NODE_SPECIAL, DSO_WAVELOG , 4, { NODE1,NODE_NC,NODE2,NODE_NC }, { NODE1,GAIN1,NODE2,GAIN2 }, NULL, "DISCRETE_WAVELOG2" },
|
||||
|
||||
/* import */
|
||||
#define DISCRETE_IMPORT(INFO) { NODE_SPECIAL, DSO_IMPORT , 0, { }, { }, &(INFO##_discrete_interface), "DISCRETE_IMPORT" },
|
||||
#define DISCRETE_DELETE(NODE_FROM, NODE_TO) { NODE_SPECIAL, DSO_DELETE , 2, { NODE_FROM, NODE_TO }, { NODE_FROM, NODE_TO }, NULL, "DISCRETE_DELETE" },
|
||||
#define DISCRETE_REPLACE { NODE_SPECIAL, DSO_REPLACE , 0, { }, { }, NULL, "DISCRETE_REPLACE" },
|
||||
|
||||
|
||||
/* output */
|
||||
#define DISCRETE_OUTPUT(OPNODE,GAIN) { NODE_SPECIAL, DSO_OUTPUT , 2, { OPNODE,NODE_NC }, { 0,GAIN }, NULL, "DISCRETE_OUTPUT" },
|
||||
|
||||
@ -4288,13 +4308,6 @@ enum
|
||||
*
|
||||
*************************************/
|
||||
|
||||
extern discrete_info *discrete_current_context;
|
||||
|
||||
node_description *discrete_find_node(void *chip, int node);
|
||||
|
||||
void discrete_sound_n_w(void *chip, offs_t offset, UINT8 data);
|
||||
UINT8 discrete_sound_n_r(void *chip, offs_t offset);
|
||||
|
||||
WRITE8_DEVICE_HANDLER( discrete_sound_w );
|
||||
READ8_DEVICE_HANDLER( discrete_sound_r );
|
||||
|
||||
|
@ -194,7 +194,7 @@ static DISCRETE_STEP( mario_custom_run )
|
||||
|
||||
double t1 = 0.5 / LS624_F(MARIO_CUSTOM_C1, MARIO_CUSTOM_IN1, RUN_VCO_VOLTAGE);
|
||||
double t2 = 0.5 / LS624_F(MARIO_CUSTOM_C2, MARIO_CUSTOM_IN2, RUN_VCO_VOLTAGE);
|
||||
double sample_t = discrete_current_context->sample_time;
|
||||
double sample_t = disc_info->sample_time;
|
||||
double vn, t;
|
||||
|
||||
//if (MARIO_CUSTOM_VOUT)
|
||||
|
Loading…
Reference in New Issue
Block a user