summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/vrc6.h
blob: f1ea8f5c9e38015fa670b77a915be5f27dd22626 (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
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/***************************************************************************

    vrc6.h
    Konami VRC6 add-on sound

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

#ifndef MAME_SOUND_VRC6_H
#define MAME_SOUND_VRC6_H

#pragma once

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

// ======================> vrc6snd_device

class vrc6snd_device : public device_t, public device_sound_interface
{
public:
	// construction/destruction
	vrc6snd_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

	void write(offs_t offset, u8 data);

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;

private:
	u8 m_freqctrl, m_pulsectrl[2], m_sawrate, m_master_freq;
	u8 m_pulsefrql[2], m_pulsefrqh[2], m_pulseduty[2];
	u8 m_sawfrql, m_sawfrqh, m_sawclock, m_sawaccum;
	u16 m_ticks[3];
	u8 m_output[3];

	sound_stream *m_stream;
};


// device type definition
DECLARE_DEVICE_TYPE(VRC6, vrc6snd_device)

#endif // MAME_SOUND_VRC6_H