summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-05-06 00:40:40 +1000
committer Vas Crabb <vas@vastheman.com>2018-05-06 00:51:27 +1000
commit4ea3cd0bc1f54e47a0d38a47afac38101549e9ee (patch)
treebbadc20010b6bad48cf321b1c864655587e4b8ad /src/devices/sound
parentbba5127d7a73ca44fdc0dcab7286846c81206771 (diff)
Streamline machine configuration macros - everyone's a device edition.
Start replacing special device macros with additional constructors, starting with ISA, INTELLEC 4 and RS-232 buses. Allow an object finder to take on the target of another object finder. (For a combination of the previous two things in action, see either the INTELLEC 4 driver, or the Apple 2 PC Exporter card. Also check out looping over a device finder array to instantiate devices in some places. Lots of things no longer need to pass tags around.) Start supplying default clocks for things that have a standard clock or have all clocks internal. Eliminate the separate DEV versions of the DEVCB_ macros. Previously, the plain versions were a shortcut for DEVICE_SELF as the target. You can now supply a string tag (relative to current device being configured), an object finder (takes on the base and relative tag), or a reference to a device/interface (only do this if you know the device won't be replaced out from under it, but that's a safe assumption for your subdevices). In almost all cases, you can get the effect you want by supplying *this as the target. Eliminate sound and CPU versions of macros. They serve no useful purpose, provide no extra checks, make error messages longer, add indirection, and mislead newbies into thinking there's a difference. Remove a lot of now-unnecessary ":" prefixes binding things relative to machine root. Clean up some miscellaneous rot. Examples of new functionality in use in (some more subtle than others): * src/mame/drivers/intellec4.cpp * src/mame/drivers/tranz330.cpp * src/mame/drivers/osboren1.cpp * src/mame/drivers/zorba.cpp * src/mame/devices/smioc.cpp * src/devices/bus/a2bus/pc_xporter.cpp * src/devices/bus/isa/isa.h * src/devices/bus/isa/isa.h * src/devices/bus/intellec4/intellec4.h
Diffstat (limited to 'src/devices/sound')
-rw-r--r--src/devices/sound/ad1848.cpp4
-rw-r--r--src/devices/sound/bsmt2000.cpp8
-rw-r--r--src/devices/sound/cdda.cpp6
-rw-r--r--src/devices/sound/cdda.h2
-rw-r--r--src/devices/sound/cdp1864.h2
-rw-r--r--src/devices/sound/dave.h2
-rw-r--r--src/devices/sound/discrete.h2
-rw-r--r--src/devices/sound/dmadac.h2
-rw-r--r--src/devices/sound/es8712.cpp2
-rw-r--r--src/devices/sound/flt_rc.h14
-rw-r--r--src/devices/sound/mos6560.h6
-rw-r--r--src/devices/sound/qs1000.cpp20
-rw-r--r--src/devices/sound/qsound.cpp10
-rw-r--r--src/devices/sound/samples.h2
-rw-r--r--src/devices/sound/scsp.cpp18
-rw-r--r--src/devices/sound/scsp.h2
-rw-r--r--src/devices/sound/sn76477.h2
-rw-r--r--src/devices/sound/spkrdev.h2
-rw-r--r--src/devices/sound/spu.h6
-rw-r--r--src/devices/sound/upd7759.h8
-rw-r--r--src/devices/sound/wave.h2
21 files changed, 59 insertions, 63 deletions
diff --git a/src/devices/sound/ad1848.cpp b/src/devices/sound/ad1848.cpp
index e434302b554..3644f7749fa 100644
--- a/src/devices/sound/ad1848.cpp
+++ b/src/devices/sound/ad1848.cpp
@@ -23,8 +23,8 @@ ad1848_device::ad1848_device(const machine_config &mconfig, const char *tag, dev
MACHINE_CONFIG_START(ad1848_device::device_add_mconfig)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
- MCFG_SOUND_ADD("ldac", DAC_16BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) // unknown DAC
- MCFG_SOUND_ADD("rdac", DAC_16BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("ldac", DAC_16BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) // unknown DAC
+ MCFG_DEVICE_ADD("rdac", DAC_16BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) // unknown DAC
MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
MCFG_SOUND_ROUTE(0, "ldac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "ldac", -1.0, DAC_VREF_NEG_INPUT)
MCFG_SOUND_ROUTE(0, "rdac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "rdac", -1.0, DAC_VREF_NEG_INPUT)
diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp
index b8c6dad0042..d90a583259d 100644
--- a/src/devices/sound/bsmt2000.cpp
+++ b/src/devices/sound/bsmt2000.cpp
@@ -95,11 +95,11 @@ const tiny_rom_entry *bsmt2000_device::device_rom_region() const
//-------------------------------------------------
MACHINE_CONFIG_START(bsmt2000_device::device_add_mconfig)
- MCFG_CPU_ADD("bsmt2000", TMS32015, DERIVED_CLOCK(1,1))
- MCFG_CPU_PROGRAM_MAP(tms_program_map)
+ MCFG_DEVICE_ADD("bsmt2000", TMS32015, DERIVED_CLOCK(1,1))
+ MCFG_DEVICE_PROGRAM_MAP(tms_program_map)
// data map is internal to the CPU
- MCFG_CPU_IO_MAP(tms_io_map)
- MCFG_TMS32010_BIO_IN_CB(READLINE(bsmt2000_device, tms_write_pending_r))
+ MCFG_DEVICE_IO_MAP(tms_io_map)
+ MCFG_TMS32010_BIO_IN_CB(READLINE(*this, bsmt2000_device, tms_write_pending_r))
MACHINE_CONFIG_END
diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp
index e24a8d9bf46..a0902789386 100644
--- a/src/devices/sound/cdda.cpp
+++ b/src/devices/sound/cdda.cpp
@@ -18,8 +18,8 @@
void cdda_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
get_audio_data(&outputs[0][0], &outputs[1][0], samples);
- m_audio_volume[0] = (int16_t)outputs[0][0];
- m_audio_volume[1] = (int16_t)outputs[1][0];
+ m_audio_volume[0] = int16_t(outputs[0][0]);
+ m_audio_volume[1] = int16_t(outputs[1][0]);
}
//-------------------------------------------------
@@ -31,7 +31,7 @@ void cdda_device::device_start()
/* allocate an audio cache */
m_audio_cache = std::make_unique<uint8_t[]>(CD_MAX_SECTOR_DATA * MAX_SECTORS );
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100);
+ m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
m_audio_playing = 0;
m_audio_pause = 0;
diff --git a/src/devices/sound/cdda.h b/src/devices/sound/cdda.h
index 28633f94fd7..73a1e1a237d 100644
--- a/src/devices/sound/cdda.h
+++ b/src/devices/sound/cdda.h
@@ -11,7 +11,7 @@
class cdda_device : public device_t, public device_sound_interface
{
public:
- cdda_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ cdda_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44'100);
void set_cdrom(void *file);
diff --git a/src/devices/sound/cdp1864.h b/src/devices/sound/cdp1864.h
index c65a3aefac2..e1aec5babea 100644
--- a/src/devices/sound/cdp1864.h
+++ b/src/devices/sound/cdp1864.h
@@ -57,7 +57,7 @@
//**************************************************************************
#define MCFG_CDP1864_ADD(_tag, _screen_tag, _clock, _inlace, _irq, _dma_out, _efx, _hsync, _rdata, _bdata, _gdata) \
- MCFG_SOUND_ADD(_tag, CDP1864, _clock) \
+ MCFG_DEVICE_ADD(_tag, CDP1864, _clock) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
downcast<cdp1864_device *>(device)->set_inlace_callback(DEVCB_##_inlace); \
downcast<cdp1864_device *>(device)->set_irq_callback(DEVCB_##_irq); \
diff --git a/src/devices/sound/dave.h b/src/devices/sound/dave.h
index d6d450a673e..15d1b5a91a9 100644
--- a/src/devices/sound/dave.h
+++ b/src/devices/sound/dave.h
@@ -24,7 +24,7 @@
#define MCFG_DAVE_ADD(_tag, _clock, _program_map, _io_map) \
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") \
- MCFG_SOUND_ADD(_tag, DAVE, _clock) \
+ MCFG_DEVICE_ADD(_tag, DAVE, _clock) \
MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) \
MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) \
MCFG_DEVICE_ADDRESS_MAP(AS_PROGRAM, _program_map) \
diff --git a/src/devices/sound/discrete.h b/src/devices/sound/discrete.h
index 3bdcedcc3bc..bcabbf8978f 100644
--- a/src/devices/sound/discrete.h
+++ b/src/devices/sound/discrete.h
@@ -4377,7 +4377,7 @@ class discrete_sound_device : public discrete_device,
{
public:
// construction/destruction
- discrete_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ discrete_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~discrete_sound_device(void) { };
/* --------------------------------- */
diff --git a/src/devices/sound/dmadac.h b/src/devices/sound/dmadac.h
index 4222d020e86..5bcffecc35f 100644
--- a/src/devices/sound/dmadac.h
+++ b/src/devices/sound/dmadac.h
@@ -16,7 +16,7 @@
class dmadac_sound_device : public device_t, public device_sound_interface
{
public:
- dmadac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ dmadac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
void flush();
void transfer(int channel, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, int16_t *data);
diff --git a/src/devices/sound/es8712.cpp b/src/devices/sound/es8712.cpp
index 3c15dc986e2..6314d26f4a8 100644
--- a/src/devices/sound/es8712.cpp
+++ b/src/devices/sound/es8712.cpp
@@ -59,7 +59,7 @@ es8712_device::es8712_device(const machine_config &mconfig, const char *tag, dev
MACHINE_CONFIG_START(es8712_device::device_add_mconfig)
MCFG_DEVICE_ADD("adpcm_select", HCT157, 0) // TODO : gcpinbal case, differs per games?
- MCFG_74157_OUT_CB(WRITE8(es8712_device, msm_w))
+ MCFG_74157_OUT_CB(WRITE8(*this, es8712_device, msm_w))
MACHINE_CONFIG_END
diff --git a/src/devices/sound/flt_rc.h b/src/devices/sound/flt_rc.h
index 68a2a201af2..3b9748afaaf 100644
--- a/src/devices/sound/flt_rc.h
+++ b/src/devices/sound/flt_rc.h
@@ -46,12 +46,6 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_FILTER_RC_ADD(_tag, _clock) \
- MCFG_DEVICE_ADD(_tag, FILTER_RC, _clock)
-
-#define MCFG_FILTER_RC_REPLACE(_tag, _clock) \
- MCFG_DEVICE_REPLACE(_tag, FILTER_RC, _clock)
-
#define MCFG_FILTER_RC_AC() \
downcast<filter_rc_device &>(*device).set_rc(filter_rc_device::AC, 10000, 0, 0, CAP_U(1));
@@ -72,23 +66,25 @@ public:
AC = 2
};
- filter_rc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ filter_rc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// configuration
- void set_rc(int type, double R1, double R2, double R3, double C)
+ filter_rc_device &set_rc(int type, double R1, double R2, double R3, double C)
{
m_type = type;
m_R1 = R1;
m_R2 = R2;
m_R3 = R3;
m_C = C;
+ return *this;
}
- void filter_rc_set_RC(int type, double R1, double R2, double R3, double C)
+ filter_rc_device &filter_rc_set_RC(int type, double R1, double R2, double R3, double C)
{
m_stream->update();
set_rc(type, R1, R2, R3, C);
recalc();
+ return *this;
}
protected:
diff --git a/src/devices/sound/mos6560.h b/src/devices/sound/mos6560.h
index 59591b4a5e1..25d8e3a9161 100644
--- a/src/devices/sound/mos6560.h
+++ b/src/devices/sound/mos6560.h
@@ -48,7 +48,7 @@
MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \
MCFG_SCREEN_VISIBLE_AREA(MOS6560_MAME_XPOS, MOS6560_MAME_XPOS + MOS6560_MAME_XSIZE - 1, MOS6560_MAME_YPOS, MOS6560_MAME_YPOS + MOS6560_MAME_YSIZE - 1) \
MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
- MCFG_SOUND_ADD(_tag, MOS6560, _clock) \
+ MCFG_DEVICE_ADD(_tag, MOS6560, _clock) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
MCFG_DEVICE_ADDRESS_MAP(0, _videoram_map) \
MCFG_DEVICE_ADDRESS_MAP(1, _colorram_map)
@@ -60,7 +60,7 @@
MCFG_SCREEN_SIZE((MOS6561_XSIZE + 7) & ~7, MOS6561_YSIZE) \
MCFG_SCREEN_VISIBLE_AREA(MOS6561_MAME_XPOS, MOS6561_MAME_XPOS + MOS6561_MAME_XSIZE - 1, MOS6561_MAME_YPOS, MOS6561_MAME_YPOS + MOS6561_MAME_YSIZE - 1) \
MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
- MCFG_SOUND_ADD(_tag, MOS6561, _clock) \
+ MCFG_DEVICE_ADD(_tag, MOS6561, _clock) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
MCFG_DEVICE_ADDRESS_MAP(0, _videoram_map) \
MCFG_DEVICE_ADDRESS_MAP(1, _colorram_map)
@@ -72,7 +72,7 @@
MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \
MCFG_SCREEN_VISIBLE_AREA(0, 23*8 - 1, 0, 22*8 - 1) \
MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
- MCFG_SOUND_ADD(_tag, MOS656X_ATTACK_UFO, _clock) \
+ MCFG_DEVICE_ADD(_tag, MOS656X_ATTACK_UFO, _clock) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
MCFG_DEVICE_ADDRESS_MAP(0, _videoram_map) \
MCFG_DEVICE_ADDRESS_MAP(1, _colorram_map)
diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp
index 487d37cd724..0f980e54ce8 100644
--- a/src/devices/sound/qs1000.cpp
+++ b/src/devices/sound/qs1000.cpp
@@ -196,16 +196,16 @@ const tiny_rom_entry *qs1000_device::device_rom_region() const
// device_add_mconfig - add machine configuration
//-------------------------------------------------
MACHINE_CONFIG_START(qs1000_device::device_add_mconfig)
- MCFG_CPU_ADD("cpu", I8052, DERIVED_CLOCK(1, 1))
- MCFG_CPU_PROGRAM_MAP(qs1000_prg_map)
- MCFG_CPU_IO_MAP(qs1000_io_map)
- MCFG_MCS51_PORT_P1_IN_CB(READ8(qs1000_device, p1_r))
- MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(qs1000_device, p1_w))
- MCFG_MCS51_PORT_P2_IN_CB(READ8(qs1000_device, p2_r))
- MCFG_MCS51_PORT_P2_OUT_CB(WRITE8(qs1000_device, p2_w))
- MCFG_MCS51_PORT_P3_IN_CB(READ8(qs1000_device, p3_r))
- MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(qs1000_device, p3_w))
- MCFG_MCS51_SERIAL_RX_CB(READ8(qs1000_device, data_to_i8052))
+ MCFG_DEVICE_ADD("cpu", I8052, DERIVED_CLOCK(1, 1))
+ MCFG_DEVICE_PROGRAM_MAP(qs1000_prg_map)
+ MCFG_DEVICE_IO_MAP(qs1000_io_map)
+ MCFG_MCS51_PORT_P1_IN_CB(READ8(*this, qs1000_device, p1_r))
+ MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(*this, qs1000_device, p1_w))
+ MCFG_MCS51_PORT_P2_IN_CB(READ8(*this, qs1000_device, p2_r))
+ MCFG_MCS51_PORT_P2_OUT_CB(WRITE8(*this, qs1000_device, p2_w))
+ MCFG_MCS51_PORT_P3_IN_CB(READ8(*this, qs1000_device, p3_r))
+ MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, qs1000_device, p3_w))
+ MCFG_MCS51_SERIAL_RX_CB(READ8(*this, qs1000_device, data_to_i8052))
MACHINE_CONFIG_END
diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp
index 2dcb810b95e..a7bc8cdc72e 100644
--- a/src/devices/sound/qsound.cpp
+++ b/src/devices/sound/qsound.cpp
@@ -191,11 +191,11 @@ const tiny_rom_entry *qsound_device::device_rom_region() const
//-------------------------------------------------
MACHINE_CONFIG_START(qsound_device::device_add_mconfig)
- MCFG_CPU_ADD("dsp", DSP16A, DERIVED_CLOCK(1, 1))
- MCFG_CPU_IO_MAP(dsp_io_map)
- MCFG_DSP16_OCK_CB(WRITELINE(qsound_device, dsp_ock_w))
- MCFG_DSP16_PIO_R_CB(READ16(qsound_device, dsp_pio_r))
- MCFG_DSP16_PIO_W_CB(WRITE16(qsound_device, dsp_pio_w))
+ MCFG_DEVICE_ADD("dsp", DSP16A, DERIVED_CLOCK(1, 1))
+ MCFG_DEVICE_IO_MAP(dsp_io_map)
+ MCFG_DSP16_OCK_CB(WRITELINE(*this, qsound_device, dsp_ock_w))
+ MCFG_DSP16_PIO_R_CB(READ16(*this, qsound_device, dsp_pio_r))
+ MCFG_DSP16_PIO_W_CB(WRITE16(*this, qsound_device, dsp_pio_w))
MACHINE_CONFIG_END
diff --git a/src/devices/sound/samples.h b/src/devices/sound/samples.h
index 666fe320f4c..be5684bc37c 100644
--- a/src/devices/sound/samples.h
+++ b/src/devices/sound/samples.h
@@ -51,7 +51,7 @@ public:
typedef device_delegate<void ()> start_cb_delegate;
// construction/destruction
- samples_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ samples_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// configuration helpers
void set_channels(uint8_t channels) { m_channels = channels; }
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 8c3e6782c09..6c98b5d8fa7 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -212,7 +212,7 @@ void scsp_device::device_start()
m_main_irq_cb.resolve_safe();
m_exts_cb.resolve_safe(0);
- m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100);
+ m_stream = machine().sound().stream_alloc(*this, 0, 2, clock());
}
//-------------------------------------------------
@@ -598,7 +598,7 @@ void scsp_device::init()
t=ARTimes[i]; //In ms
if(t!=0.0)
{
- step=(1023*1000.0)/( 44100.0*t);
+ step=(1023*1000.0)/( double(clock())*t);
scale=(double) (1<<EG_SHIFT);
m_ARTABLE[i]=(int) (step*scale);
}
@@ -606,7 +606,7 @@ void scsp_device::init()
m_ARTABLE[i]=1024<<EG_SHIFT;
t=DRTimes[i]; //In ms
- step=(1023*1000.0)/( 44100.0*t);
+ step=(1023*1000.0)/( double(clock())*t);
scale=(double) (1<<EG_SHIFT);
m_DRTABLE[i]=(int) (step*scale);
}
@@ -621,8 +621,8 @@ void scsp_device::init()
}
LFO_Init();
- m_buffertmpl=make_unique_clear<int32_t[]>(44100);
- m_buffertmpr=make_unique_clear<int32_t[]>(44100);
+ m_buffertmpl=make_unique_clear<int32_t[]>(clock());
+ m_buffertmpr=make_unique_clear<int32_t[]>(clock());
// no "pend"
m_udata.data[0x20/2] = 0;
@@ -734,7 +734,7 @@ void scsp_device::UpdateReg(address_space &space, int reg)
if ((m_udata.data[0x18/2]&0xff) != 255)
{
- time = (44100 / m_TimPris[0]) / (255-(m_udata.data[0x18/2]&0xff));
+ time = (clock() / m_TimPris[0]) / (255-(m_udata.data[0x18/2]&0xff));
if (time)
{
m_timerA->adjust(attotime::from_hz(time));
@@ -753,7 +753,7 @@ void scsp_device::UpdateReg(address_space &space, int reg)
if ((m_udata.data[0x1A/2]&0xff) != 255)
{
- time = (44100 / m_TimPris[1]) / (255-(m_udata.data[0x1A/2]&0xff));
+ time = (clock() / m_TimPris[1]) / (255-(m_udata.data[0x1A/2]&0xff));
if (time)
{
m_timerB->adjust(attotime::from_hz(time));
@@ -772,7 +772,7 @@ void scsp_device::UpdateReg(address_space &space, int reg)
if ((m_udata.data[0x1C/2]&0xff) != 255)
{
- time = (44100 / m_TimPris[2]) / (255-(m_udata.data[0x1C/2]&0xff));
+ time = (clock() / m_TimPris[2]) / (255-(m_udata.data[0x1C/2]&0xff));
if (time)
{
m_timerC->adjust(attotime::from_hz(time));
@@ -1549,7 +1549,7 @@ signed int scsp_device::ALFO_Step(SCSP_LFO_t *LFO)
void scsp_device::LFO_ComputeStep(SCSP_LFO_t *LFO,uint32_t LFOF,uint32_t LFOWS,uint32_t LFOS,int ALFO)
{
- float step=(float) LFOFreq[LFOF]*256.0f/(float)44100;
+ float step=(float) LFOFreq[LFOF]*256.0f/float(clock());
LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step);
if(ALFO)
{
diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h
index d59209fda47..54bf92ef59d 100644
--- a/src/devices/sound/scsp.h
+++ b/src/devices/sound/scsp.h
@@ -32,7 +32,7 @@ class scsp_device : public device_t,
public device_sound_interface
{
public:
- scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44'100);
void set_roffset(int roffset) { m_roffset = roffset; }
template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); }
diff --git a/src/devices/sound/sn76477.h b/src/devices/sound/sn76477.h
index 530e9f416ff..04e6386b62b 100644
--- a/src/devices/sound/sn76477.h
+++ b/src/devices/sound/sn76477.h
@@ -93,7 +93,7 @@ class sn76477_device : public device_t,
public device_sound_interface
{
public:
- sn76477_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ sn76477_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
void set_noise_params(double clock_res, double filter_res, double filter_cap)
{
diff --git a/src/devices/sound/spkrdev.h b/src/devices/sound/spkrdev.h
index ac9535108ed..b7d0ac95cec 100644
--- a/src/devices/sound/spkrdev.h
+++ b/src/devices/sound/spkrdev.h
@@ -20,7 +20,7 @@ class speaker_sound_device : public device_t,
public device_sound_interface
{
public:
- speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
~speaker_sound_device() {}
// configuration
diff --git a/src/devices/sound/spu.h b/src/devices/sound/spu.h
index 05bce4a5421..874867ff622 100644
--- a/src/devices/sound/spu.h
+++ b/src/devices/sound/spu.h
@@ -14,10 +14,10 @@
#define MCFG_SPU_ADD(_tag, _clock) \
MCFG_DEVICE_MODIFY( "maincpu" ) \
- MCFG_PSX_SPU_READ_HANDLER(DEVREAD16(_tag, spu_device, read)) \
- MCFG_PSX_SPU_WRITE_HANDLER(DEVWRITE16(_tag, spu_device, write)) \
+ MCFG_PSX_SPU_READ_HANDLER(READ16(_tag, spu_device, read)) \
+ MCFG_PSX_SPU_WRITE_HANDLER(WRITE16(_tag, spu_device, write)) \
MCFG_DEVICE_ADD(_tag, SPU, _clock) \
- MCFG_SPU_IRQ_HANDLER(DEVWRITELINE("maincpu:irq", psxirq_device, intin9)) \
+ MCFG_SPU_IRQ_HANDLER(WRITELINE("maincpu:irq", psxirq_device, intin9)) \
MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 4, psxdma_device::read_delegate(&spu_device::dma_read, (spu_device *) device ) ) \
MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 4, psxdma_device::write_delegate(&spu_device::dma_write, (spu_device *) device ) )
diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h
index a388bf1276d..419365fc9e3 100644
--- a/src/devices/sound/upd7759.h
+++ b/src/devices/sound/upd7759.h
@@ -13,11 +13,11 @@
software.
*/
-#define UPD7759_STANDARD_CLOCK XTAL(640'000)
-
class upd775x_device : public device_t, public device_sound_interface
{
public:
+ enum : u32 { STANDARD_CLOCK = 640'000 };
+
template <class Object> devcb_base &set_drq_callback(Object &&cb) { return m_drqcallback.set_callback(std::forward<Object>(cb)); }
void set_bank_base(offs_t base);
@@ -107,7 +107,7 @@ protected:
class upd7759_device : public upd775x_device
{
public:
- upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = STANDARD_CLOCK);
DECLARE_WRITE_LINE_MEMBER( start_w );
@@ -130,7 +130,7 @@ protected:
class upd7756_device : public upd775x_device
{
public:
- upd7756_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ upd7756_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = STANDARD_CLOCK);
DECLARE_WRITE_LINE_MEMBER( start_w );
diff --git a/src/devices/sound/wave.h b/src/devices/sound/wave.h
index 53f0ac29254..27ad6f18682 100644
--- a/src/devices/sound/wave.h
+++ b/src/devices/sound/wave.h
@@ -39,7 +39,7 @@ DECLARE_DEVICE_TYPE(WAVE, wave_device)
#define MCFG_SOUND_WAVE_ADD(_tag, _cass_tag) \
- MCFG_SOUND_ADD( _tag, WAVE, 0 ) \
+ MCFG_DEVICE_ADD( _tag, WAVE, 0 ) \
downcast<wave_device &>(*device).set_cassette_tag(_cass_tag);
#endif // MAME_SOUND_WAVE_H