summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/gaelco.h
blob: fdb3a984685872cb069249b316a4a6e09872e4b6 (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
#pragma once

#ifndef __GALELCO_H__
#define __GALELCO_H__

#define GAELCO_NUM_CHANNELS     0x07
#define GAELCO_VOLUME_LEVELS    0x10


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

#define MCFG_GAELCO_GAE1_ADD(_tag, _clock) \
	MCFG_DEVICE_ADD(_tag, GAELCO_GAE1, _clock)
#define MCFG_GAELCO_GAE1_REPLACE(_tag, _clock) \
	MCFG_DEVICE_REPLACE(_tag, GAELCO_GAE1, _clock)
#define MCFG_GAELCO_CG1V_ADD(_tag, _clock) \
	MCFG_DEVICE_ADD(_tag, GAELCO_CG1V, _clock)
#define MCFG_GAELCO_CG1V_REPLACE(_tag, _clock) \
	MCFG_DEVICE_REPLACE(_tag, GAELCO_CG1V, _clock)

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

// ======================> Sound Channel

struct gaelco_sound_channel
{
	int active;         // is it playing?
	int loop;           // = 0 no looping, = 1 looping
	int chunkNum;       // current chunk if looping
};


// ======================> External interface

struct gaelcosnd_interface
{
	const char *gfxregion;  /* shared gfx region name */
	int banks[4];           /* start of each ROM bank */
};


// ======================> gaelco_gae1_device

class gaelco_gae1_device : public device_t,
							public device_sound_interface
{
public:
	gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
	~gaelco_gae1_device() { }

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

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

public:
	DECLARE_WRITE16_MEMBER( gaelcosnd_w );
	DECLARE_READ16_MEMBER( gaelcosnd_r );

private:
	sound_stream *m_stream;                                 /* our stream */
	UINT8 *m_snd_data;                                      /* PCM data */
	int m_banks[4];                                         /* start of each ROM bank */
	gaelco_sound_channel m_channel[GAELCO_NUM_CHANNELS];    /* 7 stereo channels */

	UINT16 m_sndregs[0x38];

	// Table for converting from 8 to 16 bits with volume control
	INT16 m_volume_table[GAELCO_VOLUME_LEVELS][256];
};

extern const device_type GAELCO_GAE1;



// ======================> gaelco_cg1v_device

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

extern const device_type GAELCO_CG1V;


#endif /* __GALELCO_H__ */