summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-04-03 02:53:19 +1000
committer Vas Crabb <vas@vastheman.com>2022-04-03 02:53:19 +1000
commitc4f9ff9790382c1c5b99a2ffbb2a14e04d4c7cea (patch)
tree80a1185e2dbed843500eda4e740dfac9f03eba1b /src/devices/sound
parent5255f96203e4dc58ba660f74a64e6b640016a604 (diff)
-util/corealloc.h: Reduced make_unique_clear to a single variant for POD arrays.
* Enabled GCC lifetime dead store elimination optimisation. * emu/device.h: Don't pre-clear memory for drivers. Ivan Vangelista fixed at least the majority of things that crashed outright, and Robbbert initialised variables that coverity complained about. It's unlikely anything will break due to this. * sound/discrete.h: Explicitly initialise members of discrete "devices" to zero. I don't see a way around doing this in headers due to the macro soup used to build the constructors. * sound/mos6581.cpp: Moved creation of the SID core to device_start and explictly initialised members of the SID core structures. These structures are in internal headers, so they won't cause downstream recompiles. -Lua engine: Made I/O port manager type_seq a bit more tolerant of omitted arguments.
Diffstat (limited to 'src/devices/sound')
-rw-r--r--src/devices/sound/disc_cls.h128
-rw-r--r--src/devices/sound/disc_dev.hxx10
-rw-r--r--src/devices/sound/disc_flt.h192
-rw-r--r--src/devices/sound/disc_mth.h178
-rw-r--r--src/devices/sound/disc_wav.h184
-rw-r--r--src/devices/sound/discrete.h5
-rw-r--r--src/devices/sound/mos6581.cpp2
-rw-r--r--src/devices/sound/sid.h42
-rw-r--r--src/devices/sound/sidvoice.h82
9 files changed, 411 insertions, 412 deletions
diff --git a/src/devices/sound/disc_cls.h b/src/devices/sound/disc_cls.h
index 5761b31ae9e..6bd94631bde 100644
--- a/src/devices/sound/disc_cls.h
+++ b/src/devices/sound/disc_cls.h
@@ -25,7 +25,7 @@
#define DISCRETE_CLASS_NAME(_name) discrete_ ## _name ## _node
-#define DISCRETE_CLASS_INPUT(_name, _num) inline double _name (void) { return *(m_input[_num]); }
+#define DISCRETE_CLASS_INPUT(_name, _num) inline double _name() { return *(m_input[_num]); }
#define DISCRETE_CLASS_CONSTRUCTOR(_name, _base) \
public: \
@@ -34,7 +34,7 @@
#define DISCRETE_CLASS_DESTRUCTOR(_name) \
public: \
- virtual ~ DISCRETE_CLASS_NAME(_name)(void) { }
+ virtual ~ DISCRETE_CLASS_NAME(_name)() { }
#define DISCRETE_CLASS_STEP_RESET(_name, _maxout, _priv) \
class DISCRETE_CLASS_NAME(_name): public discrete_base_node, public discrete_step_interface \
@@ -42,9 +42,9 @@ class DISCRETE_CLASS_NAME(_name): public discrete_base_node, public discrete_ste
DISCRETE_CLASS_CONSTRUCTOR(_name, base) \
DISCRETE_CLASS_DESTRUCTOR(_name) \
public: \
- virtual void step(void) override; \
- virtual void reset(void) override; \
- virtual int max_output(void) override { return _maxout; } \
+ virtual void step() override; \
+ virtual void reset() override; \
+ virtual int max_output() override { return _maxout; } \
private: \
_priv \
}
@@ -55,34 +55,34 @@ class DISCRETE_CLASS_NAME(_name): public discrete_base_node, public discrete_ste
DISCRETE_CLASS_CONSTRUCTOR(_name, base) \
DISCRETE_CLASS_DESTRUCTOR(_name) \
public: \
- virtual void step(void) override; \
- virtual void reset(void) override { this->step(); } \
- virtual int max_output(void) override { return _maxout; } \
+ virtual void step() override; \
+ virtual void reset() override { this->step(); } \
+ virtual int max_output() override { return _maxout; } \
private: \
_priv \
}
-#define DISCRETE_CLASS_RESET(_name, _maxout) \
+#define DISCRETE_CLASS_RESET(_name, _maxout) \
class DISCRETE_CLASS_NAME(_name): public discrete_base_node \
{ \
DISCRETE_CLASS_CONSTRUCTOR(_name, base) \
DISCRETE_CLASS_DESTRUCTOR(_name) \
public: \
- virtual void reset(void) override; \
- virtual int max_output(void) override { return _maxout; } \
+ virtual void reset() override; \
+ virtual int max_output() override { return _maxout; } \
}
-#define DISCRETE_CLASS(_name, _maxout, _priv) \
+#define DISCRETE_CLASS(_name, _maxout, _priv) \
class DISCRETE_CLASS_NAME(_name): public discrete_base_node, public discrete_step_interface \
{ \
DISCRETE_CLASS_DESTRUCTOR(_name) \
DISCRETE_CLASS_CONSTRUCTOR(_name, base) \
public: \
- virtual void step(void) override; \
- virtual void reset(void) override; \
- virtual void start(void) override; \
- virtual void stop(void) override; \
- virtual int max_output(void) override { return _maxout; } \
+ virtual void step() override; \
+ virtual void reset() override; \
+ virtual void start() override; \
+ virtual void stop() override; \
+ virtual int max_output() override { return _maxout; } \
private: \
_priv \
}
@@ -92,7 +92,7 @@ class DISCRETE_CLASS_NAME(special): public discrete_base_node
DISCRETE_CLASS_CONSTRUCTOR(special, base)
DISCRETE_CLASS_DESTRUCTOR(special)
public:
- virtual int max_output(void) override { return 0; }
+ virtual int max_output() override { return 0; }
};
class DISCRETE_CLASS_NAME(unimplemented): public discrete_base_node
@@ -100,7 +100,7 @@ class DISCRETE_CLASS_NAME(unimplemented): public discrete_base_node
DISCRETE_CLASS_CONSTRUCTOR(unimplemented, base)
DISCRETE_CLASS_DESTRUCTOR(unimplemented)
public:
- virtual int max_output(void) override { return 0; }
+ virtual int max_output() override { return 0; }
};
/*************************************
@@ -116,22 +116,22 @@ class DISCRETE_CLASS_NAME(dso_output): public discrete_base_node,
DISCRETE_CLASS_CONSTRUCTOR(dso_output, base)
DISCRETE_CLASS_DESTRUCTOR(dso_output)
public:
- virtual void step(void) override {
+ virtual void step() override {
/* Add gain to the output and put into the buffers */
/* Clipping will be handled by the main sound system */
double val = DISCRETE_INPUT(0) * DISCRETE_INPUT(1);
m_outview->put(m_outview_sample++, val * (1.0 / 32768.0));
}
- virtual int max_output(void) override { return 0; }
+ virtual int max_output() override { return 0; }
virtual void set_output_ptr(write_stream_view &view) override { m_outview = &view; m_outview_sample = 0; }
private:
- write_stream_view *m_outview;
- u32 m_outview_sample;
+ write_stream_view *m_outview = nullptr;
+ u32 m_outview_sample = 0U;
};
DISCRETE_CLASS(dso_csvlog, 0,
- FILE *m_csv_file;
- int64_t m_sample_num;
+ FILE *m_csv_file = nullptr;
+ int64_t m_sample_num = 0;
char m_name[32];
);
@@ -151,15 +151,15 @@ class DISCRETE_CLASS_NAME(dss_adjustment): public discrete_base_node, public dis
DISCRETE_CLASS_CONSTRUCTOR(dss_adjustment, base)
DISCRETE_CLASS_DESTRUCTOR(dss_adjustment)
public:
- virtual void step(void) override;
- virtual void reset(void) override;
+ virtual void step() override;
+ virtual void reset() override;
private:
- ioport_port *m_port;
- int32_t m_lastpval;
- int32_t m_pmin;
- double m_pscale;
- double m_min;
- double m_scale;
+ ioport_port *m_port = 0;
+ int32_t m_lastpval = 0;
+ int32_t m_pmin = 0;
+ double m_pscale = 0.0;
+ double m_min = 0.0;
+ double m_scale = 0.0;
};
DISCRETE_CLASS_RESET(dss_constant, 1);
@@ -169,12 +169,12 @@ class DISCRETE_CLASS_NAME(dss_input_data): public discrete_base_node, public dis
DISCRETE_CLASS_DESTRUCTOR(dss_input_data)
DISCRETE_CLASS_CONSTRUCTOR(dss_input_data, base)
public:
- virtual void reset(void) override;
+ virtual void reset() override;
virtual void input_write(int sub_node, uint8_t data ) override;
private:
- double m_gain; /* node gain */
- double m_offset; /* node offset */
- uint8_t m_data; /* data written */
+ double m_gain = 0.0; /* node gain */
+ double m_offset = 0.0; /* node offset */
+ uint8_t m_data = 0; /* data written */
};
class DISCRETE_CLASS_NAME(dss_input_logic): public discrete_base_node, public discrete_input_interface
@@ -182,12 +182,12 @@ class DISCRETE_CLASS_NAME(dss_input_logic): public discrete_base_node, public di
DISCRETE_CLASS_CONSTRUCTOR(dss_input_logic, base)
DISCRETE_CLASS_DESTRUCTOR(dss_input_logic)
public:
- virtual void reset(void) override;
+ virtual void reset() override;
virtual void input_write(int sub_node, uint8_t data ) override;
private:
- double m_gain; /* node gain */
- double m_offset; /* node offset */
- uint8_t m_data; /* data written */
+ double m_gain = 0.0; /* node gain */
+ double m_offset = 0.0; /* node offset */
+ uint8_t m_data = 0; /* data written */
};
class DISCRETE_CLASS_NAME(dss_input_not): public discrete_base_node, public discrete_input_interface
@@ -195,12 +195,12 @@ class DISCRETE_CLASS_NAME(dss_input_not): public discrete_base_node, public disc
DISCRETE_CLASS_CONSTRUCTOR(dss_input_not, base)
DISCRETE_CLASS_DESTRUCTOR(dss_input_not)
public:
- virtual void reset(void) override;
+ virtual void reset() override;
virtual void input_write(int sub_node, uint8_t data ) override;
private:
- double m_gain; /* node gain */
- double m_offset; /* node offset */
- uint8_t m_data; /* data written */
+ double m_gain = 0.0; /* node gain */
+ double m_offset = 0.0; /* node offset */
+ uint8_t m_data = 0; /* data written */
};
class DISCRETE_CLASS_NAME(dss_input_pulse): public discrete_base_node, public discrete_input_interface, public discrete_step_interface
@@ -208,13 +208,13 @@ class DISCRETE_CLASS_NAME(dss_input_pulse): public discrete_base_node, public di
DISCRETE_CLASS_CONSTRUCTOR(dss_input_pulse, base)
DISCRETE_CLASS_DESTRUCTOR(dss_input_pulse)
public:
- virtual void step(void) override;
- virtual void reset(void) override;
+ virtual void step() override;
+ virtual void reset() override;
virtual void input_write(int sub_node, uint8_t data ) override;
private:
- //double m_gain; /* node gain */
- //double m_offset; /* node offset */
- uint8_t m_data; /* data written */
+ //double m_gain = 0.0; /* node gain */
+ //double m_offset = 0.0; /* node offset */
+ uint8_t m_data = 0; /* data written */
};
class DISCRETE_CLASS_NAME(dss_input_stream): public discrete_base_node, public discrete_input_interface, public discrete_step_interface
@@ -222,28 +222,28 @@ class DISCRETE_CLASS_NAME(dss_input_stream): public discrete_base_node, public d
DISCRETE_CLASS_CONSTRUCTOR(dss_input_stream, base)
DISCRETE_CLASS_DESTRUCTOR(dss_input_stream)
public:
- virtual void step(void) override;
- virtual void reset(void) override;
- virtual void start(void) override;
+ virtual void step() override;
+ virtual void reset() override;
+ virtual void start() override;
virtual void input_write(int sub_node, uint8_t data ) override;
- virtual bool is_buffered(void) { return false; }
+ virtual bool is_buffered() { return false; }
/* This is called by discrete_sound_device */
- void stream_start(void);
+ void stream_start();
//protected:
- uint32_t m_stream_in_number;
- read_stream_view const *m_inview; /* current in ptr for stream */
- uint32_t m_inview_sample;
+ uint32_t m_stream_in_number = 0;
+ read_stream_view const *m_inview = nullptr; /* current in ptr for stream */
+ uint32_t m_inview_sample = 0;
private:
void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs);
- double m_gain; /* node gain */
- double m_offset; /* node offset */
- uint8_t m_data; /* data written */
- uint8_t m_is_buffered;
+ double m_gain = 0.0; /* node gain */
+ double m_offset = 0.0; /* node offset */
+ uint8_t m_data = 0; /* data written */
+ uint8_t m_is_buffered = 0;
/* the buffer stream */
- sound_stream *m_buffer_stream;
+ sound_stream *m_buffer_stream = nullptr;
};
class DISCRETE_CLASS_NAME(dss_input_buffer): public DISCRETE_CLASS_NAME(dss_input_stream)
@@ -251,7 +251,7 @@ class DISCRETE_CLASS_NAME(dss_input_buffer): public DISCRETE_CLASS_NAME(dss_inpu
DISCRETE_CLASS_CONSTRUCTOR(dss_input_buffer, dss_input_stream)
DISCRETE_CLASS_DESTRUCTOR(dss_input_buffer)
public:
- virtual bool is_buffered(void) override { return true; }
+ virtual bool is_buffered() override { return true; }
};
#include "disc_wav.h"
diff --git a/src/devices/sound/disc_dev.hxx b/src/devices/sound/disc_dev.hxx
index e18d4d36711..385e84f751a 100644
--- a/src/devices/sound/disc_dev.hxx
+++ b/src/devices/sound/disc_dev.hxx
@@ -63,13 +63,13 @@ DISCRETE_STEP(dsd_555_astbl)
int count_f = 0;
int count_r = 0;
- double dt; /* change in time */
- double x_time = 0; /* time since change happened */
+ double dt; /* change in time */
+ double x_time = 0; /* time since change happened */
double v_cap = m_cap_voltage; /* Current voltage on capacitor, before dt */
- double v_cap_next = 0; /* Voltage on capacitor, after dt */
+ double v_cap_next = 0; /* Voltage on capacitor, after dt */
double v_charge, exponent = 0;
- uint8_t flip_flop = m_flip_flop;
- uint8_t update_exponent = 0;
+ uint8_t flip_flop = m_flip_flop;
+ uint8_t update_exponent = 0;
double v_out = 0.0;
/* put commonly used stuff in local variables for speed */
diff --git a/src/devices/sound/disc_flt.h b/src/devices/sound/disc_flt.h
index 63ee98b24ea..85cd292e2aa 100644
--- a/src/devices/sound/disc_flt.h
+++ b/src/devices/sound/disc_flt.h
@@ -25,155 +25,155 @@
struct discrete_filter_coeff
{
- double x1, x2; /* x[k-1], x[k-2], previous 2 input values */
- double y1, y2; /* y[k-1], y[k-2], previous 2 output values */
- double a1, a2; /* digital filter coefficients, denominator */
- double b0, b1, b2; /* digital filter coefficients, numerator */
+ double x1 = 0.0, x2 = 0.0; /* x[k-1], x[k-2], previous 2 input values */
+ double y1 = 0.0, y2 = 0.0; /* y[k-1], y[k-2], previous 2 output values */
+ double a1 = 0.0, a2 = 0.0; /* digital filter coefficients, denominator */
+ double b0 = 0.0, b1 = 0.0, b2 = 0.0; /* digital filter coefficients, numerator */
};
DISCRETE_CLASS_STEP_RESET(dst_filter1, 1,
/* uses x1, y1, a1, b0, b1 */
- struct discrete_filter_coeff m_fc;
+ discrete_filter_coeff m_fc;
);
DISCRETE_CLASS_STEP_RESET(dst_filter2, 1,
- struct discrete_filter_coeff m_fc;
+ discrete_filter_coeff m_fc;
);
DISCRETE_CLASS_STEP_RESET(dst_sallen_key, 1,
- struct discrete_filter_coeff m_fc;
+ discrete_filter_coeff m_fc;
);
DISCRETE_CLASS_STEP_RESET(dst_crfilter, 1,
- double m_vCap;
- double m_rc;
- double m_exponent;
- uint8_t m_has_rc_nodes;
- //uint8_t m_is_fast;
+ double m_vCap = 0.0;
+ double m_rc = 0.0;
+ double m_exponent = 0.0;
+ uint8_t m_has_rc_nodes = 0;
+ //uint8_t m_is_fast = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_op_amp_filt, 1,
- int m_type; /* What kind of filter */
- int m_is_norton; /* 1 = Norton op-amps */
- double m_vRef;
- double m_vP;
- double m_vN;
- double m_rTotal; /* All input resistance in parallel. */
- double m_iFixed; /* Current supplied by r3 & r4 if used. */
- double m_exponentC1;
- double m_exponentC2;
- double m_exponentC3;
- double m_rRatio; /* divide ratio of resistance network */
- double m_vC1; /* Charge on C1 */
- double m_vC1b; /* Charge on C1, part of C1 charge if needed */
- double m_vC2; /* Charge on C2 */
- double m_vC3; /* Charge on C2 */
- double m_gain; /* Gain of the filter */
- struct discrete_filter_coeff m_fc;
+ int m_type = 0; /* What kind of filter */
+ int m_is_norton = 0; /* 1 = Norton op-amps */
+ double m_vRef = 0.0;
+ double m_vP = 0.0;
+ double m_vN = 0.0;
+ double m_rTotal = 0.0; /* All input resistance in parallel. */
+ double m_iFixed = 0.0; /* Current supplied by r3 & r4 if used. */
+ double m_exponentC1 = 0.0;
+ double m_exponentC2 = 0.0;
+ double m_exponentC3 = 0.0;
+ double m_rRatio = 0.0; /* divide ratio of resistance network */
+ double m_vC1 = 0.0; /* Charge on C1 */
+ double m_vC1b = 0.0; /* Charge on C1, part of C1 charge if needed */
+ double m_vC2 = 0.0; /* Charge on C2 */
+ double m_vC3 = 0.0; /* Charge on C2 */
+ double m_gain = 0.0; /* Gain of the filter */
+ discrete_filter_coeff m_fc;
);
DISCRETE_CLASS_STEP_RESET(dst_rc_circuit_1, 1,
- double m_v_cap;
- double m_v_charge_1_2;
- double m_v_drop;
- double m_exp_1;
- double m_exp_1_2;
- double m_exp_2;
+ double m_v_cap = 0.0;
+ double m_v_charge_1_2 = 0.0;
+ double m_v_drop = 0.0;
+ double m_exp_1 = 0.0;
+ double m_exp_1_2 = 0.0;
+ double m_exp_2 = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc, 1,
- int m_state;
- double m_t; /* time */
- double m_exponent0;
+ int m_state = 0;
+ double m_t = 0.0; /* time */
+ double m_exponent0 = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc2, 1,
- int m_state;
- double m_v_out;
- double m_t; /* time */
- double m_exponent0;
- double m_exponent1;
+ int m_state = 0;
+ double m_v_out = 0.0;
+ double m_t = 0.0; /* time */
+ double m_exponent0 = 0.0;
+ double m_exponent1 = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc3, 1,
- int m_state;
- double m_v_out;
- double m_t; /* time */
- double m_exponent0;
- double m_exponent1;
- double m_v_diode; /* rcdisc3 */
+ int m_state = 0;
+ double m_v_out = 0.0;
+ double m_t = 0.0; /* time */
+ double m_exponent0 = 0.0;
+ double m_exponent1 = 0.0;
+ double m_v_diode = 0.0; /* rcdisc3 */
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc4, 1,
- int m_type;
- double m_max_out;
- double m_vC1;
- double m_v[2];
- double m_exp[2];
+ int m_type = 0;
+ double m_max_out = 0.0;
+ double m_vC1 = 0.0;
+ double m_v[2]{ 0.0 };
+ double m_exp[2]{ 0.0 };
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc5, 1,
- int m_state;
- double m_t; /* time */
- double m_exponent0;
- double m_v_cap; /* rcdisc5 */
+ int m_state = 0;
+ double m_t = 0.0; /* time */
+ double m_exponent0 = 0.0;
+ double m_v_cap = 0.0; /* rcdisc5 */
);
DISCRETE_CLASS_STEP_RESET(dst_rcintegrate, 1,
- int m_type;
- double m_gain_r1_r2;
- double m_f; /* r2,r3 gain */
- double m_vCap;
- double m_vCE;
- double m_exponent0;
- double m_exponent1;
- double m_exp_exponent0;
- double m_exp_exponent1;
- double m_c_exp0;
- double m_c_exp1;
- double m_EM_IC_0_7;
+ int m_type = 0;
+ double m_gain_r1_r2 = 0.0;
+ double m_f = 0.0; /* r2,r3 gain */
+ double m_vCap = 0.0;
+ double m_vCE = 0.0;
+ double m_exponent0 = 0.0;
+ double m_exponent1 = 0.0;
+ double m_exp_exponent0 = 0.0;
+ double m_exp_exponent1 = 0.0;
+ double m_c_exp0 = 0.0;
+ double m_c_exp1 = 0.0;
+ double m_EM_IC_0_7 = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc_mod, 1,
- double m_v_cap;
- double m_exp_low[2];
- double m_exp_high[4];
- double m_gain[2];
- double m_vd_gain[4];
+ double m_v_cap = 0.0;
+ double m_exp_low[2]{ 0.0 };
+ double m_exp_high[4]{ 0.0 };
+ double m_gain[2]{ 0.0 };
+ double m_vd_gain[4]{ 0.0 };
);
DISCRETE_CLASS_STEP_RESET(dst_rcfilter, 1,
- double m_v_out;
- double m_vCap;
- double m_rc;
- double m_exponent;
- uint8_t m_has_rc_nodes;
- uint8_t m_is_fast;
+ double m_v_out = 0.0;
+ double m_vCap = 0.0;
+ double m_rc = 0.0;
+ double m_exponent = 0.0;
+ uint8_t m_has_rc_nodes = 0;
+ uint8_t m_is_fast = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_rcfilter_sw, 1,
- double m_vCap[4];
- double m_exp[4];
- double m_exp0; /* fast case bit 0 */
- double m_exp1; /* fast case bit 1 */
- double m_factor; /* fast case */
- double m_f1[16];
- double m_f2[16];
+ double m_vCap[4]{ 0.0 };
+ double m_exp[4]{ 0.0 };
+ double m_exp0 = 0.0; /* fast case bit 0 */
+ double m_exp1 = 0.0; /* fast case bit 1 */
+ double m_factor = 0.0; /* fast case */
+ double m_f1[16]{ 0.0 };
+ double m_f2[16]{ 0.0 };
);
DISCRETE_CLASS_STEP_RESET(dst_rcdiscN, 1,
- double m_x1; /* x[k-1], previous input value */
- double m_y1; /* y[k-1], previous output value */
- double m_a1; /* digital filter coefficients, denominator */
- //double m_b[2]; /* digital filter coefficients, numerator */
+ double m_x1 = 0.0; /* x[k-1], previous input value */
+ double m_y1 = 0.0; /* y[k-1], previous output value */
+ double m_a1 = 0.0; /* digital filter coefficients, denominator */
+ //double m_b[2]{ 0.0 }; /* digital filter coefficients, numerator */
);
DISCRETE_CLASS_STEP_RESET(dst_rcdisc2N, 1,
- struct discrete_filter_coeff m_fc0;
- struct discrete_filter_coeff m_fc1;
- double m_x1;
- double m_y1;
+ discrete_filter_coeff m_fc0;
+ discrete_filter_coeff m_fc1;
+ double m_x1 = 0.0;
+ double m_y1 = 0.0;
);
diff --git a/src/devices/sound/disc_mth.h b/src/devices/sound/disc_mth.h
index 418554b2ce4..58b6f5f1437 100644
--- a/src/devices/sound/disc_mth.h
+++ b/src/devices/sound/disc_mth.h
@@ -34,11 +34,11 @@ DISCRETE_CLASS_STEP(dst_gain, 1, /* no context */ );
DISCRETE_CLASS_STEP(dst_logic_inv, 1, /* no context */ );
DISCRETE_CLASS_STEP_RESET(dst_bits_decode, 8,
- int m_count;
- int m_decode_x_time;
- int m_from;
- int m_last_val;
- int m_last_had_x_time;
+ int m_count = 0;
+ int m_decode_x_time = 0;
+ int m_from = 0;
+ int m_last_val = 0;
+ int m_last_had_x_time = 0;
);
DISCRETE_CLASS_STEP(dst_logic_and, 1, /* no context */ );
@@ -54,47 +54,47 @@ DISCRETE_CLASS_STEP(dst_logic_xor, 1, /* no context */ );
DISCRETE_CLASS_STEP(dst_logic_nxor, 1, /* no context */ );
DISCRETE_CLASS_STEP_RESET(dst_logic_dff, 1,
- int m_last_clk;
+ int m_last_clk = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_logic_jkff, 1,
- double m_v_out;
- int m_last_clk;
+ double m_v_out = 0;
+ int m_last_clk = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_logic_shift, 1,
- double m_t_left; /* time unused during last sample in seconds */
- uint32_t m_shift_data;
- uint32_t m_bit_mask;
- uint8_t m_clock_type;
- uint8_t m_reset_on_high;
- uint8_t m_shift_r;
- uint8_t m_last;
+ double m_t_left = 0.0; /* time unused during last sample in seconds */
+ uint32_t m_shift_data = 0;
+ uint32_t m_bit_mask = 0;
+ uint8_t m_clock_type = 0;
+ uint8_t m_reset_on_high = 0;
+ uint8_t m_shift_r = 0;
+ uint8_t m_last = 0;
);
DISCRETE_CLASS_STEP(dst_lookup_table, 1, /* no context */ );
DISCRETE_CLASS_STEP_RESET(dst_multiplex, 1,
- int m_size;
+ int m_size = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_oneshot, 1,
- double m_countdown;
- int m_state;
- int m_last_trig;
- int m_type;
+ double m_countdown = 0.0;
+ int m_state = 0;
+ int m_last_trig = 0;
+ int m_type = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_ramp, 1,
- double m_v_out;
- double m_step;
- int m_dir; /* 1 if End is higher then Start */
- int m_last_en; /* Keep track of the last enable value */
+ double m_v_out = 0.0;
+ double m_step = 0.0;
+ int m_dir = 0; /* 1 if End is higher then Start */
+ int m_last_en = 0; /* Keep track of the last enable value */
);
DISCRETE_CLASS_STEP_RESET(dst_samphold, 1,
- double m_last_input;
- int m_clocktype;
+ double m_last_input = 0.0;
+ int m_clocktype = 0;
);
DISCRETE_CLASS_STEP(dst_switch, 1, /* no context */ );
@@ -129,102 +129,102 @@ public:
TOK_OR, /* Bitwise OR */
TOK_XOR /* Bitwise XOR */
};
- void step(void) override;
- void reset(void) override;
+ void step() override;
+ void reset() override;
private:
DISCRETE_CLASS_INPUT(I_IN0, 0);
DISCRETE_CLASS_INPUT(I_IN1, 1);
DISCRETE_CLASS_INPUT(I_IN2, 2);
DISCRETE_CLASS_INPUT(I_IN3, 3);
DISCRETE_CLASS_INPUT(I_IN4, 4);
- enum token precomp[32];
+ enum token precomp[32]{ TOK_END };
};
/* Component specific */
DISCRETE_CLASS_STEP_RESET(dst_comp_adder, 1,
- double m_total[256];
+ double m_total[256]{ 0.0 };
);
DISCRETE_CLASS_STEP_RESET(dst_dac_r1, 1,
- double m_v_out;
- double m_exponent;
- double m_last_v;
- double m_v_step[256];
- int m_has_c_filter;
+ double m_v_out = 0.0;
+ double m_exponent = 0.0;
+ double m_last_v = 0.0;
+ double m_v_step[256]{ 0.0 };
+ int m_has_c_filter = 0;
);
DISCRETE_CLASS_STEP_RESET(dst_diode_mix, 1,
- int m_size;
- double m_v_junction[8];
+ int m_size = 0;
+ double m_v_junction[8]{ 0.0 };
);
DISCRETE_CLASS_STEP_RESET(dst_integrate, 1,
- double m_v_out;
- double m_change;
- double m_v_max_in; /* v1 - norton VBE */
- double m_v_max_in_d; /* v1 - norton VBE - diode drop */
- double m_v_max_out;
+ double m_v_out = 0.0;
+ double m_change = 0.0;
+ double m_v_max_in = 0.0; /* v1 - norton VBE */
+ double m_v_max_in_d = 0.0; /* v1 - norton VBE - diode drop */
+ double m_v_max_out = 0.0;
);
#define DISC_MIXER_MAX_INPS 8
DISCRETE_CLASS_STEP_RESET(dst_mixer, 1,
- int m_type;
- int m_size;
- int m_r_node_bit_flag;
- int m_c_bit_flag;
- double m_r_total;
- const double * m_r_node[DISC_MIXER_MAX_INPS]; /* Either pointer to resistance node output OR nullptr */
- double m_r_last[DISC_MIXER_MAX_INPS];
- double m_exponent_rc[DISC_MIXER_MAX_INPS]; /* For high pass filtering cause by cIn */
- double m_v_cap[DISC_MIXER_MAX_INPS]; /* cap voltage of each input */
- double m_exponent_c_f; /* Low pass on mixed inputs */
- double m_exponent_c_amp; /* Final high pass caused by out cap and amp input impedance */
- double m_v_cap_f; /* cap voltage of cF */
- double m_v_cap_amp; /* cap voltage of cAmp */
- double m_gain; /* used for DISC_MIXER_IS_OP_AMP_WITH_RI */
+ int m_type = 0;
+ int m_size = 0;
+ int m_r_node_bit_flag = 0;
+ int m_c_bit_flag = 0;
+ double m_r_total = 0.0;
+ const double * m_r_node[DISC_MIXER_MAX_INPS]{ nullptr }; /* Either pointer to resistance node output OR nullptr */
+ double m_r_last[DISC_MIXER_MAX_INPS]{ 0.0 };
+ double m_exponent_rc[DISC_MIXER_MAX_INPS]{ 0.0 }; /* For high pass filtering cause by cIn */
+ double m_v_cap[DISC_MIXER_MAX_INPS]{ 0.0 }; /* cap voltage of each input */
+ double m_exponent_c_f = 0.0; /* Low pass on mixed inputs */
+ double m_exponent_c_amp = 0.0; /* Final high pass caused by out cap and amp input impedance */
+ double m_v_cap_f = 0.0; /* cap voltage of cF */
+ double m_v_cap_amp = 0.0; /* cap voltage of cAmp */
+ double m_gain = 0.0; /* used for DISC_MIXER_IS_OP_AMP_WITH_RI */
);
DISCRETE_CLASS_STEP_RESET(dst_op_amp, 1,
- uint8_t m_has_cap;
- uint8_t m_has_r1;
- uint8_t m_has_r4;
- double m_v_max;
- double m_i_fixed;
- double m_v_cap;
- double m_exponent;
+ uint8_t m_has_cap = 0;
+ uint8_t m_has_r1 = 0;
+ uint8_t m_has_r4 = 0;
+ double m_v_max = 0.0;
+ double m_i_fixed = 0.0;
+ double m_v_cap = 0.0;
+ double m_exponent = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dst_op_amp_1sht, 1,
- double m_v_out;
- double m_i_fixed;
- double m_v_max;
- double m_r34ratio;
- double m_v_cap1;
- double m_v_cap2;
- double m_exponent1c;
- double m_exponent1d;
- double m_exponent2;
+ double m_v_out = 0.0;
+ double m_i_fixed = 0.0;
+ double m_v_max = 0.0;
+ double m_r34ratio = 0.0;
+ double m_v_cap1 = 0.0;
+ double m_v_cap2 = 0.0;
+ double m_exponent1c = 0.0;
+ double m_exponent1d = 0.0;
+ double m_exponent2 = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dst_tvca_op_amp, 1,
- double m_v_out_max; /* Maximum output voltage */
- double m_v_trig[2]; /* Voltage used to charge cap1 based on function F3 */
- double m_v_trig2; /* Voltage used to charge cap2 */
- double m_v_trig3; /* Voltage used to charge cap3 */
- double m_i_fixed; /* Fixed current going into - input */
- double m_exponent_c[2]; /* Charge exponents based on function F3 */
- double m_exponent_d[2]; /* Discharge exponents based on function F3 */
- double m_exponent2[2]; /* Discharge/charge exponents based on function F4 */
- double m_exponent3[2]; /* Discharge/charge exponents based on function F5 */
- double m_exponent4; /* Discharge/charge exponents for c4 */
- double m_v_cap1; /* charge on cap c1 */
- double m_v_cap2; /* charge on cap c2 */
- double m_v_cap3; /* charge on cap c3 */
- double m_v_cap4; /* charge on cap c4 */
- double m_r67; /* = r6 + r7 (for easy use later) */
- uint8_t m_has_c4;
- uint8_t m_has_r4;
+ double m_v_out_max = 0.0; /* Maximum output voltage */
+ double m_v_trig[2]{ 0.0 }; /* Voltage used to charge cap1 based on function F3 */
+ double m_v_trig2 = 0.0; /* Voltage used to charge cap2 */
+ double m_v_trig3 = 0.0; /* Voltage used to charge cap3 */
+ double m_i_fixed = 0.0; /* Fixed current going into - input */
+ double m_exponent_c[2]{ 0.0 }; /* Charge exponents based on function F3 */
+ double m_exponent_d[2]{ 0.0 }; /* Discharge exponents based on function F3 */
+ double m_exponent2[2]{ 0.0 }; /* Discharge/charge exponents based on function F4 */
+ double m_exponent3[2]{ 0.0 }; /* Discharge/charge exponents based on function F5 */
+ double m_exponent4 = 0.0; /* Discharge/charge exponents for c4 */
+ double m_v_cap1 = 0.0; /* charge on cap c1 */
+ double m_v_cap2 = 0.0; /* charge on cap c2 */
+ double m_v_cap3 = 0.0; /* charge on cap c3 */
+ double m_v_cap4 = 0.0; /* charge on cap c4 */
+ double m_r67 = 0.0; /* = r6 + r7 (for easy use later) */
+ uint8_t m_has_c4 = 0;
+ uint8_t m_has_r4 = 0;
);
DISCRETE_CLASS_STEP(dst_xtime_buffer, 1, /* no context */ );
diff --git a/src/devices/sound/disc_wav.h b/src/devices/sound/disc_wav.h
index 5c6e23dd399..81359783f49 100644
--- a/src/devices/sound/disc_wav.h
+++ b/src/devices/sound/disc_wav.h
@@ -24,75 +24,75 @@
#include "discrete.h"
DISCRETE_CLASS_STEP_RESET(dss_counter, 1,
- int m_clock_type;
- int m_out_type;
- int m_is_7492;
- int m_last_clock;
- uint32_t m_last_count;
- //uint32_t m_last; /* Last clock state */
- uint32_t m_min;
- uint32_t m_max;
- uint32_t m_diff;
- double m_t_left; /* time unused during last sample in seconds */
+ int m_clock_type = 0;
+ int m_out_type = 0;
+ int m_is_7492 = 0;
+ int m_last_clock = 0;
+ uint32_t m_last_count = 0;
+ //uint32_t m_last = 0; /* Last clock state */
+ uint32_t m_min = 0;
+ uint32_t m_max = 0;
+ uint32_t m_diff = 0;
+ double m_t_left = 0.0; /* time unused during last sample in seconds */
);
DISCRETE_CLASS_STEP_RESET(dss_lfsr_noise, 2,
- unsigned int m_lfsr_reg;
- int m_last; /* Last clock state */
- double m_t_clock; /* fixed counter clock in seconds */
- double m_t_left; /* time unused during last sample in seconds */
- //double m_sample_step;
- //double m_t;
- uint8_t m_reset_on_high;
- uint8_t m_invert_output;
- uint8_t m_out_is_f0;
- uint8_t m_out_lfsr_reg;
+ unsigned int m_lfsr_reg = 0;
+ int m_last = 0; /* Last clock state */
+ double m_t_clock = 0.0; /* fixed counter clock in seconds */
+ double m_t_left = 0.0; /* time unused during last sample in seconds */
+ //double m_sample_step = 0.0;
+ //double m_t = 0.0;
+ uint8_t m_reset_on_high = 0;
+ uint8_t m_invert_output = 0;
+ uint8_t m_out_is_f0 = 0;
+ uint8_t m_out_lfsr_reg = 0;
);
DISCRETE_CLASS_STEP_RESET(dss_noise, 2,
- double m_phase;
+ double m_phase = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dss_note, 1,
- int m_clock_type;
- int m_out_type;
- int m_last; /* Last clock state */
- double m_t_clock; /* fixed counter clock in seconds */
- double m_t_left; /* time unused during last sample in seconds */
- int m_max1; /* Max 1 Count stored as int for easy use. */
- int m_max2; /* Max 2 Count stored as int for easy use. */
- int m_count1; /* current count1 */
- int m_count2; /* current count2 */
+ int m_clock_type = 0;
+ int m_out_type = 0;
+ int m_last = 0; /* Last clock state */
+ double m_t_clock = 0.0; /* fixed counter clock in seconds */
+ double m_t_left = 0.0; /* time unused during last sample in seconds */
+ int m_max1 = 0; /* Max 1 Count stored as int for easy use. */
+ int m_max2 = 0; /* Max 2 Count stored as int for easy use. */
+ int m_count1 = 0; /* current count1 */
+ int m_count2 = 0; /* current count2 */
);
DISCRETE_CLASS_STEP_RESET(dss_sawtoothwave, 1,
- double m_phase;
- int m_type;
+ double m_phase = 0.0;
+ int m_type = 0;
);
DISCRETE_CLASS_STEP_RESET(dss_sinewave, 1,
- double m_phase;
+ double m_phase = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dss_squarewave, 1,
- double m_phase;
- double m_trigger;
+ double m_phase = 0.0;
+ double m_trigger = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dss_squarewfix, 1,
- int m_flip_flop;
- double m_sample_step;
- double m_t_left;
- double m_t_off;
- double m_t_on;
+ int m_flip_flop = 0;
+ double m_sample_step = 0.0;
+ double m_t_left = 0.0;
+ double m_t_off = 0.0;
+ double m_t_on = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dss_squarewave2, 1,
- double m_phase;
- double m_trigger;
+ double m_phase = 0.0;
+ double m_trigger = 0.0;
);
DISCRETE_CLASS_STEP_RESET(dss_trianglewave, 1,
- double m_phase;
+ double m_phase = 0.0;
);
/* Component specific modules */
@@ -107,13 +107,13 @@ class DISCRETE_CLASS_NAME(dss_inverter_osc): public discrete_base_node, public d
public:
struct description
{
- double vB;
- double vOutLow;
- double vOutHigh;
- double vInFall; // voltage that triggers the gate input to go low (0V) on fall
- double vInRise; // voltage that triggers the gate input to go high (vGate) on rise
- double clamp; // voltage is clamped to -clamp ... vb+clamp if clamp>= 0;
- int options; // bitmapped options
+ double vB = 0.0;
+ double vOutLow = 0.0;
+ double vOutHigh = 0.0;
+ double vInFall = 0.0; // voltage that triggers the gate input to go low (0V) on fall
+ double vInRise = 0.0; // voltage that triggers the gate input to go high (vGate) on rise
+ double clamp = 0.0; // voltage is clamped to -clamp ... vb+clamp if clamp>= 0;
+ int options = 0.0; // bitmapped options
};
enum {
IS_TYPE1 = 0x00,
@@ -124,8 +124,8 @@ public:
TYPE_MASK = 0x0f,
OUT_IS_LOGIC = 0x10
};
- void step(void) override;
- void reset(void) override;
+ void step() override;
+ void reset() override;
protected:
inline double tftab(double x);
inline double tf(double x);
@@ -137,56 +137,56 @@ private:
DISCRETE_CLASS_INPUT(I_C, 4);
DISCRETE_CLASS_INPUT(I_R2, 5);
- double mc_v_cap;
- double mc_v_g2_old;
- double mc_w;
- double mc_wc;
- double mc_rp;
- double mc_r1;
- double mc_r2;
- double mc_c;
- double mc_tf_a;
- double mc_tf_b;
- double mc_tf_tab[DSS_INV_TAB_SIZE];
+ double mc_v_cap = 0.0;
+ double mc_v_g2_old = 0.0;
+ double mc_w = 0.0;
+ double mc_wc = 0.0;
+ double mc_rp = 0.0;
+ double mc_r1 = 0.0;
+ double mc_r2 = 0.0;
+ double mc_c = 0.0;
+ double mc_tf_a = 0.0;
+ double mc_tf_b = 0.0;
+ double mc_tf_tab[DSS_INV_TAB_SIZE]{ 0.0 };
};
DISCRETE_CLASS_STEP_RESET(dss_op_amp_osc, 1,
- const double * m_r[8]; /* pointers to resistor values */
- int m_type;
- uint8_t m_flip_flop; /* flip/flop output state */
- uint8_t m_flip_flop_xor; /* flip_flop ^ flip_flop_xor, 0 = discharge, 1 = charge */
- uint8_t m_output_type;
- uint8_t m_has_enable;
- double m_v_out_high;
- double m_threshold_low; /* falling threshold */
- double m_threshold_high; /* rising threshold */
- double m_v_cap; /* current capacitor voltage */
- double m_r_total; /* all input resistors in parallel */
- double m_i_fixed; /* fixed current at the input */
- double m_i_enable; /* fixed current at the input if enabled */
- double m_temp1; /* Multi purpose */
- double m_temp2; /* Multi purpose */
- double m_temp3; /* Multi purpose */
- double m_is_linear_charge;
- double m_charge_rc[2];
- double m_charge_exp[2];
- double m_charge_v[2];
+ const double * m_r[8]{ nullptr }; /* pointers to resistor values */
+ int m_type = 0;
+ uint8_t m_flip_flop = 0; /* flip/flop output state */
+ uint8_t m_flip_flop_xor = 0; /* flip_flop ^ flip_flop_xor, 0 = discharge, 1 = charge */
+ uint8_t m_output_type = 0;
+ uint8_t m_has_enable = 0;
+ double m_v_out_high = 0.0;
+ double m_threshold_low = 0.0; /* falling threshold */
+ double m_threshold_high = 0.0; /* rising threshold */
+ double m_v_cap = 0.0; /* current capacitor voltage */
+ double m_r_total = 0.0; /* all input resistors in parallel */
+ double m_i_fixed = 0.0; /* fixed current at the input */
+ double m_i_enable = 0.0; /* fixed current at the input if enabled */
+ double m_temp1 = 0.0; /* Multi purpose */
+ double m_temp2 = 0.0; /* Multi purpose */
+ double m_temp3 = 0.0; /* Multi purpose */
+ double m_is_linear_charge = 0.0;
+ double m_charge_rc[2]{ 0.0 };
+ double m_charge_exp[2]{ 0.0 };
+ double m_charge_v[2]{ 0.0 };
);
DISCRETE_CLASS_STEP_RESET(dss_schmitt_osc, 1,
- double m_ration_in; /* ratio of total charging voltage that comes from the input */
- double m_ratio_feedback; /* ratio of total charging voltage that comes from the feedback */
- double m_v_cap; /* current capacitor voltage */
- double m_rc; /* r*c */
- double m_exponent;
- int m_state; /* state of the output */
- int m_enable_type;
- uint8_t m_input_is_voltage;
+ double m_ration_in = 0.0; /* ratio of total charging voltage that comes from the input */
+ double m_ratio_feedback = 0.0; /* ratio of total charging voltage that comes from the feedback */
+ double m_v_cap = 0.0; /* current capacitor voltage */
+ double m_rc = 0.0; /* r*c */
+ double m_exponent = 0.0;
+ int m_state = 0; /* state of the output */
+ int m_enable_type = 0;
+ uint8_t m_input_is_voltage = 0;
);
/* Not yet implemented */
DISCRETE_CLASS_STEP_RESET(dss_adsrenv, 1,
- //double m_phase;
+ //double m_phase = 0.0;
);
diff --git a/src/devices/sound/discrete.h b/src/devices/sound/discrete.h
index 7929353dbce..eebc4936df7 100644
--- a/src/devices/sound/discrete.h
+++ b/src/devices/sound/discrete.h
@@ -7,6 +7,7 @@
#include "machine/rescap.h"
+#include <memory>
#include <vector>
@@ -4177,8 +4178,6 @@ class discrete_sound_output_interface;
class discrete_device : public device_t
{
- //friend class discrete_base_node;
-
protected:
// construction/destruction
discrete_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -4410,7 +4409,7 @@ class discrete_node_factory
public:
static std::unique_ptr<discrete_base_node> create(discrete_device &pdev, const discrete_block &block)
{
- std::unique_ptr<discrete_base_node> r = make_unique_clear<C>();
+ std::unique_ptr<discrete_base_node> r = std::make_unique<C>();
r->init(&pdev, &block);
return r;
diff --git a/src/devices/sound/mos6581.cpp b/src/devices/sound/mos6581.cpp
index 4ee3ddd7ebd..6682ddca4fe 100644
--- a/src/devices/sound/mos6581.cpp
+++ b/src/devices/sound/mos6581.cpp
@@ -45,7 +45,6 @@ mos6581_device::mos6581_device(const machine_config &mconfig, device_type type,
, m_read_poty(*this)
, m_stream(nullptr)
, m_variant(variant)
- , m_token(make_unique_clear<SID6581_t>())
{
}
@@ -202,6 +201,7 @@ void mos6581_device::device_start()
m_stream = stream_alloc(0, 1, machine().sample_rate());
// initialize SID engine
+ m_token = std::make_unique<SID6581_t>();
m_token->device = this;
m_token->mixer_channel = m_stream;
m_token->PCMfreq = machine().sample_rate();
diff --git a/src/devices/sound/sid.h b/src/devices/sound/sid.h
index ecf27c2b300..0b0af441879 100644
--- a/src/devices/sound/sid.h
+++ b/src/devices/sound/sid.h
@@ -17,42 +17,42 @@ struct SID6581_t
{
static constexpr uint8_t max_voices = 3;
- device_t *device;
- sound_stream *mixer_channel; // mame stream/ mixer channel
+ device_t *device = nullptr;
+ sound_stream *mixer_channel = nullptr; // mame stream/ mixer channel
- int type;
- uint32_t clock;
+ int type = 0;
+ uint32_t clock = 0;
- uint16_t PCMfreq; // samplerate of the current systems soundcard/DAC
- uint32_t PCMsid, PCMsidNoise;
+ uint16_t PCMfreq = 0; // samplerate of the current systems soundcard/DAC
+ uint32_t PCMsid = 0, PCMsidNoise = 0;
#if 0
/* following depends on type */
- ptr2sidVoidFunc ModeNormalTable[16];
- ptr2sidVoidFunc ModeRingTable[16];
+ ptr2sidVoidFunc ModeNormalTable[16]{ nullptr };
+ ptr2sidVoidFunc ModeRingTable[16]{ nullptr };
// for speed reason it could be better to make them global!
- uint8_t* waveform30;
- uint8_t* waveform50;
- uint8_t* waveform60;
- uint8_t* waveform70;
+ uint8_t *waveform30 = nullptr;
+ uint8_t *waveform50 = nullptr;
+ uint8_t *waveform60 = nullptr;
+ uint8_t *waveform70 = nullptr;
#endif
- int reg[0x20];
+ int reg[0x20]{ 0 };
-// bool sidKeysOn[0x20], sidKeysOff[0x20];
+// bool sidKeysOn[0x20]{ false }, sidKeysOff[0x20]{ false };
- uint8_t masterVolume;
- uint16_t masterVolumeAmplIndex;
+ uint8_t masterVolume = 0;
+ uint16_t masterVolumeAmplIndex = 0;
struct
{
- int Enabled;
- uint8_t Type, CurType;
- float Dy, ResDy;
- uint16_t Value;
+ int Enabled = 0;
+ uint8_t Type = 0, CurType = 0;
+ float Dy = 0.0, ResDy = 0.0;
+ uint16_t Value = 0;
} filter;
sidOperator optr[max_voices];
- int optr3_outputmask;
+ int optr3_outputmask = 0;
void init();
diff --git a/src/devices/sound/sidvoice.h b/src/devices/sound/sidvoice.h
index 173b5c070fd..7b555d6dd3f 100644
--- a/src/devices/sound/sidvoice.h
+++ b/src/devices/sound/sidvoice.h
@@ -16,81 +16,81 @@ struct sidOperator
{
struct sw_storage
{
- uint16_t len;
+ uint16_t len = 0;
#if defined(DIRECT_FIXPOINT)
- uint32_t stp;
+ uint32_t stp = 0;
#else
- uint32_t pnt;
- int16_t stp;
+ uint32_t pnt = 0;
+ int16_t stp = 0;
#endif
};
- SID6581_t *sid;
- uint8_t reg[7];
- uint32_t SIDfreq;
- uint16_t SIDpulseWidth;
- uint8_t SIDctrl;
- uint8_t SIDAD, SIDSR;
+ SID6581_t *sid = nullptr;
+ uint8_t reg[7]{ 0 };
+ uint32_t SIDfreq = 0;
+ uint16_t SIDpulseWidth = 0;
+ uint8_t SIDctrl = 0;
+ uint8_t SIDAD = 0, SIDSR = 0;
- sidOperator* carrier;
- sidOperator* modulator;
- int sync;
+ sidOperator *carrier = nullptr;
+ sidOperator *modulator = nullptr;
+ int sync = 0;
- uint16_t pulseIndex, newPulseIndex;
- uint16_t curSIDfreq;
- uint16_t curNoiseFreq;
+ uint16_t pulseIndex = 0, newPulseIndex = 0;
+ uint16_t curSIDfreq = 0;
+ uint16_t curNoiseFreq = 0;
- uint8_t output;//, outputMask;
+ uint8_t output = 0/*, outputMask = 0*/;
- char filtVoiceMask;
- int filtEnabled;
- float filtLow, filtRef;
- int8_t filtIO;
+ char filtVoiceMask = 0;
+ int filtEnabled = 0;
+ float filtLow = 0, filtRef = 0;
+ int8_t filtIO = 0;
- int32_t cycleLenCount;
+ int32_t cycleLenCount = 0;
#if defined(DIRECT_FIXPOINT)
PAIR cycleLen, cycleAddLen;
#else
- uint32_t cycleAddLenPnt;
- uint16_t cycleLen, cycleLenPnt;
+ uint32_t cycleAddLenPnt = 0;
+ uint16_t cycleLen, cycleLenPnt = 0;
#endif
- int8_t (*outProc)(sidOperator *);
- void (*waveProc)(sidOperator *);
+ int8_t (*outProc)(sidOperator *) = nullptr;
+ void (*waveProc)(sidOperator *) = nullptr;
#if defined(DIRECT_FIXPOINT)
PAIR waveStep, waveStepAdd;
#else
- uint16_t waveStep, waveStepAdd;
- uint32_t waveStepPnt, waveStepAddPnt;
+ uint16_t waveStep = 0, waveStepAdd = 0;
+ uint32_t waveStepPnt = 0, waveStepAddPnt = 0;
#endif
- uint16_t waveStepOld;
+ uint16_t waveStepOld = 0;
sw_storage wavePre[2];
#if defined(DIRECT_FIXPOINT)
PAIR noiseReg;
#else
- uint32_t noiseReg;
+ uint32_t noiseReg = 0;
#endif
- uint32_t noiseStep, noiseStepAdd;
- uint8_t noiseOutput;
- int noiseIsLocked;
+ uint32_t noiseStep = 0, noiseStepAdd = 0;
+ uint8_t noiseOutput = 0;
+ int noiseIsLocked = 0;
- uint8_t ADSRctrl;
+ uint8_t ADSRctrl = 0;
// int gateOnCtrl, gateOffCtrl;
- uint16_t (*ADSRproc)(sidOperator *);
+ uint16_t (*ADSRproc)(sidOperator *) = nullptr;
#ifdef SID_FPUENVE
- float fenveStep, fenveStepAdd;
- uint32_t enveStep;
+ float fenveStep = 0.0, fenveStepAdd = 0.0;
+ uint32_t enveStep = 0;
#elif defined(DIRECT_FIXPOINT)
PAIR enveStep, enveStepAdd;
#else
- uint16_t enveStep, enveStepAdd;
- uint32_t enveStepPnt, enveStepAddPnt;
+ uint16_t enveStep = 0, enveStepAdd = 0;
+ uint32_t enveStepPnt = 0, enveStepAddPnt = 0;
#endif
- uint8_t enveVol, enveSusVol;
- uint16_t enveShortAttackCount;
+ uint8_t enveVol = 0, enveSusVol = 0;
+ uint16_t enveShortAttackCount = 0;
void clear();