summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-01-20 21:23:37 +0100
committer couriersud <couriersud@gmx.org>2020-01-20 21:23:37 +0100
commitcfab80411da235220c5d65154c21f356d1bca236 (patch)
tree6cd580c01a9bd655de230b1205b0b3dcaf174a82
parent9e272e4b551d14e7032913f0aa972e2dd45fb4bd (diff)
galaxian: Clean up audio device code. [Couriersud]
Added some notes about M51516L.
-rw-r--r--src/mame/audio/galaxian.cpp42
-rw-r--r--src/mame/audio/galaxian.h28
-rw-r--r--src/mame/audio/nl_konami.cpp19
-rw-r--r--src/mame/drivers/galaxian.cpp11
-rw-r--r--src/mame/drivers/galaxold.cpp8
5 files changed, 76 insertions, 32 deletions
diff --git a/src/mame/audio/galaxian.cpp b/src/mame/audio/galaxian.cpp
index 57277decfd6..4485c26104a 100644
--- a/src/mame/audio/galaxian.cpp
+++ b/src/mame/audio/galaxian.cpp
@@ -25,6 +25,7 @@ TODO:
#include "emu.h"
#include "audio/galaxian.h"
#include "includes/galaxian.h"
+#include "speaker.h"
/*************************************
*
@@ -243,7 +244,7 @@ static const discrete_op_amp_filt_info galaxian_bandpass_desc =
*************************************/
-DISCRETE_SOUND_START(galaxian_discrete)
+static DISCRETE_SOUND_START(galaxian_discrete)
/************************************************/
/* Input register mapping for galaxian */
@@ -375,7 +376,7 @@ DISCRETE_SOUND_START(galaxian_discrete)
DISCRETE_SOUND_END
-DISCRETE_SOUND_START(mooncrst_discrete)
+static DISCRETE_SOUND_START(mooncrst_discrete)
DISCRETE_IMPORT(galaxian_discrete)
/************************************************/
@@ -386,13 +387,18 @@ DISCRETE_SOUND_START(mooncrst_discrete)
DISCRETE_MIXER7(NODE_280, 1, NODE_133_00, NODE_133_02, NODE_133_02,NODE_133_03, NODE_120, NODE_157, NODE_182, &mooncrst_mixer_desc)
DISCRETE_SOUND_END
-DEFINE_DEVICE_TYPE(GALAXIAN, galaxian_sound_device, "galaxian_sound", "Galaxian Custom Sound")
+DEFINE_DEVICE_TYPE(GALAXIAN_SOUND, galaxian_sound_device, "galaxian_sound", "Galaxian Custom Sound")
+DEFINE_DEVICE_TYPE(MOONCRST_SOUND, mooncrst_sound_device, "mooncrst_sound", "Mooncrst Custom Sound")
galaxian_sound_device::galaxian_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, GALAXIAN, tag, owner, clock)
- , device_sound_interface(mconfig, *this)
- , m_lfo_val(0)
- , m_discrete(*this, "^" GAL_AUDIO)
+: galaxian_sound_device(mconfig, GALAXIAN_SOUND, tag, owner, clock)
+{
+}
+
+galaxian_sound_device::galaxian_sound_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+: device_t(mconfig, type, tag, owner, clock)
+, m_discrete(*this, "discrete")
+, m_lfo_val(0)
{
}
@@ -407,6 +413,17 @@ void galaxian_sound_device::device_start()
save_item(NAME(m_lfo_val));
}
+//-------------------------------------------------
+// machine_add_config - add device configuration
+//-------------------------------------------------
+
+void galaxian_sound_device::device_add_mconfig(machine_config &config)
+{
+ // sound hardware
+ DISCRETE(config, m_discrete).add_route(ALL_OUTPUTS, ":speaker", 1.0);
+ m_discrete->set_intf(galaxian_discrete);
+}
+
/*************************************
*
* Write handlers
@@ -480,10 +497,13 @@ WRITE8_MEMBER( galaxian_sound_device::sound_w )
}
}
-//-------------------------------------------------
-// sound_stream_update - handle a stream update
-//-------------------------------------------------
+mooncrst_sound_device::mooncrst_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+: galaxian_sound_device(mconfig, MOONCRST_SOUND, tag, owner, clock)
+{
+}
-void galaxian_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void mooncrst_sound_device::device_add_mconfig(machine_config &config)
{
+ galaxian_sound_device::device_add_mconfig(config);
+ m_discrete->set_intf(mooncrst_discrete);
}
diff --git a/src/mame/audio/galaxian.h b/src/mame/audio/galaxian.h
index 7165ca6d011..fe84309fd67 100644
--- a/src/mame/audio/galaxian.h
+++ b/src/mame/audio/galaxian.h
@@ -7,12 +7,11 @@
#include "sound/discrete.h"
-#define GAL_AUDIO "discrete"
-
-class galaxian_sound_device : public device_t, public device_sound_interface
+class galaxian_sound_device : public device_t
{
public:
galaxian_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ galaxian_sound_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE8_MEMBER( sound_w );
DECLARE_WRITE8_MEMBER( pitch_w );
@@ -25,19 +24,32 @@ public:
protected:
// device-level overrides
virtual void device_start() override;
+ virtual void device_add_mconfig(machine_config &config) override;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ // virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ required_device<discrete_device> m_discrete;
private:
// internal state
uint8_t m_lfo_val;
- required_device<discrete_device> m_discrete;
};
-DECLARE_DEVICE_TYPE(GALAXIAN, galaxian_sound_device)
+class mooncrst_sound_device : public galaxian_sound_device
+{
+public:
+ mooncrst_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ // device-level overrides
+ virtual void device_add_mconfig(machine_config &config) override;
+
+};
+
+DECLARE_DEVICE_TYPE(GALAXIAN_SOUND, galaxian_sound_device)
+DECLARE_DEVICE_TYPE(MOONCRST_SOUND, mooncrst_sound_device)
-DISCRETE_SOUND_EXTERN(galaxian_discrete);
-DISCRETE_SOUND_EXTERN(mooncrst_discrete);
+//DISCRETE_SOUND_EXTERN(galaxian_discrete);
+//DISCRETE_SOUND_EXTERN(mooncrst_discrete);
#endif // MAME_AUDIO_GALAXIAN_H
diff --git a/src/mame/audio/nl_konami.cpp b/src/mame/audio/nl_konami.cpp
index ba45660f211..af1bec71882 100644
--- a/src/mame/audio/nl_konami.cpp
+++ b/src/mame/audio/nl_konami.cpp
@@ -6,6 +6,25 @@
#error Somehow nl_base.h made it into the include chain.
#endif
+/*
+ * M51516L pins:
+ *
+ * pin
+ * 9 - power,
+ * 8 - output 1,
+ * 7 - output 2,
+ * 6 - ground (large signal),
+ * 5 - feedback 2,
+ * 4 - feedback 1,
+ * 3 - muting,
+ * 2 - ground (small signal),
+ * 1 - input
+ *
+ * on the block diagram, box to the right of pin 3 says "Muting"
+ * and then to the right of that "ASO protection, surge protection, heat barrier"
+ *
+ */
+
static NETLIST_START(filter)
CD4066_GATE(G1)
PARAM(G1.BASER, 270.0)
diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp
index 24f1b79c959..9aef5f17fe7 100644
--- a/src/mame/drivers/galaxian.cpp
+++ b/src/mame/drivers/galaxian.cpp
@@ -5984,6 +5984,7 @@ void galaxian_state::konami_base(machine_config &config)
m_ppi8255[1]->out_pb_callback().set(FUNC(galaxian_state::konami_sound_control_w));
m_ppi8255[1]->in_pc_callback().set_ioport("IN3");
m_ppi8255[1]->out_pc_callback().set(FUNC(galaxian_state::konami_portc_1_w));
+
}
@@ -6105,9 +6106,7 @@ void galaxian_state::galaxian(machine_config &config)
{
galaxian_base(config);
- GALAXIAN(config, "cust", 0).add_route(ALL_OUTPUTS, "speaker", 0.4);
-
- DISCRETE(config, GAL_AUDIO, galaxian_discrete).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ GALAXIAN_SOUND(config, "cust", 0);
}
void galaxian_state::victoryc(machine_config &config)
@@ -6189,9 +6188,7 @@ void galaxian_state::mooncrst(machine_config &config)
// alternate memory map
m_maincpu->set_addrmap(AS_PROGRAM, &galaxian_state::mooncrst_map);
- GALAXIAN(config, "cust", 0).add_route(ALL_OUTPUTS, "speaker", 0.4);
-
- DISCRETE(config, GAL_AUDIO, mooncrst_discrete).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ MOONCRST_SOUND(config, "cust", 0);
}
void galaxian_state::eagle(machine_config &config)
@@ -6240,7 +6237,6 @@ void galaxian_state::fantastc(machine_config &config)
// sound hardware
AY8910(config, m_ay8910[0], GALAXIAN_PIXEL_CLOCK/3/2).add_route(ALL_OUTPUTS, "speaker", 0.25); // 3.072MHz
-
AY8910(config, m_ay8910[1], GALAXIAN_PIXEL_CLOCK/3/2).add_route(ALL_OUTPUTS, "speaker", 0.25); // 3.072MHz
}
@@ -6364,6 +6360,7 @@ void galaxian_state::frogger(machine_config &config)
void galaxian_state::froggermc(machine_config &config)
{
galaxian_base(config);
+
konami_sound_1x_ay8910(config);
// alternate memory map
diff --git a/src/mame/drivers/galaxold.cpp b/src/mame/drivers/galaxold.cpp
index e620314bfbf..ab018944297 100644
--- a/src/mame/drivers/galaxold.cpp
+++ b/src/mame/drivers/galaxold.cpp
@@ -2292,16 +2292,12 @@ void galaxold_state::galaxold_base(machine_config &config)
void galaxold_state::galaxian_audio(machine_config &config)
{
- GALAXIAN(config, "cust", 0).add_route(ALL_OUTPUTS, "speaker", 0.4);
-
- DISCRETE(config, GAL_AUDIO, galaxian_discrete).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ GALAXIAN_SOUND(config, "cust", 0);
}
void galaxold_state::mooncrst_audio(machine_config &config)
{
- GALAXIAN(config, "cust", 0).add_route(ALL_OUTPUTS, "speaker", 0.4);
-
- DISCRETE(config, GAL_AUDIO, mooncrst_discrete).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ MOONCRST_SOUND(config, "cust", 0);
}