summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/upd934g.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/upd934g.h')
-rw-r--r--src/devices/sound/upd934g.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/devices/sound/upd934g.h b/src/devices/sound/upd934g.h
new file mode 100644
index 00000000000..02224f2739d
--- /dev/null
+++ b/src/devices/sound/upd934g.h
@@ -0,0 +1,70 @@
+// license: BSD-3-Clause
+// copyright-holders: Dirk Best
+/***************************************************************************
+
+ NEC μPD934G
+
+ Percussion Generator
+
+***************************************************************************/
+
+#ifndef MAME_SOUND_UPD934G_H
+#define MAME_SOUND_UPD934G_H
+
+#pragma once
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_UPD934G_DATA_CB(_devcb) \
+ devcb = &downcast<upd934g_device &>(*device).set_data_callback(DEVCB_##_devcb);
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class upd934g_device : public device_t, public device_sound_interface
+{
+public:
+ static constexpr feature_type imperfect_features() { return feature::SOUND; }
+
+ // construction/destruction
+ upd934g_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // configuration
+ template <class Object> devcb_base &set_data_callback(Object &&cb) { return m_data_cb.set_callback(std::forward<Object>(cb)); }
+
+ DECLARE_WRITE8_MEMBER(write);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+
+private:
+ devcb_read8 m_data_cb;
+ sound_stream *m_stream;
+
+ uint16_t m_addr[16];
+
+ struct
+ {
+ uint16_t pos;
+ int playing;
+ int volume;
+ }
+ m_channel[4];
+
+ int m_sample;
+ bool m_ready;
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(UPD934G, upd934g_device)
+
+#endif // MAME_SOUND_UPD934G_H