summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/netlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/machine/netlist.h')
-rw-r--r--src/emu/machine/netlist.h534
1 files changed, 267 insertions, 267 deletions
diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h
index 957fbd55c38..181d37e3873 100644
--- a/src/emu/machine/netlist.h
+++ b/src/emu/machine/netlist.h
@@ -68,29 +68,29 @@
netlist_mame_analog_input_t::static_set_mult_offset(*device, _mult, _offset);
#define MCFG_NETLIST_ANALOG_OUTPUT(_basetag, _tag, _IN, _class, _member, _class_tag) \
- MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ANALOG_OUTPUT, 0) \
- netlist_mame_analog_output_t::static_set_params(*device, _IN, \
- netlist_analog_output_delegate(& _class :: _member, \
- # _class "::" # _member, _class_tag, (_class *) 0) );
+ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ANALOG_OUTPUT, 0) \
+ netlist_mame_analog_output_t::static_set_params(*device, _IN, \
+ netlist_analog_output_delegate(& _class :: _member, \
+ # _class "::" # _member, _class_tag, (_class *) 0) );
#define MCFG_NETLIST_LOGIC_INPUT(_basetag, _tag, _name, _shift, _mask) \
MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_LOGIC_INPUT, 0) \
netlist_mame_logic_input_t::static_set_params(*device, _name, _mask, _shift);
#define MCFG_NETLIST_STREAM_INPUT(_basetag, _chan, _name) \
- MCFG_DEVICE_ADD(_basetag ":cin" # _chan, NETLIST_STREAM_INPUT, 0) \
- netlist_mame_stream_input_t::static_set_params(*device, _chan, _name);
+ MCFG_DEVICE_ADD(_basetag ":cin" # _chan, NETLIST_STREAM_INPUT, 0) \
+ netlist_mame_stream_input_t::static_set_params(*device, _chan, _name);
#define MCFG_NETLIST_STREAM_OUTPUT(_basetag, _chan, _name) \
- MCFG_DEVICE_ADD(_basetag ":cout" # _chan, NETLIST_STREAM_OUTPUT, 0) \
- netlist_mame_stream_output_t::static_set_params(*device, _chan, _name);
+ MCFG_DEVICE_ADD(_basetag ":cout" # _chan, NETLIST_STREAM_OUTPUT, 0) \
+ netlist_mame_stream_output_t::static_set_params(*device, _chan, _name);
#define NETLIST_LOGIC_PORT_CHANGED(_base, _tag) \
PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_logic_input_t, input_changed, 0)
#define NETLIST_ANALOG_PORT_CHANGED(_base, _tag) \
- PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_analog_input_t, input_changed, 0)
+ PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_analog_input_t, input_changed, 0)
// ----------------------------------------------------------------------------------------
@@ -101,7 +101,7 @@
setup.parse((char *)downcast<netlist_mame_t &>(setup.netlist()).machine().root_device().memregion(_name)->base());
#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \
- void _name(const double data, const attotime &time)
+ void _name(const double data, const attotime &time)
#if 0
@@ -116,12 +116,12 @@
#if 0
#define NETDEV_SOUND_OUT(_name, _v, _m) \
- NET_REGISTER_DEV(sound_out, _name) \
- PARAM(_name.CHAN, _v) \
- PARAM(_name.MULT, _m)
+ NET_REGISTER_DEV(sound_out, _name) \
+ PARAM(_name.CHAN, _v) \
+ PARAM(_name.MULT, _m)
#define NETDEV_SOUND_IN(_name) \
- NET_REGISTER_DEV(sound_in, _name)
+ NET_REGISTER_DEV(sound_in, _name)
#endif
class netlist_mame_device_t;
@@ -166,18 +166,18 @@ public:
ATTR_HOT inline netlist_setup_t &setup() { return *m_setup; }
ATTR_HOT inline netlist_mame_t &netlist() { return *m_netlist; }
- ATTR_HOT inline netlist_time last_time_update() { return m_old; }
+ ATTR_HOT inline netlist_time last_time_update() { return m_old; }
ATTR_HOT void update_time_x();
ATTR_HOT void check_mame_abort_slice();
- int m_icount;
+ int m_icount;
protected:
- // Custom to netlist ...
+ // Custom to netlist ...
- virtual void nl_register_devices() { };
+ virtual void nl_register_devices() { };
- // device_t overrides
+ // device_t overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_stop();
@@ -185,20 +185,20 @@ protected:
virtual void device_post_load();
virtual void device_pre_save();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
- //virtual void device_debug_setup();
- virtual void device_clock_changed();
+ //virtual void device_debug_setup();
+ virtual void device_clock_changed();
- UINT32 m_div;
+ UINT32 m_div;
private:
- void save_state();
+ void save_state();
- /* timing support here - so sound can hijack it ... */
- UINT32 m_rem;
- netlist_time m_old;
+ /* timing support here - so sound can hijack it ... */
+ UINT32 m_rem;
+ netlist_time m_old;
netlist_mame_t * m_netlist;
- netlist_setup_t * m_setup;
+ netlist_setup_t * m_setup;
void (*m_setup_func)(netlist_setup_t &);
};
@@ -213,75 +213,75 @@ inline running_machine &netlist_mame_t::machine()
// ----------------------------------------------------------------------------------------
class netlist_mame_cpu_device_t : public netlist_mame_device_t,
- public device_execute_interface,
- public device_state_interface,
- public device_disasm_interface,
- public device_memory_interface
+ public device_execute_interface,
+ public device_state_interface,
+ public device_disasm_interface,
+ public device_memory_interface
{
public:
- // construction/destruction
- netlist_mame_cpu_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~netlist_mame_cpu_device_t() {}
+ // construction/destruction
+ netlist_mame_cpu_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~netlist_mame_cpu_device_t() {}
- static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
+ static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
protected:
- // netlist_mame_device_t
- virtual void nl_register_devices();
-
- // device_t overrides
-
- //virtual void device_config_complete();
- virtual void device_start();
- //virtual void device_stop();
- //virtual void device_reset();
- //virtual void device_post_load();
- //virtual void device_pre_save();
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
-
- // device_execute_interface overrides
-
- virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
- virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
-
- ATTR_HOT virtual void execute_run();
-
- // device_disasm_interface overrides
- ATTR_COLD virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
- ATTR_COLD virtual UINT32 disasm_max_opcode_bytes() const { return 1; }
- ATTR_COLD virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
-
- // device_memory_interface overrides
-
- address_space_config m_program_config;
-
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const
- {
- switch (spacenum)
- {
- case AS_PROGRAM: return &m_program_config;
- case AS_IO: return NULL;
- default: return NULL;
- }
- }
-
- // device_state_interface overrides
-
- virtual void state_string_export(const device_state_entry &entry, astring &string)
- {
- if (entry.index() >= 0)
- {
- if (entry.index() & 1)
- string.format("%10.6f", *((double *) entry.dataptr()));
- else
- string.format("%d", *((netlist_sig_t *) entry.dataptr()));
- }
- }
+ // netlist_mame_device_t
+ virtual void nl_register_devices();
+
+ // device_t overrides
+
+ //virtual void device_config_complete();
+ virtual void device_start();
+ //virtual void device_stop();
+ //virtual void device_reset();
+ //virtual void device_post_load();
+ //virtual void device_pre_save();
+ //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // device_execute_interface overrides
+
+ virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const;
+ virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const;
+
+ ATTR_HOT virtual void execute_run();
+
+ // device_disasm_interface overrides
+ ATTR_COLD virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
+ ATTR_COLD virtual UINT32 disasm_max_opcode_bytes() const { return 1; }
+ ATTR_COLD virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
+
+ // device_memory_interface overrides
+
+ address_space_config m_program_config;
+
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const
+ {
+ switch (spacenum)
+ {
+ case AS_PROGRAM: return &m_program_config;
+ case AS_IO: return NULL;
+ default: return NULL;
+ }
+ }
+
+ // device_state_interface overrides
+
+ virtual void state_string_export(const device_state_entry &entry, astring &string)
+ {
+ if (entry.index() >= 0)
+ {
+ if (entry.index() & 1)
+ string.format("%10.6f", *((double *) entry.dataptr()));
+ else
+ string.format("%d", *((netlist_sig_t *) entry.dataptr()));
+ }
+ }
private:
- int m_genPC;
+ int m_genPC;
};
@@ -293,45 +293,45 @@ class nld_sound_in;
// ----------------------------------------------------------------------------------------
class netlist_mame_sound_device_t : public netlist_mame_device_t,
- public device_sound_interface
+ public device_sound_interface
{
public:
- // construction/destruction
- netlist_mame_sound_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~netlist_mame_sound_device_t() {}
+ // construction/destruction
+ netlist_mame_sound_device_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~netlist_mame_sound_device_t() {}
- static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
+ static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
- inline sound_stream *get_stream() { return m_stream; }
+ inline sound_stream *get_stream() { return m_stream; }
- // device_sound_interface overrides
+ // device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
protected:
- // netlist_mame_device_t
- virtual void nl_register_devices();
+ // netlist_mame_device_t
+ virtual void nl_register_devices();
- // device_t overrides
+ // device_t overrides
- //virtual void device_config_complete();
- virtual void device_start();
- //virtual void device_stop();
- //virtual void device_reset();
- //virtual void device_post_load();
- //virtual void device_pre_save();
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+ //virtual void device_config_complete();
+ virtual void device_start();
+ //virtual void device_stop();
+ //virtual void device_reset();
+ //virtual void device_post_load();
+ //virtual void device_pre_save();
+ //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
private:
- static const int MAX_OUT = 10;
- nld_sound_out *m_out[MAX_OUT];
- nld_sound_in *m_in;
- sound_stream *m_stream;
- int m_num_inputs;
- int m_num_outputs;
+ static const int MAX_OUT = 10;
+ nld_sound_out *m_out[MAX_OUT];
+ nld_sound_in *m_in;
+ sound_stream *m_stream;
+ int m_num_inputs;
+ int m_num_outputs;
};
@@ -344,11 +344,11 @@ class netlist_mame_sub_interface
public:
// construction/destruction
netlist_mame_sub_interface(device_t &aowner)
- : m_offset(0.0), m_mult(1.0)
- {
- m_owner = dynamic_cast<netlist_mame_device_t *>(&aowner);
- m_sound = dynamic_cast<netlist_mame_sound_device_t *>(&aowner);
- }
+ : m_offset(0.0), m_mult(1.0)
+ {
+ m_owner = dynamic_cast<netlist_mame_device_t *>(&aowner);
+ m_sound = dynamic_cast<netlist_mame_sound_device_t *>(&aowner);
+ }
virtual ~netlist_mame_sub_interface() { }
virtual void custom_netlist_additions(netlist_setup_t &setup) { }
@@ -359,14 +359,14 @@ public:
inline void update_to_current_time()
{
- m_sound->get_stream()->update();
+ m_sound->get_stream()->update();
}
- static void static_set_mult_offset(device_t &device, const double mult, const double offset);
+ static void static_set_mult_offset(device_t &device, const double mult, const double offset);
protected:
- double m_offset;
- double m_mult;
+ double m_offset;
+ double m_mult;
private:
netlist_mame_device_t *m_owner;
@@ -390,16 +390,16 @@ public:
inline void write(const double val)
{
- if (is_sound_device())
- {
- update_to_current_time();
- m_param->setTo(val * m_mult + m_offset);
- }
- else
- {
- // FIXME: use device timer ....
- m_param->setTo(val * m_mult + m_offset);
- }
+ if (is_sound_device())
+ {
+ update_to_current_time();
+ m_param->setTo(val * m_mult + m_offset);
+ }
+ else
+ {
+ // FIXME: use device timer ....
+ m_param->setTo(val * m_mult + m_offset);
+ }
}
inline DECLARE_INPUT_CHANGED_MEMBER(input_changed)
@@ -432,24 +432,24 @@ private:
typedef device_delegate<void (const double, const attotime &)> netlist_analog_output_delegate;
class netlist_mame_analog_output_t : public device_t,
- public netlist_mame_sub_interface
+ public netlist_mame_sub_interface
{
public:
- // construction/destruction
- netlist_mame_analog_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~netlist_mame_analog_output_t() { }
+ // construction/destruction
+ netlist_mame_analog_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~netlist_mame_analog_output_t() { }
- static void static_set_params(device_t &device, const char *in_name, netlist_analog_output_delegate adelegate);
+ static void static_set_params(device_t &device, const char *in_name, netlist_analog_output_delegate adelegate);
protected:
- // device-level overrides
- virtual void device_start();
- virtual void custom_netlist_additions(netlist_setup_t &setup);
+ // device-level overrides
+ virtual void device_start();
+ virtual void custom_netlist_additions(netlist_setup_t &setup);
private:
- pstring m_in;
- netlist_analog_output_delegate m_delegate;
+ pstring m_in;
+ netlist_analog_output_delegate m_delegate;
};
@@ -470,16 +470,16 @@ public:
inline void write(const UINT32 val)
{
- if (is_sound_device())
- {
- update_to_current_time();
- m_param->setTo((val >> m_shift) & m_mask);
- }
- else
- {
- // FIXME: use device timer ....
- m_param->setTo((val >> m_shift) & m_mask);
- }
+ if (is_sound_device())
+ {
+ update_to_current_time();
+ m_param->setTo((val >> m_shift) & m_mask);
+ }
+ else
+ {
+ // FIXME: use device timer ....
+ m_param->setTo((val >> m_shift) & m_mask);
+ }
}
inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); }
@@ -505,23 +505,23 @@ private:
// ----------------------------------------------------------------------------------------
class netlist_mame_stream_input_t : public device_t,
- public netlist_mame_sub_interface
+ public netlist_mame_sub_interface
{
public:
- // construction/destruction
- netlist_mame_stream_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~netlist_mame_stream_input_t() { }
+ // construction/destruction
+ netlist_mame_stream_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~netlist_mame_stream_input_t() { }
- static void static_set_params(device_t &device, int channel, const char *param_name);
+ static void static_set_params(device_t &device, int channel, const char *param_name);
protected:
- // device-level overrides
- virtual void device_start();
- virtual void custom_netlist_additions(netlist_setup_t &setup);
+ // device-level overrides
+ virtual void device_start();
+ virtual void custom_netlist_additions(netlist_setup_t &setup);
private:
- UINT32 m_channel;
- pstring m_param_name;
+ UINT32 m_channel;
+ pstring m_param_name;
};
// ----------------------------------------------------------------------------------------
@@ -529,23 +529,23 @@ private:
// ----------------------------------------------------------------------------------------
class netlist_mame_stream_output_t : public device_t,
- public netlist_mame_sub_interface
+ public netlist_mame_sub_interface
{
public:
- // construction/destruction
- netlist_mame_stream_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- virtual ~netlist_mame_stream_output_t() { }
+ // construction/destruction
+ netlist_mame_stream_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~netlist_mame_stream_output_t() { }
- static void static_set_params(device_t &device, int channel, const char *out_name);
+ static void static_set_params(device_t &device, int channel, const char *out_name);
protected:
- // device-level overrides
- virtual void device_start();
- virtual void custom_netlist_additions(netlist_setup_t &setup);
+ // device-level overrides
+ virtual void device_start();
+ virtual void custom_netlist_additions(netlist_setup_t &setup);
private:
- UINT32 m_channel;
- pstring m_out_name;
+ UINT32 m_channel;
+ pstring m_out_name;
};
// ----------------------------------------------------------------------------------------
// netdev_callback
@@ -563,9 +563,9 @@ public:
m_cpu_device = downcast<netlist_mame_cpu_device_t *>(&downcast<netlist_mame_t &>(netlist()).parent());
}
- ATTR_COLD void reset()
- {
- }
+ ATTR_COLD void reset()
+ {
+ }
ATTR_COLD void register_callback(netlist_analog_output_delegate callback)
{
@@ -574,9 +574,9 @@ public:
ATTR_HOT void update()
{
- m_cpu_device->update_time_x();
- m_callback(INPANALOG(m_in), m_cpu_device->local_time());
- m_cpu_device->check_mame_abort_slice();
+ m_cpu_device->update_time_x();
+ m_callback(INPANALOG(m_in), m_cpu_device->local_time());
+ m_cpu_device->check_mame_abort_slice();
}
private:
@@ -601,18 +601,18 @@ 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));
+ 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));
}
- ATTR_COLD void reset()
- {
- m_cur = 0;
- m_last_pos = 0;
- m_last_buffer = netlist_time::zero;
- }
+ ATTR_COLD void reset()
+ {
+ m_cur = 0;
+ m_last_pos = 0;
+ m_last_buffer = netlist_time::zero;
+ }
ATTR_HOT void sound_update(const netlist_time upto)
{
@@ -634,15 +634,15 @@ public:
ATTR_HOT void buffer_reset(netlist_time upto)
{
- m_last_pos = 0;
- m_last_buffer = upto;
+ m_last_pos = 0;
+ m_last_buffer = upto;
}
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;
+ netlist_param_double_t m_mult;
+ netlist_param_double_t m_offset;
+ stream_sample_t *m_buffer;
+ netlist_time m_sample;
private:
netlist_analog_input_t m_in;
@@ -658,84 +658,84 @@ private:
class NETLIB_NAME(sound_in) : public netlist_device_t
{
public:
- NETLIB_NAME(sound_in)()
- : netlist_device_t() { }
-
- static const int MAX_INPUT_CHANNELS = 10;
-
- ATTR_COLD void start()
- {
- // clock part
- register_output("Q", m_Q);
- register_input("FB", m_feedback);
-
- connect(m_feedback, m_Q);
- m_inc = netlist_time::from_nsec(1);
-
-
- for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
- {
- 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;
- }
-
- ATTR_COLD void reset()
- {
- m_pos = 0;
- for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
- m_buffer[i] = NULL;
- }
-
- ATTR_COLD int resolve()
- {
- m_pos = 0;
- for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
- {
- if (m_param_name[i].Value() != "")
- {
- if (i != m_num_channel)
- netlist().error("sound input numbering has to be sequential!");
- m_num_channel++;
- m_param[i] = dynamic_cast<netlist_param_double_t *>(setup().find_param(m_param_name[i].Value(), true));
- }
- }
- return m_num_channel;
- }
-
- ATTR_HOT void update()
- {
- for (int i=0; i<m_num_channel; i++)
- {
- 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_offset[i].Value());
- }
- m_pos++;
- OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
- }
-
- ATTR_HOT void buffer_reset()
- {
- m_pos = 0;
- }
-
- netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS];
- 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;
+ NETLIB_NAME(sound_in)()
+ : netlist_device_t() { }
+
+ static const int MAX_INPUT_CHANNELS = 10;
+
+ ATTR_COLD void start()
+ {
+ // clock part
+ register_output("Q", m_Q);
+ register_input("FB", m_feedback);
+
+ connect(m_feedback, m_Q);
+ m_inc = netlist_time::from_nsec(1);
+
+
+ for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
+ {
+ 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;
+ }
+
+ ATTR_COLD void reset()
+ {
+ m_pos = 0;
+ for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
+ m_buffer[i] = NULL;
+ }
+
+ ATTR_COLD int resolve()
+ {
+ m_pos = 0;
+ for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
+ {
+ if (m_param_name[i].Value() != "")
+ {
+ if (i != m_num_channel)
+ netlist().error("sound input numbering has to be sequential!");
+ m_num_channel++;
+ m_param[i] = dynamic_cast<netlist_param_double_t *>(setup().find_param(m_param_name[i].Value(), true));
+ }
+ }
+ return m_num_channel;
+ }
+
+ ATTR_HOT void update()
+ {
+ for (int i=0; i<m_num_channel; i++)
+ {
+ 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_offset[i].Value());
+ }
+ m_pos++;
+ OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc );
+ }
+
+ ATTR_HOT void buffer_reset()
+ {
+ m_pos = 0;
+ }
+
+ netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS];
+ 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:
- netlist_ttl_input_t m_feedback;
- netlist_ttl_output_t m_Q;
+ netlist_ttl_input_t m_feedback;
+ netlist_ttl_output_t m_Q;
- int m_pos;
- int m_num_channel;
+ int m_pos;
+ int m_num_channel;
};
// device type definition