blob: 0bb994ebdb6557ab85b461fc7f4705ab1c12eea3 (
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
|
// license:BSD-3-Clause
// copyright-holders:hap
/***************************************************************************
i5000.h - Imagetek I5000 sound emulator
***************************************************************************/
#ifndef MAME_SOUND_I5000_H
#define MAME_SOUND_I5000_H
#pragma once
#include "sound/okiadpcm.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class i5000snd_device : public device_t,
public device_sound_interface
{
public:
// construction/destruction
i5000snd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint16_t read(offs_t offset);
void write(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;
sound_stream *m_stream;
private:
struct channel_t
{
bool is_playing;
oki_adpcm_state m_adpcm;
uint32_t address;
int freq_timer;
int freq_base;
int freq_min;
uint16_t sample;
uint8_t shift_pos;
uint8_t shift_amount;
uint8_t shift_mask;
int vol_r;
int vol_l;
int output_r;
int output_l;
};
channel_t m_channels[16];
uint16_t m_regs[0x80];
uint16_t *m_rom_base;
uint32_t m_rom_mask;
int m_lut_volume[0x100];
bool read_sample(int ch);
void write_reg16(uint8_t reg, uint16_t data);
};
// device type definition
DECLARE_DEVICE_TYPE(I5000_SND, i5000snd_device)
#endif // MAME_SOUND_I5000_H
|