summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/bbd.h
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2025-04-14 11:31:53 +0200
committer Olivier Galibert <galibert@pobox.com>2025-04-14 22:28:31 +0200
commitcef6157803320544651bfc96457d2f8a6df0abd6 (patch)
treef8a64867e3d654cdcad5f4c24824ea82e2c77194 /src/devices/sound/bbd.h
parent9473c027358e1a2d5c93d240a48052368f9d3b84 (diff)
New sound infrastructure.sound
Should be added soon: - mute - lua hookup (with documentation) - speaker/microphone resampling To be added a little later: - compression - reverb Needs to be added by someone else: - coreaudio - direct - portaudio - xaudio2 - js
Diffstat (limited to 'src/devices/sound/bbd.h')
-rw-r--r--src/devices/sound/bbd.h31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/devices/sound/bbd.h b/src/devices/sound/bbd.h
index 64394a90620..4b761a64904 100644
--- a/src/devices/sound/bbd.h
+++ b/src/devices/sound/bbd.h
@@ -11,45 +11,38 @@
// ======================> bbd_device_base
-template<int Entries, int Outputs>
class bbd_device_base : public device_t, public device_sound_interface
{
public:
- // configuration
- template <typename... T> void set_cv_handler(T &&... args)
- {
- m_cv_handler.set(std::forward<T>(args)...);
- }
+ void tick();
protected:
- using cv_delegate = device_delegate<attoseconds_t (attotime const &)>;
-
// internal constructor
bbd_device_base(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type);
+ void set_bucket_count(int buckets);
+
// device-level overrides
virtual void device_start() override ATTR_COLD;
- virtual void device_clock_changed() override;
+ virtual void device_reset() override ATTR_COLD;
// sound stream update overrides
- virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ virtual void sound_stream_update(sound_stream &stream) override;
protected:
// override to convert clock to sample rate
- stream_buffer::sample_t outputval(s32 index) const { return m_buffer[(m_curpos - index) % std::size(m_buffer)]; }
+ sound_stream::sample_t outputval(s32 index) const { return m_buffer[(m_curpos - index) % std::size(m_buffer)]; }
virtual u32 sample_rate() const { return clock(); }
sound_stream * m_stream;
u32 m_curpos;
- cv_delegate m_cv_handler;
- attotime m_next_bbdtime;
- stream_buffer::sample_t m_buffer[Entries + 1];
+ std::vector<sound_stream::sample_t> m_buffer;
};
// ======================> mn3004_device
-class mn3004_device : public bbd_device_base<512, 2>
+class mn3004_device : public bbd_device_base
{
public:
mn3004_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -60,7 +53,7 @@ DECLARE_DEVICE_TYPE(MN3004, mn3004_device)
// ======================> mn3005_device
-class mn3005_device : public bbd_device_base<4096, 2>
+class mn3005_device : public bbd_device_base
{
public:
mn3005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -71,7 +64,7 @@ DECLARE_DEVICE_TYPE(MN3005, mn3005_device)
// ======================> mn3006_device
-class mn3006_device : public bbd_device_base<128, 2>
+class mn3006_device : public bbd_device_base
{
public:
mn3006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -82,7 +75,7 @@ DECLARE_DEVICE_TYPE(MN3006, mn3006_device)
// ======================> mn3204p_device
-class mn3204p_device : public bbd_device_base<512, 2>
+class mn3204p_device : public bbd_device_base
{
public:
mn3204p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -93,7 +86,7 @@ DECLARE_DEVICE_TYPE(MN3204P, mn3204p_device)
// ======================> mn3207_device
-class mn3207_device : public bbd_device_base<1024, 2>
+class mn3207_device : public bbd_device_base
{
public:
mn3207_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);