mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
Fixed handling of input/output offsets.
This commit is contained in:
parent
7a700cf738
commit
a4c4341c2c
@ -215,8 +215,10 @@ void netlist_mame_stream_input_t::custom_netlist_additions(netlist_setup_t &setu
|
||||
|
||||
pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel);
|
||||
setup.register_param(sparam, m_param_name);
|
||||
pstring mparam = pstring::sprintf("STREAM_INPUT.MULT%d", m_channel);
|
||||
setup.register_param(mparam, m_mult);
|
||||
sparam = pstring::sprintf("STREAM_INPUT.MULT%d", m_channel);
|
||||
setup.register_param(sparam, m_mult);
|
||||
sparam = pstring::sprintf("STREAM_INPUT.OFFSET%d", m_channel);
|
||||
setup.register_param(sparam, m_offset);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -253,6 +255,7 @@ void netlist_mame_stream_output_t::custom_netlist_additions(netlist_setup_t &set
|
||||
|
||||
setup.register_param(sname + ".CHAN" , m_channel);
|
||||
setup.register_param(sname + ".MULT", m_mult);
|
||||
setup.register_param(sname + ".OFFSET", m_offset);
|
||||
setup.register_link(sname + ".IN", m_out_name);
|
||||
}
|
||||
|
||||
|
@ -602,6 +602,7 @@ public:
|
||||
register_input("IN", m_in);
|
||||
register_param("CHAN", m_channel, 0);
|
||||
register_param("MULT", m_mult, 1000.0);
|
||||
register_param("OFFSET", m_offset, 0.0);
|
||||
m_sample = netlist_time::from_hz(1); //sufficiently big enough
|
||||
save(NAME(m_last_buffer));
|
||||
}
|
||||
@ -628,7 +629,7 @@ public:
|
||||
{
|
||||
double val = INPANALOG(m_in);
|
||||
sound_update(netlist().time());
|
||||
m_cur = (stream_sample_t) (val * m_mult.Value());
|
||||
m_cur = (stream_sample_t) (val * m_mult.Value() + m_offset.Value());
|
||||
}
|
||||
|
||||
ATTR_HOT void buffer_reset(netlist_time upto)
|
||||
@ -639,6 +640,7 @@ public:
|
||||
|
||||
netlist_param_int_t m_channel;
|
||||
netlist_param_double_t m_mult;
|
||||
netlist_param_double_t m_offset;
|
||||
stream_sample_t *m_buffer;
|
||||
netlist_time m_sample;
|
||||
|
||||
@ -675,6 +677,7 @@ public:
|
||||
{
|
||||
register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], "");
|
||||
register_param(pstring::sprintf("MULT%d", i), m_param_mult[i], 1.0);
|
||||
register_param(pstring::sprintf("OFFSET%d", i), m_param_offset[i], 0.0);
|
||||
}
|
||||
m_num_channel = 0;
|
||||
}
|
||||
@ -709,7 +712,7 @@ public:
|
||||
if (m_buffer[i] == NULL)
|
||||
break; // stop, called outside of stream_update
|
||||
double v = m_buffer[i][m_pos];
|
||||
m_param[i]->setTo(v * m_param_mult[i].Value());
|
||||
m_param[i]->setTo(v * m_param_mult[i].Value() + m_param_offset[i].Value());
|
||||
}
|
||||
m_pos++;
|
||||
OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
|
||||
@ -724,6 +727,7 @@ public:
|
||||
netlist_param_double_t *m_param[MAX_INPUT_CHANNELS];
|
||||
stream_sample_t *m_buffer[MAX_INPUT_CHANNELS];
|
||||
netlist_param_double_t m_param_mult[MAX_INPUT_CHANNELS];
|
||||
netlist_param_double_t m_param_offset[MAX_INPUT_CHANNELS];
|
||||
netlist_time m_inc;
|
||||
|
||||
private:
|
||||
|
@ -38,15 +38,9 @@
|
||||
#define NET_CONNECT(_name, _input, _output) \
|
||||
setup.register_link(# _name "." # _input, # _output);
|
||||
|
||||
#if 0
|
||||
#define NET_C(_term1, _term2, term...) \
|
||||
setup.register_link(NET_STR(_term1) , NET_STR(_term2));
|
||||
#endif
|
||||
|
||||
#define NET_C(_term1, _terms...) \
|
||||
#define NET_C(_term1, _terms...) \
|
||||
setup.register_link_arr( #_term1 ", " # _terms);
|
||||
|
||||
|
||||
#define PARAM(_name, _val) \
|
||||
setup.register_param(# _name, _val);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user