summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/lmc1992.h
blob: cfaffc1f13fcfd8ad51a24f7c37f286be8a82f9d (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
96
97
98
99
100
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    LMC1992 Digitally-Controlled Stereo Tone and Volume Circuit with
    Four-Channel Input-Selector emulation

**********************************************************************
                            _____   _____
                  Data   1 |*    \_/     | 28  V+
                 Clock   2 |             | 27  Bypass
                Enable   3 |             | 26  Right Input 1
          Left Input 1   4 |             | 25  Right Input 2
          Left Input 2   5 |             | 24  Right Input 3
          Left Input 3   6 |             | 23  Right Input 4
          Left Input 4   7 |   LMC1992   | 22  Right Select Out
       Left Select Out   8 |             | 21  Right Select In
        Left Select In   9 |             | 20  Right Tone In
          Left Tone In  10 |             | 19  Right Tone Out
         Left Tone Out  11 |             | 18  Right Op Amp Out
       Left Op Amp Out  12 |             | 17  Right Rear Out
         Left Rear Out  13 |             | 16  Right Front Out
        Left Front Out  14 |_____________| 15  Ground

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

#ifndef MAME_SOUND_LMC1992_H
#define MAME_SOUND_LMC1992_H

#pragma once




//**************************************************************************
//  MACROS / CONSTANTS
//**************************************************************************

enum
{
	LMC1992_LEFT_INPUT_1 = 0,
	LMC1992_LEFT_INPUT_2,
	LMC1992_LEFT_INPUT_3,
	LMC1992_LEFT_INPUT_4,
	LMC1992_RIGHT_INPUT_1,
	LMC1992_RIGHT_INPUT_2,
	LMC1992_RIGHT_INPUT_3,
	LMC1992_RIGHT_INPUT_4
};


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

// ======================> lmc1992_device

class lmc1992_device :  public device_t,
						public device_sound_interface
{
public:
	// construction/destruction
	lmc1992_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);

	DECLARE_WRITE_LINE_MEMBER( clock_w );
	DECLARE_WRITE_LINE_MEMBER( data_w );
	DECLARE_WRITE_LINE_MEMBER( enable_w );

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

	// internal callbacks
	virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override;

private:
	inline void execute_command(int addr, int data);

	//sound_stream *m_stream[4];

	int m_enable;                   // enable latch
	int m_data;                     // data latch
	int m_clk;                      // clock latch
	uint16_t m_si;                    // serial in shift register

	int m_input;                    // input select
	int m_bass;                     // bass
	int m_treble;                   // treble
	int m_volume;                   // volume
	int m_fader_rf;                 // right front fader
	int m_fader_lf;                 // left front fader
	int m_fader_rr;                 // right rear fader
	int m_fader_lr;                 // left rear fader
};


// device type definition
DECLARE_DEVICE_TYPE(LMC1992, lmc1992_device)

#endif // MAME_SOUND_LMC1992_H