summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/ta7630.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/ta7630.cpp')
-rw-r--r--src/devices/sound/ta7630.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/devices/sound/ta7630.cpp b/src/devices/sound/ta7630.cpp
new file mode 100644
index 00000000000..50bb605bedf
--- /dev/null
+++ b/src/devices/sound/ta7630.cpp
@@ -0,0 +1,93 @@
+// license:BSD-3-Clause
+// copyright-holders:Angelo Salese
+/***************************************************************************
+
+ TA7630P
+
+ Toshiba Dual. Volume / Balance / Tone (Bass/Treble)
+
+ A set of discrete filters that applies to sound chip outputs.
+ According to the datasheet, two channels are outputted from here after it applies
+ all of the filters
+
+ TODO:
+ - mostly a placeholder, needs a way to read from sound chips and output
+ back with filters enabled;
+ - filters balance/bass/treble;
+
+***************************************************************************/
+
+#include "emu.h"
+#include "ta7630.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definition
+DEFINE_DEVICE_TYPE(TA7630, ta7630_device, "ta7630", "TA7630 Device")
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// ta7630_device - constructor
+//-------------------------------------------------
+
+ta7630_device::ta7630_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, TA7630, tag, owner, clock)
+// ,device_sound_interface(mconfig, *this)
+{
+}
+
+
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void ta7630_device::device_start()
+{
+ int i;
+
+ double db = 0.0;
+ double db_step = 1.50; /* 1.50 dB step (at least, maybe more) */
+ double db_step_inc = 0.125;
+ for (i = 0; i < 16; i++)
+ {
+ double max = 100.0 / pow(10.0, db/20.0 );
+ m_vol_ctrl[15 - i] = max / 100.0;
+ //m_vol_ctrl[i] = max;
+ /*logerror("vol_ctrl[%x] = %i (%f dB)\n", 15 - i, m_vol_ctrl[15 - i], db);*/
+ db += db_step;
+ db_step += db_step_inc;
+ }
+
+ save_item(NAME(m_vol_ctrl));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void ta7630_device::device_reset()
+{
+
+}
+
+
+//**************************************************************************
+// filter setters
+//**************************************************************************
+
+void ta7630_device::set_device_volume(device_sound_interface *device,uint8_t value)
+{
+ device->set_output_gain(ALL_OUTPUTS,m_vol_ctrl[value & 0xf]);
+}
+