1 // license:BSD-3-Clause
2 // copyright-holders:Jonathan Gevaryahu
3 #ifndef MAME_AUDIO_SOCRATES_H
4 #define MAME_AUDIO_SOCRATES_H
5 
6 #pragma once
7 
8 class socrates_snd_device : public device_t,
9 							public device_sound_interface
10 {
11 public:
12 	socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
13 
14 	void reg0_w(int data);
15 	void reg1_w(int data);
16 	void reg2_w(int data);
17 	void reg3_w(int data);
18 	void reg4_w(int data);
19 
20 protected:
21 	// device-level overrides
22 	virtual void device_start() override;
23 
24 	// sound stream update overrides
25 	virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
26 private:
27 	void snd_clock();
28 	static const uint8_t s_volumeLUT[];
29 
30 	// internal state
31 	sound_stream *  m_stream;
32 	uint8_t           m_freq[2];      // channel 1,2 frequencies
33 	uint8_t           m_vol[2];       // channel 1,2 volume
34 	uint8_t           m_enable[2];    // channel 1,2 enable
35 	uint8_t           m_channel3;     // channel 3 weird register
36 	uint8_t           m_state[3];     // output states for channels 1,2,3
37 	uint8_t           m_accum[3];     // accumulators for channels 1,2,3
38 	uint16_t          m_DAC_output;   // output
39 };
40 
41 DECLARE_DEVICE_TYPE(SOCRATES_SOUND, socrates_snd_device)
42 
43 
44 #endif // MAME_AUDIO_SOCRATES_H
45