summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/s14001a.h
blob: d3bd5b43e94837a606ebc36ac0cbb55d2b1bbfa7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#ifndef __S14001A_H__
#define __S14001A_H__


class s14001a_device : public device_t,
									public device_sound_interface
{
public:
	s14001a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~s14001a_device() {}

	int bsy_r();        /* read BUSY pin */
	void reg_w(int data);     /* write to input latch */
	void rst_w(int data);     /* write to RESET pin */
	void set_clock(int clock);     /* set VSU-1000 clock */
	void set_volume(int volume);    /* set VSU-1000 volume control */

protected:
	// device-level overrides
	virtual void device_config_complete();
	virtual void device_start();

	// sound stream update overrides
	virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);

private:
	// internal state
	sound_stream * m_stream;

	UINT8 m_WordInput; // value on word input bus
	UINT8 m_LatchedWord; // value latched from input bus
	UINT16 m_SyllableAddress; // address read from word table
	UINT16 m_PhoneAddress; // starting/current phone address from syllable table
	UINT8 m_PlayParams; // playback parameters from syllable table
	UINT8 m_PhoneOffset; // offset within phone
	UINT8 m_LengthCounter; // 4-bit counter which holds the inverted length of the word in phones, leftshifted by 1
	UINT8 m_RepeatCounter; // 3-bit counter which holds the inverted number of repeats per phone, leftshifted by 1
	UINT8 m_OutputCounter; // 2-bit counter to determine forward/backward and output/silence state.
	UINT8 m_machineState; // chip state machine state
	UINT8 m_nextstate; // chip state machine's new state
	UINT8 m_laststate; // chip state machine's previous state, needed for mirror increment masking
	UINT8 m_resetState; // reset line state
	UINT8 m_oddeven; // odd versus even cycle toggle
	UINT8 m_GlobalSilenceState; // same as above but for silent syllables instead of silent portions of mirrored syllables
	UINT8 m_OldDelta; // 2-bit old delta value
	UINT8 m_DACOutput; // 4-bit DAC Accumulator/output
	UINT8 m_audioout; // filtered audio output
	UINT8 *m_SpeechRom; // array to hold rom contents, mame will not need this, will use a pointer
	INT16 m_filtervals[8];
	UINT8 m_VSU1000_amp; // amplitude setting on VSU-1000 board

	INT16 audiofilter();
	void shiftIntoFilter(INT16 inputvalue);
	void PostPhoneme();
	void s14001a_clock();
};

extern const device_type S14001A;


#endif /* __S14001A_H__ */