diff options
author | 2020-08-19 19:33:13 -0700 | |
---|---|---|
committer | 2020-08-19 19:33:13 -0700 | |
commit | f7b263de20594fd720a8ff49b7528c48a64ddb9d (patch) | |
tree | abedd8ff2f40bac0e79a587b46d2b199dbe98fb8 /src/devices/sound/sp0250.h | |
parent | 92925532c301c9ac70c908ca84b6e30a11d3febf (diff) |
Sound and other improvements to Sega G-80 games. (#7103)
Sound and other improvements to Sega G-80 games: [Aaron Giles, couriersud]
* Added netlist-based sound to Eliminator, Zektor, Space Fury, and Astro Blaster.
* Split the Sega Universal Sound Board and Speech Boards into their own separate files.
* Improved Universal Sound Board implementation for better accuracy in Star Trek and Tac/Scan.
* Wrote netlist-based backend for Universal Sound Board; currently disabled due to limitations in the system.
* Wrote netlist-based backend for Speech Board; currently disabled pending future sound system changes.
* Implemented wait states and the vector DRAW flag to help improve timing.
SP0250 Improvements: [Aaron Giles]
* Matched clock divider to real chip measurements.
* Fixed behavior when not fed enough data; addresses "gapping" in speech in Sega games.
* Implemented accurate LFR noise generator according to real chip measurements.
* Added pulse-width modulation DAC output mode for future consumption by netlist.
Netlist additions: [Aaron Giles]
* Added compile-time option to record nltool-compatible CSV files.
* Improved CD4020 implementation.
* Fixed CD4053 behavior.
* Added 74139 device.
* Added TL082 device.
8253 PIT changes: [Aaron Giles]
* Added explicit synchronization to all writes.
* Cleaned up some timing calculations to avoid double<->attotime conversions.
Diffstat (limited to 'src/devices/sound/sp0250.h')
-rw-r--r-- | src/devices/sound/sp0250.h | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/src/devices/sound/sp0250.h b/src/devices/sound/sp0250.h index 9685fa4fea2..48f77a69d01 100644 --- a/src/devices/sound/sp0250.h +++ b/src/devices/sound/sp0250.h @@ -11,6 +11,7 @@ public: sp0250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto drq() { return m_drq.bind(); } + void set_pwm_mode() { m_pwm_mode = true; } void write(uint8_t data); uint8_t drq_r(); @@ -18,33 +19,56 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; private: - // internal state - int16_t m_amp; - uint8_t m_pitch; - uint8_t m_repeat; - int m_pcount, m_rcount; - int m_playing; - uint32_t m_RNG; - sound_stream * m_stream; - int m_voiced; - uint8_t m_fifo[15]; - int m_fifo_pos; - devcb_write_line m_drq; + // internal helpers + int8_t next(); + void load_values(); - struct + // state for each filter + class filter { + public: + filter() : z1(0), z2(0) { } + void reset() { z1 = z2 = 0; } + int16_t apply(int16_t in) + { + int16_t z0 = in + ((z1 * F) >> 8) + ((z2 * B) >> 9); + z2 = z1; + z1 = z0; + return z0; + } int16_t F, B; int16_t z1, z2; - } m_filter[6]; + }; - void load_values(); - TIMER_CALLBACK_MEMBER( timer_tick ); - emu_timer * m_tick_timer; + // PWM state + bool m_pwm_mode; + uint8_t m_pwm_index; + uint8_t m_pwm_count; + uint32_t m_pwm_counts; + + // LPC state + bool m_voiced; + int16_t m_amp; + uint16_t m_lfsr; + uint8_t m_pitch; + uint8_t m_pcount; + uint8_t m_repeat; + uint8_t m_rcount; + filter m_filter[6]; + + // FIFO state + uint8_t m_fifo[15]; + uint8_t m_fifo_pos; + + // external interfacing + sound_stream *m_stream; + devcb_write_line m_drq; }; DECLARE_DEVICE_TYPE(SP0250, sp0250_device) |