From 3b57b7e90ca67d58ac46136aacc30b55a15e1352 Mon Sep 17 00:00:00 2001 From: superctr Date: Fri, 17 Aug 2018 15:58:29 +0200 Subject: taito_zm: DSP emulation (work in progress!) (#3854) * taito_zm.cpp : Updates Add DSP, Reduce MCFGs, Add device_mixer_interface for sound gain, Add imperfect_features related to DSP, Add notes * taito_zm.cpp : Fix TMS57002 clock * Improve Taito Zoom ZSG-2 sound emulation zsg2.cpp: implement emphasis filter, this is a noise reduction scheme that amplifies higher frequncies to reduce quantization noise. zsg2.cpp: Add sample interpolation and another adjustable lowpass filter. This seems to be roughly what real hardware does... zsg2.cpp: Improve panning registers and identify DSP output gain registers. * zsg2: minor changes [nw] zsg2: Register 0b appears to be status flags [nw] zsg2: Linear ramping probably makes more sense [nw] * zsg2: slight adjustment of emphasis filter [nw] * zsg2: slight adjustment of emphasis filter #2 [nw] * zsg2: more sober ramping algorithm [nw] * tms57002: add instructions 3c/3d, make them behave as NOP as they're undocumented and not understood * tms57002: Add dready callback for superctr (nw) * tms57002: Fixes to make Taito Zoom DSP working tms57002: Add undocumented instruction saom / raom, they set saturation mode for the ALU. tms57002: Implement MACC pipeline. tms57002: Add callbacks for EMPTY and PC0 pins. tms57002: Add a few unimplemented instructions. tms57002: Proper behavior of CMEM UPLOAD mode. tms57002: Fix an issue where program is not properly loaded if PLOAD is set after a program has already been written. * Documentation fix, properly identified registers as ramping control, will implement that soon [nw] * taito_zm: Working DSP emulation Pretty much OST quality now. A pretty decent upgrade from how it was previously, I'd say. * typo [nw] * just adding some quick notes about the WIP [nw] * Fix build [nw] * zsg2: Proper ramping implemenation, add register map, minor cleanups * oops [nw] --- src/devices/sound/zsg2.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/devices/sound/zsg2.h') diff --git a/src/devices/sound/zsg2.h b/src/devices/sound/zsg2.h index 10ebb799b6f..18ec9304775 100644 --- a/src/devices/sound/zsg2.h +++ b/src/devices/sound/zsg2.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Olivier Galibert, R. Belmont, hap +// copyright-holders:Olivier Galibert, R. Belmont, hap, superctr /* ZOOM ZSG-2 custom wavetable synthesizer */ @@ -14,11 +14,6 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_ZSG2_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, ZSG2, _clock) -#define MCFG_ZSG2_REPLACE(_tag, _clock) \ - MCFG_DEVICE_REPLACE(_tag, ZSG2, _clock) - #define MCFG_ZSG2_EXT_READ_HANDLER(_devcb) \ downcast(*device).set_ext_read_handler(DEVCB_##_devcb); @@ -46,11 +41,14 @@ protected: virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; private: + const uint16_t STATUS_ACTIVE = 0x2000; + // 16 registers per channel, 48 channels struct zchan { uint16_t v[16]; - bool is_playing; + + uint16_t status; uint32_t cur_pos; uint32_t step_ptr; uint32_t step; @@ -62,14 +60,12 @@ private: uint16_t vol; uint16_t vol_initial; uint16_t vol_target; - - int16_t emphasis_cutoff; - int16_t emphasis_cutoff_initial; - int16_t emphasis_cutoff_target; + int16_t vol_delta; uint16_t output_cutoff; uint16_t output_cutoff_initial; uint16_t output_cutoff_target; + int16_t output_cutoff_delta; int32_t emphasis_filter_state; int32_t output_filter_state; @@ -81,7 +77,10 @@ private: }; uint16_t gain_tab[256]; + uint16_t gain_tab_frac[256]; + zchan m_chan[48]; + uint32_t m_sample_count; required_region_ptr m_mem_base; uint32_t m_read_address; @@ -100,8 +99,8 @@ private: uint16_t control_r(int reg); int16_t *prepare_samples(uint32_t offset); void filter_samples(zchan *ch); - int16_t expand_reg(uint8_t val); - inline int32_t ramp(int32_t current, int32_t target); + int16_t get_ramp(uint8_t val); + inline uint16_t ramp(uint16_t current, uint16_t target, int16_t delta); }; DECLARE_DEVICE_TYPE(ZSG2, zsg2_device) -- cgit v1.2.3-70-g09d2