summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound')
-rw-r--r--src/devices/sound/pokey.cpp4
-rw-r--r--src/devices/sound/pokey.h140
-rw-r--r--src/devices/sound/sn76477.h40
-rw-r--r--src/devices/sound/tms36xx.h20
-rw-r--r--src/devices/sound/tms5110.h58
-rw-r--r--src/devices/sound/tms5220.h42
6 files changed, 64 insertions, 240 deletions
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 53ad7f26fdf..487a1b4e83b 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -183,13 +183,13 @@ pokey_device::pokey_device(const machine_config &mconfig, const char *tag, devic
device_sound_interface(mconfig, *this),
device_execute_interface(mconfig, *this),
device_state_interface(mconfig, *this),
- m_output_type(LEGACY_LINEAR),
m_icount(0),
m_stream(nullptr),
m_pot_r_cb{ {*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this} },
m_allpot_r_cb(*this),
m_serin_r_cb(*this),
- m_serout_w_cb(*this)
+ m_serout_w_cb(*this),
+ m_output_type(LEGACY_LINEAR)
{
}
diff --git a/src/devices/sound/pokey.h b/src/devices/sound/pokey.h
index edcf760f756..ec1a21b3541 100644
--- a/src/devices/sound/pokey.h
+++ b/src/devices/sound/pokey.h
@@ -53,76 +53,6 @@
#define POKEY_KEYBOARD_CB_MEMBER(_name) uint8_t _name(uint8_t k543210)
#define POKEY_INTERRUPT_CB_MEMBER(_name) void _name(int mask)
-
-//**************************************************************************
-// INTERFACE CONFIGURATION MACROS
-//**************************************************************************
-
-#define MCFG_POKEY_POT0_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<0>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT1_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<1>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT2_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<2>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT3_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<3>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT4_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<4>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT5_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<5>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT6_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<6>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_POT7_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_pot_r_callback<7>(DEVCB_##_devcb);
-
-#define MCFG_POKEY_ALLPOT_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_allpot_r_callback(DEVCB_##_devcb);
-
-#define MCFG_POKEY_SERIN_R_CB(_devcb) \
- downcast<pokey_device &>(*device).set_serin_r_callback(DEVCB_##_devcb);
-
-#define MCFG_POKEY_SEROUT_W_CB(_devcb) \
- downcast<pokey_device &>(*device).set_serout_w_callback(DEVCB_##_devcb);
-
-/* k543210 = k5 ... k0 returns bit0: kr1, bit1: kr2 */
-/* all are, in contrast to actual hardware, ACTIVE_HIGH */
-#define MCFG_POKEY_KEYBOARD_CB(_class, _method) \
- downcast<pokey_device &>(*device).set_keyboard_callback(pokey_device::kb_cb_delegate(&_class::_method, #_class "::" #_method, this));
-
-#define MCFG_POKEY_INTERRUPT_CB(_class, _method) \
- downcast<pokey_device &>(*device).set_interrupt_callback(pokey_device::int_cb_delegate(&_class::_method, #_class "::" #_method, this));
-
-
-#define MCFG_POKEY_OUTPUT_RC(_R, _C, _V) \
- (downcast<pokey_device *>(device))->m_output_type = pokey_device::RC_LOWPASS; \
- (downcast<pokey_device *>(device))->m_r_pullup = (_R); \
- (downcast<pokey_device *>(device))->m_cap = (_C); \
- (downcast<pokey_device *>(device))->m_v_ref = (_V);
-
-/* C ignored, please see pokey.c */
-
-#define MCFG_POKEY_OUTPUT_OPAMP(_R, _C, _V) \
- (downcast<pokey_device *>(device))->m_output_type = pokey_device::OPAMP_C_TO_GROUND; \
- (downcast<pokey_device *>(device))->m_r_pullup = (_R); \
- (downcast<pokey_device *>(device))->m_cap = (_C); \
- (downcast<pokey_device *>(device))->m_v_ref = (_V);
-
-#define MCFG_POKEY_OUTPUT_OPAMP_LOW_PASS(_R, _C, _V) \
- (downcast<pokey_device *>(device))->m_output_type = pokey_device::OPAMP_LOW_PASS; \
- (downcast<pokey_device *>(device))->m_r_pullup = (_R); \
- (downcast<pokey_device *>(device))->m_cap = (_C); \
- (downcast<pokey_device *>(device))->m_v_ref = (_V);
-
-#define MCFG_POKEY_OUTPUT_DISCRETE() \
- (downcast<pokey_device *>(device))->m_output_type = pokey_device::DISCRETE_VAR_R;
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -135,10 +65,6 @@ class pokey_device : public device_t,
public device_state_interface
{
public:
-
- typedef device_delegate<uint8_t (uint8_t k543210)> kb_cb_delegate;
- typedef device_delegate<void (int mask)> int_cb_delegate;
-
/* CONSTANT DEFINITIONS */
/* exact 1.79 MHz clock freq (of the Atari 800 that is) */
@@ -210,17 +136,34 @@ public:
// construction/destruction
pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <unsigned N, class Object> devcb_base &set_pot_r_callback(Object &&cb) { return m_pot_r_cb[N].set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_allpot_r_callback(Object &&cb) { return m_allpot_r_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_serin_r_callback(Object &&cb) { return m_serin_r_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_serout_w_callback(Object &&cb) { return m_serout_w_cb.set_callback(std::forward<Object>(cb)); }
template <unsigned N> auto pot_r() { return m_pot_r_cb[N].bind(); }
auto allpot_r() { return m_allpot_r_cb.bind(); }
auto serin_r() { return m_serin_r_cb.bind(); }
auto serout_w() { return m_serout_w_cb.bind(); }
- template <typename Object> void set_keyboard_callback(Object &&cb) { m_keyboard_r = std::forward<Object>(cb); }
- template <typename Object> void set_interrupt_callback(Object &&cb) { m_irq_f = std::forward<Object>(cb); }
+ /* k543210 = k5 ... k0 returns bit0: kr1, bit1: kr2 */
+ /* all are, in contrast to actual hardware, ACTIVE_HIGH */
+ typedef device_delegate<uint8_t (uint8_t k543210)> kb_cb_delegate;
+ void set_keyboard_callback(kb_cb_delegate callback) { m_keyboard_r = callback; }
+ template <class FunctionClass> void set_keyboard_callback(const char *devname, uint8_t (FunctionClass::*callback)(uint8_t), const char *name)
+ {
+ set_keyboard_callback(kb_cb_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr)));
+ }
+ template <class FunctionClass> void set_keyboard_callback(uint8_t (FunctionClass::*callback)(uint8_t), const char *name)
+ {
+ set_keyboard_callback(kb_cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
+ }
+
+ typedef device_delegate<void (int mask)> int_cb_delegate;
+ void set_interrupt_callback(int_cb_delegate callback) { m_irq_f = callback; }
+ template <class FunctionClass> void set_interrupt_callback(const char *devname, void (FunctionClass::*callback)(int), const char *name)
+ {
+ set_interrupt_callback(int_cb_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr)));
+ }
+ template <class FunctionClass> void set_interrupt_callback(void (FunctionClass::*callback)(int), const char *name)
+ {
+ set_interrupt_callback(int_cb_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
+ }
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -229,11 +172,35 @@ public:
void serin_ready(int after);
// analog output configuration
+ void set_output_rc(double r, double c, double v)
+ {
+ m_output_type = pokey_device::RC_LOWPASS;
+ m_r_pullup = r;
+ m_cap = c;
+ m_v_ref = v;
+ }
+
+ /* C ignored, please see pokey.c */
+ void set_output_opamp(double r, double c, double v)
+ {
+ m_output_type = pokey_device::OPAMP_C_TO_GROUND;
+ m_r_pullup = r;
+ m_cap = c;
+ m_v_ref = v;
+ }
- output_type m_output_type;
- double m_r_pullup;
- double m_cap;
- double m_v_ref;
+ void set_output_opamp_low_pass(double r, double c, double v)
+ {
+ m_output_type = pokey_device::OPAMP_LOW_PASS;
+ m_r_pullup = r;
+ m_cap = c;
+ m_v_ref = v;
+ }
+
+ void set_output_discrete()
+ {
+ m_output_type = pokey_device::DISCRETE_VAR_R;
+ }
protected:
// device-level overrides
@@ -357,6 +324,11 @@ private:
uint32_t m_poly9[0x1ff];
uint32_t m_poly17[0x1ffff];
uint32_t m_voltab[0x10000];
+
+ output_type m_output_type;
+ double m_r_pullup;
+ double m_cap;
+ double m_v_ref;
};
diff --git a/src/devices/sound/sn76477.h b/src/devices/sound/sn76477.h
index 04e6386b62b..5e58407cb50 100644
--- a/src/devices/sound/sn76477.h
+++ b/src/devices/sound/sn76477.h
@@ -49,46 +49,6 @@
*
*****************************************************************************/
-
-#define MCFG_SN76477_NOISE_PARAMS(_clock_res, _filter_res, _filter_cap) \
- downcast<sn76477_device &>(*device).set_noise_params(_clock_res, _filter_res, _filter_cap);
-
-#define MCFG_SN76477_DECAY_RES(_decay_res) \
- downcast<sn76477_device &>(*device).set_decay_res(_decay_res);
-
-#define MCFG_SN76477_ATTACK_PARAMS(_decay_cap, _res) \
- downcast<sn76477_device &>(*device).set_attack_params(_decay_cap, _res);
-
-#define MCFG_SN76477_AMP_RES(_amp_res) \
- downcast<sn76477_device &>(*device).set_amp_res(_amp_res);
-
-#define MCFG_SN76477_FEEDBACK_RES(_feedback_res) \
- downcast<sn76477_device &>(*device).set_feedback_res(_feedback_res);
-
-#define MCFG_SN76477_VCO_PARAMS(_volt, _cap, _res) \
- downcast<sn76477_device &>(*device).set_vco_params(_volt, _cap, _res);
-
-#define MCFG_SN76477_PITCH_VOLTAGE(_volt) \
- downcast<sn76477_device &>(*device).set_pitch_voltage(_volt);
-
-#define MCFG_SN76477_SLF_PARAMS(_cap, _res) \
- downcast<sn76477_device &>(*device).set_slf_params(_cap, _res);
-
-#define MCFG_SN76477_ONESHOT_PARAMS(_cap, _res) \
- downcast<sn76477_device &>(*device).set_oneshot_params(_cap, _res);
-
-#define MCFG_SN76477_VCO_MODE(_mode) \
- downcast<sn76477_device &>(*device).set_vco_mode(_mode);
-
-#define MCFG_SN76477_MIXER_PARAMS(_a, _b, _c) \
- downcast<sn76477_device &>(*device).set_mixer_params(_a, _b, _c);
-
-#define MCFG_SN76477_ENVELOPE_PARAMS(_env1, _env2) \
- downcast<sn76477_device &>(*device).set_envelope_params(_env1, _env2);
-
-#define MCFG_SN76477_ENABLE(_enable) \
- downcast<sn76477_device &>(*device).set_enable(_enable);
-
class sn76477_device : public device_t,
public device_sound_interface
{
diff --git a/src/devices/sound/tms36xx.h b/src/devices/sound/tms36xx.h
index 01fdc22d306..3e517a09f77 100644
--- a/src/devices/sound/tms36xx.h
+++ b/src/devices/sound/tms36xx.h
@@ -6,26 +6,6 @@
#pragma once
//**************************************************************************
-// INTERFACE CONFIGURATION MACROS
-//**************************************************************************
-
-#define MCFG_TMS36XX_ADD(tag, clock) \
- MCFG_DEVICE_ADD((tag), TMS36XX, (clock))
-
-#define MCFG_TMS36XX_REPLACE(tag, clock) \
- MCFG_DEVICE_REPLACE((tag), TMS36XX, (clock))
-
-#define MCFG_TMS36XX_TYPE(type) \
- downcast<tms36xx_device &>(*device).set_subtype((tms36xx_device::subtype::type));
-
-#define MCFG_TMS36XX_DECAY_TIMES(_dec0, _dec1, _dec2, _dec3, _dec4, _dec5) \
- downcast<tms36xx_device &>(*device).set_decays(_dec0, _dec1, _dec2, _dec3, _dec4, _dec5);
-
-#define MCFG_TMS36XX_TUNE_SPEED(_speed) \
- downcast<tms36xx_device &>(*device).set_tune_speed(_speed);
-
-
-//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h
index 4857326b697..12f279155eb 100644
--- a/src/devices/sound/tms5110.h
+++ b/src/devices/sound/tms5110.h
@@ -13,22 +13,6 @@
/* usually 640000 for 8000 Hz sample rate or */
/* usually 800000 for 10000 Hz sample rate. */
-#define MCFG_TMS5110_M0_CB(_devcb) \
- downcast<tms5110_device &>(*device).set_m0_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS5110_M1_CB(_devcb) \
- downcast<tms5110_device &>(*device).set_m1_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS5110_ADDR_CB(_devcb) \
- downcast<tms5110_device &>(*device).set_addr_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS5110_DATA_CB(_devcb) \
- downcast<tms5110_device &>(*device).set_data_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS5110_ROMCLK_CB(_devcb) \
- downcast<tms5110_device &>(*device).set_romclk_callback(DEVCB_##_devcb);
-
-
class tms5110_device : public device_t, public device_sound_interface
{
public:
@@ -51,11 +35,6 @@ public:
tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- template <class Object> devcb_base &set_m0_callback(Object &&cb) { return m_m0_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_m1_callback(Object &&cb) { return m_m1_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_addr_callback(Object &&cb) { return m_addr_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_data_callback(Object &&cb) { return m_data_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_romclk_callback(Object &&cb) { return m_romclk_cb.set_callback(std::forward<Object>(cb)); }
auto m0() { return m_m0_cb.bind(); }
auto m1() { return m_m1_cb.bind(); }
auto addr() { return m_addr_cb.bind(); }
@@ -291,8 +270,8 @@ public:
void set_ctl8_bit(uint8_t ctl8_bit) { m_ctl8_bit = ctl8_bit; }
void set_reset_bit(uint8_t reset_bit) { m_reset_bit = reset_bit; }
void set_stop_bit(uint8_t stop_bit) { m_stop_bit = stop_bit; }
- template<class Object> devcb_base &set_pdc_callback(Object object) { return m_pdc_cb.set_callback(std::forward<Object>(object)); }
- template<class Object> devcb_base &set_ctl_callback(Object object) { return m_ctl_cb.set_callback(std::forward<Object>(object)); }
+ auto pdc() { return m_pdc_cb.bind(); }
+ auto ctl() { return m_ctl_cb.bind(); }
DECLARE_WRITE_LINE_MEMBER( m0_w );
DECLARE_READ_LINE_MEMBER( data_r );
@@ -342,37 +321,4 @@ private:
DECLARE_DEVICE_TYPE(TMSPROM, tmsprom_device)
-#define MCFG_TMSPROM_REGION(_region) \
- downcast<tmsprom_device &>(*device).set_region(_region);
-
-#define MCFG_TMSPROM_ROM_SIZE(_size) \
- downcast<tmsprom_device &>(*device).set_rom_size(_size);
-
-#define MCFG_TMSPROM_PDC_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_pdc_bit(_bit);
-
-#define MCFG_TMSPROM_CTL1_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_ctl1_bit(_bit);
-
-#define MCFG_TMSPROM_CTL2_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_ctl2_bit(_bit);
-
-#define MCFG_TMSPROM_CTL4_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_ctl4_bit(_bit);
-
-#define MCFG_TMSPROM_CTL8_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_ctl8_bit(_bit);
-
-#define MCFG_TMSPROM_RESET_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_reset_bit(_bit);
-
-#define MCFG_TMSPROM_STOP_BIT(_bit) \
- downcast<tmsprom_device &>(*device).set_stop_bit(_bit);
-
-#define MCFG_TMSPROM_PDC_CB(_devcb) \
- downcast<tmsprom_device &>(*device).set_pdc_callback(DEVCB_##_devcb);
-
-#define MCFG_TMSPROM_CTL_CB(_devcb) \
- downcast<tmsprom_device &>(*device).set_ctl_callback(DEVCB_##_devcb);
-
#endif // MAME_SOUND_TMS5110_H
diff --git a/src/devices/sound/tms5220.h b/src/devices/sound/tms5220.h
index a14d1ef86ce..712500058ca 100644
--- a/src/devices/sound/tms5220.h
+++ b/src/devices/sound/tms5220.h
@@ -14,34 +14,6 @@
/* usually 640000 for 8000 Hz sample rate or */
/* usually 800000 for 10000 Hz sample rate. */
-/* IRQ callback function, active low, i.e. state=0 */
-#define MCFG_TMS52XX_IRQ_HANDLER(_devcb) \
- downcast<tms5220_device &>(*device).set_irq_handler(DEVCB_##_devcb);
-
-/* Ready callback function, active low, i.e. state=0 */
-#define MCFG_TMS52XX_READYQ_HANDLER(_devcb) \
- downcast<tms5220_device &>(*device).set_readyq_handler(DEVCB_##_devcb);
-
-/* old VSM handler, remove me! */
-#define MCFG_TMS52XX_SPEECHROM(_tag) \
- downcast<tms5220_device &>(*device).set_speechrom_tag(_tag);
-
-/* new VSM handler */
-#define MCFG_TMS52XX_M0_CB(_devcb) \
- downcast<tms5220_device &>(*device).set_m0_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS52XX_M1_CB(_devcb) \
- downcast<tms5220_device &>(*device).set_m1_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS52XX_ADDR_CB(_devcb) \
- downcast<tms5220_device &>(*device).set_addr_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS52XX_DATA_CB(_devcb) \
- downcast<tms5220_device &>(*device).set_data_callback(DEVCB_##_devcb);
-
-#define MCFG_TMS52XX_ROMCLK_CB(_devcb) \
- downcast<tms5220_device &>(device).set_romclk_callback(DEVCB_##_devcb);
-
class tms5220_device : public device_t, public device_sound_interface
{
public:
@@ -53,22 +25,16 @@ public:
tms5220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- // configuration helpers
- template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_readyq_handler(Object &&cb) { return m_readyq_handler.set_callback(std::forward<Object>(cb)); }
-
+ // IRQ callback function, active low, i.e. state=0
auto irq_cb() { return m_irq_handler.bind(); }
+
+ // Ready callback function, active low, i.e. state=0
auto ready_cb() { return m_readyq_handler.bind(); }
// old VSM support, remove me!
void set_speechrom_tag(const char *_tag) { m_speechrom_tag = _tag; }
- // new VSM support
- template <class Object> devcb_base &set_m0_callback(Object &&cb) { return m_m0_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_m1_callback(Object &&cb) { return m_m1_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_addr_callback(Object &&cb) { return m_addr_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_data_callback(Object &&cb) { return m_data_cb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_romclk_callback(Object &&cb) { return m_romclk_cb.set_callback(std::forward<Object>(cb)); }
+ // new VSM support
auto m0_cb() { return m_m0_cb.bind(); }
auto m1_cb() { return m_m1_cb.bind(); }
auto addr_cb() { return m_addr_cb.bind(); }