summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/amiga.h
blob: e93ff6a86a355f4a13790124c59e7e9b419b31f4 (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
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************

    Amiga audio hardware

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

#pragma once

#ifndef __SOUND_AMIGA_H__
#define __SOUND_AMIGA_H__

#include "emu.h"


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

// ======================> amiga_sound_device

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

	void update();
	void data_w(int which, UINT16 data);

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

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

private:
	static const int CLOCK_DIVIDER = 16;

	struct audio_channel
	{
		emu_timer *irq_timer;
		UINT32 curlocation;
		UINT16 curlength;
		UINT16 curticks;
		UINT8 index;
		bool dma_enabled;
		bool manualmode;
		INT8 latched;
	};

	void dma_reload(audio_channel *chan);

	// internal state
	audio_channel m_channel[4];
	sound_stream *m_stream;

	TIMER_CALLBACK_MEMBER( signal_irq );
};

extern const device_type AMIGA;

#endif // __SOUND_AMIGA_H__