summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/ymz770.h
blob: ddcd72e7bfa36212827ebd53f0d7cbf0fcb6722e (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert, R. Belmont
/***************************************************************************

    ymz770.h

***************************************************************************/

#pragma once

#ifndef __YMZ770_H__
#define __YMZ770_H__

//**************************************************************************
//  CONSTANTS
//**************************************************************************

//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_YMZ770_ADD(_tag, _clock) \
	MCFG_DEVICE_ADD(_tag, YMZ770, _clock)

#define MCFG_YMZ770_REPLACE(_tag, _clock) \
	MCFG_DEVICE_REPLACE(_tag, YMZ770, _clock)

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// forward definition
class mpeg_audio;

// ======================> ymz770_device

class ymz770_device : public device_t, public device_sound_interface
{
	struct ymz_channel
	{
		UINT8 phrase;
		UINT8 pan;
		UINT8 volume;
		UINT8 control;

		bool is_playing, last_block;

		mpeg_audio *decoder;

		INT16 output_data[0x1000];
		int output_remaining;
		int output_ptr;
		int atbl;
		int pptr;

		UINT8 sequence;
		UINT8 seqcontrol;
		UINT8 seqdelay;
		UINT8 *seqdata;
		bool is_seq_playing;
	};


public:
	// construction/destruction
	ymz770_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	DECLARE_WRITE8_MEMBER(write);

	sound_stream *m_stream;

protected:

	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;

	virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;

	void internal_reg_write(UINT8 reg, UINT8 data);

	// data
	UINT8 m_cur_reg;
	UINT8 m_mute;         // mute chip
	UINT8 m_doen;         // digital output enable
	UINT8 m_vlma;         // overall AAM volume
	UINT8 m_bsl;          // boost level
	UINT8 m_cpl;          // clip limiter
	UINT8 *m_rom_base;
	int m_rom_limit;

	ymz_channel m_channels[8];
};


// device type definition
extern const device_type YMZ770;

#endif /* __ymz770_H__ */