summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/vrender0.h
blob: 9baaefac203bda17faff6353b651fc7b02eca703 (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
// license:BSD-3-Clause
// copyright-holders:ElSemi
#pragma once

#ifndef __VRENDER0_H__
#define __VRENDER0_H__


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

#define MCFG_SOUND_VRENDER0_ADD(_tag, _clock) \
	MCFG_DEVICE_ADD(_tag, VRENDER0, _clock)
#define MCFG_SOUND_VRENDER0_REPLACE(_tag, _clock) \
	MCFG_DEVICE_REPLACE(_tag, VRENDER0, _clock)

#define MCFG_VR0_REGBASE(_base) \
	vrender0_device::set_reg_base(*device, _base);

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


// ======================> vrender0_device

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

	// static configuration
	static void set_reg_base(device_t &device, int base) { downcast<vrender0_device &>(device).m_reg_base = base; }

	DECLARE_READ32_MEMBER( vr0_snd_read );
	DECLARE_WRITE32_MEMBER( vr0_snd_write );

	void set_areas(UINT32 *texture, UINT32 *frame);

protected:
	// device-level overrides
	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:
	UINT32 *m_TexBase;
	UINT32 *m_FBBase;
	UINT32 m_SOUNDREGS[0x10000/4];
	sound_stream *m_stream;
	UINT32 m_reg_base;

	void VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_sample_t *r);
};

extern const device_type VRENDER0;


#endif /* __VRENDER0_H__ */