1 // license:BSD-3-Clause 2 // copyright-holders:Allard van der Bas 3 #ifndef MAME_AUDIO_WARPWARP_H 4 #define MAME_AUDIO_WARPWARP_H 5 6 #pragma once 7 8 9 class warpwarp_sound_device : public device_t, public device_sound_interface 10 { 11 public: 12 warpwarp_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 13 14 enum 15 { 16 TIMER_SOUND_VOLUME_DECAY, 17 TIMER_MUSIC_VOLUME_DECAY 18 }; 19 20 21 void sound_w(u8 data); 22 void music1_w(u8 data); 23 void music2_w(u8 data); 24 25 protected: 26 // device-level overrides 27 virtual void device_start() override; 28 29 // sound stream update overrides 30 virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; 31 32 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 33 34 private: 35 // internal state 36 std::unique_ptr<int16_t[]> m_decay; 37 sound_stream *m_channel; 38 u32 m_clock_16h; 39 u32 m_clock_1v; 40 int m_sound_latch; 41 int m_music1_latch; 42 int m_music2_latch; 43 int m_sound_signal; 44 int m_sound_volume; 45 emu_timer *m_sound_volume_timer; 46 int m_music_signal; 47 int m_music_volume; 48 emu_timer *m_music_volume_timer; 49 int m_noise; 50 51 int m_vcarry; 52 int m_vcount; 53 int m_mcarry; 54 int m_mcount; 55 }; 56 57 DECLARE_DEVICE_TYPE(WARPWARP_SOUND, warpwarp_sound_device) 58 59 #endif // MAME_AUDIO_WARPWARP_H 60