1 // license:BSD-3-Clause 2 // copyright-holders:Allard van der Bas 3 #ifndef MAME_AUDIO_WIPING_H 4 #define MAME_AUDIO_WIPING_H 5 6 #pragma once 7 8 class wiping_sound_device : public device_t, public device_sound_interface 9 { 10 public: 11 wiping_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 12 13 void sound_w(offs_t offset, uint8_t data); 14 15 protected: 16 // device-level overrides 17 virtual void device_start() override; 18 19 // sound stream update overrides 20 virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; 21 22 private: 23 /* 8 voices max */ 24 static constexpr unsigned MAX_VOICES = 8; 25 26 /* this structure defines the parameters for a channel */ 27 struct wp_sound_channel 28 { 29 int frequency; 30 int counter; 31 int volume; 32 const uint8_t *wave; 33 int oneshot; 34 int oneshotplaying; 35 }; 36 37 // internal state 38 39 /* data about the sound system */ 40 wp_sound_channel m_channel_list[MAX_VOICES]; 41 wp_sound_channel *m_last_channel; 42 43 /* global sound parameters */ 44 const uint8_t *m_sound_prom; 45 const uint8_t *m_sound_rom; 46 int m_num_voices; 47 int m_sound_enable; 48 sound_stream *m_stream; 49 50 /* mixer tables and internal buffers */ 51 std::vector<short> m_mixer_buffer; 52 53 uint8_t m_soundregs[0x4000]; 54 55 void make_mixer_table(int voices, int gain); 56 }; 57 58 DECLARE_DEVICE_TYPE(WIPING_CUSTOM, wiping_sound_device) 59 60 #endif // MAME_AUDIO_WIPING_H 61