Imported LMC1992 audio mixer from MESS. (no whatsnew)

This commit is contained in:
Curt Coder 2011-04-25 14:56:03 +00:00
parent b2c353c7b6
commit 92ebabc84f
5 changed files with 422 additions and 0 deletions

2
.gitattributes vendored
View File

@ -1068,6 +1068,8 @@ src/emu/sound/k054539.c svneol=native#text/plain
src/emu/sound/k054539.h svneol=native#text/plain src/emu/sound/k054539.h svneol=native#text/plain
src/emu/sound/k056800.c svneol=native#text/plain src/emu/sound/k056800.c svneol=native#text/plain
src/emu/sound/k056800.h svneol=native#text/plain src/emu/sound/k056800.h svneol=native#text/plain
src/emu/sound/lmc1992.c svneol=native#text/plain
src/emu/sound/lmc1992.h svneol=native#text/plain
src/emu/sound/mas3507d.c svneol=native#text/plain src/emu/sound/mas3507d.c svneol=native#text/plain
src/emu/sound/mas3507d.h svneol=native#text/plain src/emu/sound/mas3507d.h svneol=native#text/plain
src/emu/sound/mos6560.c svneol=native#text/plain src/emu/sound/mos6560.c svneol=native#text/plain

271
src/emu/sound/lmc1992.c Normal file
View File

@ -0,0 +1,271 @@
/**********************************************************************
LMC1992 Digitally-Controlled Stereo Tone and Volume Circuit with
Four-Channel Input-Selector emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
/*
TODO:
- inputs
- outputs
- bass
- treble
- volume
- balance
*/
#include "lmc1992.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define LOG 0
#define MICROWIRE_DEVICE_ADDRESS 2
enum
{
FUNCTION_INPUT_SELECT = 0,
FUNCTION_BASS,
FUNCTION_TREBLE,
FUNCTION_VOLUME,
FUNCTION_RIGHT_FRONT_FADER,
FUNCTION_LEFT_FRONT_FADER,
FUNCTION_RIGHT_REAR_FADER,
FUNCTION_LEFT_REAR_FADER
};
enum
{
INPUT_SELECT_OPEN = 0,
INPUT_SELECT_INPUT1,
INPUT_SELECT_INPUT2,
INPUT_SELECT_INPUT3,
INPUT_SELECT_INPUT4
};
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// devices
const device_type LMC1992 = lmc1992_device_config::static_alloc_device_config;
//**************************************************************************
// DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// lmc1992_device_config - constructor
//-------------------------------------------------
lmc1992_device_config::lmc1992_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: device_config(mconfig, static_alloc_device_config, "LMC1992", tag, owner, clock),
device_config_sound_interface(mconfig, *this)
{
}
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
device_config *lmc1992_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(lmc1992_device_config(mconfig, tag, owner, clock));
}
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *lmc1992_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(machine, lmc1992_device(machine, *this));
}
//**************************************************************************
// INLINE HELPERS
//**************************************************************************
//-------------------------------------------------
// execute_command -
//-------------------------------------------------
inline void lmc1992_device::execute_command(int addr, int data)
{
switch (addr)
{
case FUNCTION_INPUT_SELECT:
if (data == INPUT_SELECT_OPEN)
{
if (LOG) logerror("LMC1992 '%s' Input Select : OPEN\n", tag());
}
else
{
if (LOG) logerror("LMC1992 '%s' Input Select : INPUT%u\n", tag(), data);
}
m_input = data;
break;
case FUNCTION_BASS:
if (LOG) logerror("LMC1992 '%s' Bass : %i dB\n", tag(), -40 + (data * 2));
m_bass = data;
break;
case FUNCTION_TREBLE:
if (LOG) logerror("LMC1992 '%s' Treble : %i dB\n", tag(), -40 + (data * 2));
m_treble = data;
break;
case FUNCTION_VOLUME:
if (LOG) logerror("LMC1992 '%s' Volume : %i dB\n", tag(), -80 + (data * 2));
m_volume = data;
break;
case FUNCTION_RIGHT_FRONT_FADER:
if (LOG) logerror("LMC1992 '%s' Right Front Fader : %i dB\n", tag(), -40 + (data * 2));
m_fader_rf = data;
break;
case FUNCTION_LEFT_FRONT_FADER:
if (LOG) logerror("LMC1992 '%s' Left Front Fader : %i dB\n", tag(), -40 + (data * 2));
m_fader_lf = data;
break;
case FUNCTION_RIGHT_REAR_FADER:
if (LOG) logerror("LMC1992 '%s' Right Rear Fader : %i dB\n", tag(), -40 + (data * 2));
m_fader_rr = data;
break;
case FUNCTION_LEFT_REAR_FADER:
if (LOG) logerror("LMC1992 '%s' Left Rear Fader : %i dB\n", tag(), -40 + (data * 2));
m_fader_lr = data;
break;
}
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// lmc1992_device - constructor
//-------------------------------------------------
lmc1992_device::lmc1992_device(running_machine &_machine, const lmc1992_device_config &config)
: device_t(_machine, config),
device_sound_interface(_machine, config, *this),
m_config(config)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void lmc1992_device::device_start()
{
// create sound streams
// register for state saving
save_item(NAME(m_enable));
save_item(NAME(m_data));
save_item(NAME(m_clock));
save_item(NAME(m_si));
save_item(NAME(m_input));
save_item(NAME(m_bass));
save_item(NAME(m_treble));
save_item(NAME(m_volume));
save_item(NAME(m_fader_rf));
save_item(NAME(m_fader_lf));
save_item(NAME(m_fader_rr));
save_item(NAME(m_fader_lr));
}
//-------------------------------------------------
// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
void lmc1992_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
}
//-------------------------------------------------
// clock_w -
//-------------------------------------------------
WRITE_LINE_MEMBER( lmc1992_device::clock_w )
{
if ((m_enable == 0) && ((m_clock == 0) && (state == 1)))
{
m_si >>= 1;
m_si = m_si & 0x7fff;
if (m_data)
{
m_si &= 0x8000;
}
}
m_clock = state;
}
//-------------------------------------------------
// data_w -
//-------------------------------------------------
WRITE_LINE_MEMBER( lmc1992_device::data_w )
{
m_data = state;
}
//-------------------------------------------------
// enable_w -
//-------------------------------------------------
WRITE_LINE_MEMBER( lmc1992_device::enable_w )
{
if ((m_enable == 0) && (state == 1))
{
UINT8 device_addr = (m_si & 0xc000) >> 14;
UINT8 addr = (m_si & 0x3800) >> 11;
UINT8 data = (m_si & 0x07e0) >> 5;
if (device_addr == MICROWIRE_DEVICE_ADDRESS)
{
execute_command(addr, data);
}
}
m_enable = state;
}

138
src/emu/sound/lmc1992.h Normal file
View File

@ -0,0 +1,138 @@
/**********************************************************************
LMC1992 Digitally-Controlled Stereo Tone and Volume Circuit with
Four-Channel Input-Selector emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
_____ _____
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
**********************************************************************/
#pragma once
#ifndef __LMC1992__
#define __LMC1992__
#include "emu.h"
//**************************************************************************
// 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
};
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_LMC1992_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, LMC1992, 0)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> lmc1992_device_config
class lmc1992_device_config : public device_config,
public device_config_sound_interface
{
friend class lmc1992_device;
// construction/destruction
lmc1992_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
// inline configuration helpers
static void static_set_config(device_config *device, int clock2);
};
// ======================> lmc1992_device
class lmc1992_device : public device_t,
public device_sound_interface
{
friend class lmc1992_device_config;
// construction/destruction
lmc1992_device(running_machine &_machine, const lmc1992_device_config &_config);
public:
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();
// internal callbacks
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
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_clock; // clock latch
UINT16 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
const lmc1992_device_config &m_config;
};
// device type definition
extern const device_type LMC1992;
#endif

View File

@ -280,6 +280,16 @@ endif
#-------------------------------------------------
# LMC1992 mixer chip
#-------------------------------------------------
ifneq ($(filter LMC1992,$(SOUNDS)),)
SOUNDOBJS += $(SOUNDOBJ)/lmc1992.o
endif
#------------------------------------------------- #-------------------------------------------------
# MAS 3507D MPEG 1/2 Layer 2/3 Audio Decoder # MAS 3507D MPEG 1/2 Layer 2/3 Audio Decoder
#------------------------------------------------- #-------------------------------------------------

View File

@ -229,6 +229,7 @@ SOUNDS += MOS656X
SOUNDS += S2636 SOUNDS += S2636
SOUNDS += ASC SOUNDS += ASC
SOUNDS += MAS3507D SOUNDS += MAS3507D
SOUNDS += LMC1992
#------------------------------------------------- #-------------------------------------------------