summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2022-09-11 16:02:45 +0200
committer hap <happppp@users.noreply.github.com>2022-09-11 16:03:14 +0200
commit7e1451e92d37a2497a55039898a626fe68692fdd (patch)
tree8218bab2038ce120b618de9ea5b6d3fbcd3d4656 /src/devices/sound
parent2da17be127fa424fa421ba1b644dd8466902a51a (diff)
olibochu: add hc55516 device instead of adpcm
Diffstat (limited to 'src/devices/sound')
-rw-r--r--src/devices/sound/hc55516.cpp13
-rw-r--r--src/devices/sound/hc55516.h87
2 files changed, 71 insertions, 29 deletions
diff --git a/src/devices/sound/hc55516.cpp b/src/devices/sound/hc55516.cpp
index 5cd17aa6f12..33dcab70e6a 100644
--- a/src/devices/sound/hc55516.cpp
+++ b/src/devices/sound/hc55516.cpp
@@ -8,11 +8,13 @@
Harris HC-55532 (sometimes labeled HCI-55532 or HC1-55532) [preliminary]
Motorola MC-3417/MC-34115
Motorola MC-3418
- TODO: research HC-55536 and HC-55564 differences vs HC-55516 (better auto-zeroing, and removal of the encoder offset compensation DAC?)
-
- Driver TODOs:
- /src/mame/audio/exidy440.cpp has its own internal implementation of the MC3417 and MC3418, it should be using this file instead
+ TODO:
+ - see .h file
+ - research HC-55536 and HC-55564 differences vs HC-55516 (better auto-zeroing,
+ and removal of the encoder offset compensation DAC?)
+ - /src/mame/exidy/exidy440_a.cpp has its own internal implementation of the
+ MC3417 and MC3418, it should be using this file instead
*****************************************************************************/
@@ -142,7 +144,8 @@ inline bool cvsd_device_base::is_active_clock_transition(bool clock_state)
inline bool cvsd_device_base::current_clock_state()
{
// keep track of the clock state given its previous state and the number of samples produced
- // i.e. if we generated m_samples_generated samples, at a sample rate of SAMPLE_RATE, then are we on a positive or negative level of a squarewave at clock() hz? SAMPLE_RATE may not be an integer multiple of clock()
+ // i.e. if we generated m_samples_generated samples, at a sample rate of SAMPLE_RATE, then are we on a
+ // positive or negative level of a squarewave at clock() hz? SAMPLE_RATE may not be an integer multiple of clock()
//uint64_t fractions_of_second = (((uint64_t)m_samples_generated)<<32) / SAMPLE_RATE; // 32.32 bits of seconds passed so far
//uint32_t clock_edges_passed = (fractions_of_second * clock() * 2)>>32
//return (((((uint64_t)m_samples_generated<<32) * clock() * 2 / SAMPLE_RATE)>>32) & 0x1)?true:false;
diff --git a/src/devices/sound/hc55516.h b/src/devices/sound/hc55516.h
index 7ae6bd0c14a..8f06ba55a28 100644
--- a/src/devices/sound/hc55516.h
+++ b/src/devices/sound/hc55516.h
@@ -15,19 +15,55 @@ public:
FALLING=false
};
- auto clock_state_cb() { return m_clock_state_push_cb.bind(); } // A clock state change callback. Using this is a bad idea due to lack of synchronization to other devices. TODO: remove this.
- auto digin_cb() { return m_digin_pull_cb.bind(); } // Digital in pull callback function, for use if a clock is specified and we need to pull in the digital in pin state, otherwise unused. TODO: this is not hooked up yet, and should be.
- auto digout_cb() { return m_digout_push_cb.bind(); } // Digital out push callback function. TODO: this is not hooked up or implemented yet, although it is only really relevant for devices which use the CVSD chips in encode mode.
-
- READ_LINE_MEMBER( clock_r ); // Clock pull, really only relevant of something manually polls the clock (and clock is specified), which is a very bad design pattern and will cause synchronization/missed clock transition issues. This function WILL ASSERT if it is called and the clock hz is NOT specified! TODO: remove all use of this, and remove it.
- WRITE_LINE_MEMBER( mclock_w ); // Clock push; this function WILL ASSERT if it is called and the clock hz IS specified!
- WRITE_LINE_MEMBER( digin_w ); // Digital in push to the pin, as a pseudo 'buffer' implemented within the cvsd device itself. This is not technically accurate to hardware, and in the future should be deprecated in favor of digin_cb once the latter is implemented.
- WRITE_LINE_MEMBER( dec_encq_w ); //DEC/ENC decode/encode select push. This is not implemented yet, and relies on an input audio stream. TODO: implement this beyond a do-nothing stub
- READ_LINE_MEMBER( digout_r ); // Digital out pull. TODO: this is not hooked up or implemented yet, although it is only really relevant for devices which use the CVSD chips in encode mode.
- //void audio_in_w(stream_buffer::sample_t data); // Audio In pin, an analog value of the audio waveform being pushed to the chip. TODO: this is not hooked up or implemented yet, and this should really be handled as an input stream from a separate DAC device, not a value push function at all.
- void digit_w(int digit); /* sets the buffered digit (0 or 1), common to all chips. TODO: replace all use of this with digin_cb once implemented */
- void clock_w(int state); /* sets the clock state (0 or 1, clocked on the rising edge), common to all chips */
- virtual int clock_state_r(); /* returns whether the clock is currently LO or HI, common to all chips. TODO: get rid of all use of this, then get rid of it. */
+ // A clock state change callback. Using this is a bad idea due to lack of synchronization to other devices.
+ // TODO: remove this.
+ auto clock_state_cb() { return m_clock_state_push_cb.bind(); }
+
+ // Digital in pull callback function, for use if a clock is specified and we need to pull in the digital
+ // in pin state, otherwise unused. TODO: this is not hooked up yet, and should be.
+ auto digin_cb() { return m_digin_pull_cb.bind(); }
+
+ // Digital out push callback function. TODO: this is not hooked up or implemented yet, although it
+ // is only really relevant for devices which use the CVSD chips in encode mode.
+ auto digout_cb() { return m_digout_push_cb.bind(); }
+
+ // Clock pull, really only relevant of something manually polls the clock (and clock is specified),
+ // which is a very bad design pattern and will cause synchronization/missed clock transition issues.
+ // This function WILL ASSERT if it is called and the clock hz is NOT specified!
+ // TODO: remove all use of this, and remove it.
+ READ_LINE_MEMBER( clock_r );
+
+ // Clock push; this function WILL ASSERT if it is called and the clock hz IS specified!
+ WRITE_LINE_MEMBER( mclock_w );
+
+ // Digital in push to the pin, as a pseudo 'buffer' implemented within the cvsd device itself.
+ // This is not technically accurate to hardware, and in the future should be deprecated in favor of
+ // digin_cb once the latter is implemented.
+ WRITE_LINE_MEMBER( digin_w );
+
+ // DEC/ENC decode/encode select push. This is not implemented yet, and relies on an input audio stream.
+ // TODO: implement this beyond a do-nothing stub
+ WRITE_LINE_MEMBER( dec_encq_w );
+
+ // Digital out pull. TODO: this is not hooked up or implemented yet, although it is only really
+ // relevant for devices which use the CVSD chips in encode mode.
+ READ_LINE_MEMBER( digout_r );
+
+ // Audio In pin, an analog value of the audio waveform being pushed to the chip.
+ // TODO: this is not hooked up or implemented yet, and this should really be handled as an
+ // input stream from a separate DAC device, not a value push function at all.
+ //void audio_in_w(stream_buffer::sample_t data);
+
+ // sets the buffered digit (0 or 1), common to all chips. TODO: replace all use of this with
+ // digin_cb once implemented
+ void digit_w(int digit);
+
+ // sets the clock state (0 or 1, clocked on the rising edge), common to all chips
+ void clock_w(int state);
+
+ // returns whether the clock is currently LO or HI, common to all chips.
+ // TODO: get rid of all use of this, then get rid of it.
+ virtual int clock_state_r();
protected:
cvsd_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool active_clock_edge, uint8_t shiftreg_mask);
@@ -41,7 +77,7 @@ protected:
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
// callbacks
- devcb_write_line m_clock_state_push_cb; ///TODO: get rid of this, if you use it you should feel bad
+ devcb_write_line m_clock_state_push_cb; // TODO: get rid of this, if you use it you should feel bad
devcb_read_line m_digin_pull_cb;
devcb_write_line m_digout_push_cb;
@@ -51,22 +87,21 @@ protected:
// internal state
sound_stream *m_stream;
- bool m_last_clock_state;
- bool m_buffered_bit;
- uint8_t m_shiftreg;
+ bool m_last_clock_state;
+ bool m_buffered_bit;
+ uint8_t m_shiftreg;
stream_buffer::sample_t m_curr_sample;
stream_buffer::sample_t m_next_sample;
- uint32_t m_samples_generated;
+ uint32_t m_samples_generated;
// specific internal handler overrides, overridden by each chip
virtual void process_bit(bool bit, bool clock_state);
- ///TODO: get rid of these
+ // TODO: get rid of these
inline bool is_external_oscillator();
inline bool is_clock_changed(bool clock_state);
inline bool is_active_clock_transition(bool clock_state);
inline bool current_clock_state();
-
};
@@ -75,12 +110,15 @@ class hc55516_device : public cvsd_device_base
public:
hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- auto fzq_cb() { return m_fzq_pull_cb.bind(); } // /FZ (partial reset) pull callback, ok to leave unconnected (we assume it is pulled high)
- auto agc_cb() { return m_agc_push_cb.bind(); } // AGC callback function, called to push the state if the AGC pin changes, ok to leave unconnected
+ // /FZ (partial reset) pull callback, ok to leave unconnected (we assume it is pulled high)
+ auto fzq_cb() { return m_fzq_pull_cb.bind(); }
+
+ // AGC callback function, called to push the state if the AGC pin changes, ok to leave unconnected
+ auto agc_cb() { return m_agc_push_cb.bind(); }
WRITE_LINE_MEMBER( fzq_w ); // /FZ (partial reset) push
READ_LINE_MEMBER( agc_r ); // AGC pull
- /* TODO: These are only relevant for encode mode, which isn't done yet! */
+ // TODO: These are only relevant for encode mode, which isn't done yet!
//WRITE_LINE_MEMBER( aptq_w ); // /APT (silence encoder output) push
//WRITE_LINE_MEMBER( dec_encq_w ); // DEC/ENC decode/encode select push
@@ -144,7 +182,8 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
- // const coefficients defined by constructor; should these be adjustable by the user or externally defined, as they are implemented using a set of two small lowpass filters outside the chip?
+ // const coefficients defined by constructor; should these be adjustable by the user or externally defined,
+ // as they are implemented using a set of two small lowpass filters outside the chip?
const double m_charge;
const double m_decay;
const double m_leak;