summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/dac76.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/dac76.h')
-rw-r--r--src/devices/sound/dac76.h91
1 files changed, 67 insertions, 24 deletions
diff --git a/src/devices/sound/dac76.h b/src/devices/sound/dac76.h
index c9a78c51a19..5f4edbd29f5 100644
--- a/src/devices/sound/dac76.h
+++ b/src/devices/sound/dac76.h
@@ -1,21 +1,37 @@
-// license: GPL-2.0+
-// copyright-holders: Dirk Best
+// license:BSD-3-Clause
+// copyright-holders:Dirk Best
/***************************************************************************
PMI DAC-76 COMDAC
- Companding D/A Converter
+ Companding Multiplying D/A Converter
+
+ Equivalent to the AM6070, which is an "improved pin-for-pin replacement for
+ DAC-76" (according to the AM6070 datasheet).
___ ___
- E/D 1 |* u | 10 VLC
- SB 2 | | 11 VR+
- B1 3 | | 12 VR-
- B2 4 | | 13 V-
+ E/D 1 |* u | 18 V+
+ SB 2 | | 17 IOD-
+ B1 3 | | 16 IOD+
+ B2 4 | | 15 IOE-
B3 5 | | 14 IOE+
- B4 6 | | 15 IOE-
- B5 7 | | 16 IOD+
- B6 8 | | 17 IOD-
- B7 9 |_______| 18 V+
+ B4 6 | | 13 V-
+ B5 7 | | 12 VR-
+ B6 8 | | 11 VR+
+ B7 9 |_______| 10 VLC
+
+ Given:
+ - Iref = current flowing into VR+
+ - X = DAC value, normalized to [-1, 1]
+ - E/D (pin 1) is low
+
+ The output will be:
+ - IOD+ = (X > 0) ? (3.8 * Iref * abs(X)) : 0
+ - IOD- = (X < 0) ? (3.8 * Iref * abs(X)) : 0
+
+ The outputs are typically converted to voltages and summed into a single
+ signal by a current-to-voltage converter (I2V) consisting of an op-amp and
+ two resistors.
***************************************************************************/
@@ -36,37 +52,64 @@ public:
// construction/destruction
dac76_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ // When streaming is enabled, the Iref will be obtained from the input sound
+ // stream. Otherwise, the value set with `set_fixed_iref` will be used.
+ void configure_streaming_iref(bool streaming_iref);
+
+ // By default, the control current (Iref) is treated as normalized ([0, 1],
+ // defaults to 1), and the sound output is normalized to [-1, 1].
+ //
+ // When in "voltage output" mode, Iref (fixed or streaming) should be the
+ // current flowing into pin 11, and the output will be a voltage stream.
+ // `r_pos` is the feedback resistor of the I2V, which is also connected to
+ // IOD+ (pin 16).
+ // `r_neg` is the resistor to ground connected to IOD- (pin 17).
+ // Note that r_pos connects to the "-" input of the I2V op-amp, and r_neg to
+ // the "+" input.
+ void configure_voltage_output(float i2v_r_pos, float i2v_r_neg);
+
+ // Reference current. Ignored when streaming Iref mode is enabled.
+ void set_fixed_iref(float iref);
+
// chord
- DECLARE_WRITE_LINE_MEMBER(b1_w) { m_chord &= ~(1 << 2); m_chord |= (state << 2); };
- DECLARE_WRITE_LINE_MEMBER(b2_w) { m_chord &= ~(1 << 1); m_chord |= (state << 1); };
- DECLARE_WRITE_LINE_MEMBER(b3_w) { m_chord &= ~(1 << 0); m_chord |= (state << 0); };
+ void b1_w(int state) { m_chord &= ~(1 << 2); m_chord |= (state << 2); }
+ void b2_w(int state) { m_chord &= ~(1 << 1); m_chord |= (state << 1); }
+ void b3_w(int state) { m_chord &= ~(1 << 0); m_chord |= (state << 0); }
// step
- DECLARE_WRITE_LINE_MEMBER(b4_w) { m_step &= ~(1 << 3); m_step |= (state << 3); };
- DECLARE_WRITE_LINE_MEMBER(b5_w) { m_step &= ~(1 << 2); m_step |= (state << 2); };
- DECLARE_WRITE_LINE_MEMBER(b6_w) { m_step &= ~(1 << 1); m_step |= (state << 1); };
- DECLARE_WRITE_LINE_MEMBER(b7_w) { m_step &= ~(1 << 0); m_step |= (state << 0); };
+ void b4_w(int state) { m_step &= ~(1 << 3); m_step |= (state << 3); }
+ void b5_w(int state) { m_step &= ~(1 << 2); m_step |= (state << 2); }
+ void b6_w(int state) { m_step &= ~(1 << 1); m_step |= (state << 1); }
+ void b7_w(int state) { m_step &= ~(1 << 0); m_step |= (state << 0); }
// sign bit
- DECLARE_WRITE_LINE_MEMBER(sb_w) { m_sb = bool(state); };
+ void sb_w(int state) { m_sb = bool(state); }
void update() { m_stream->update(); }
protected:
// device-level overrides
- virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
- virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void sound_stream_update(sound_stream &stream) override;
private:
static constexpr int m_level[8] = { 0, 33, 99, 231, 495, 1023, 2079, 4191 };
sound_stream *m_stream;
- uint8_t m_chord; // 4-bit
- uint8_t m_step; // 3-bit
+ // configuration
+ bool m_streaming_iref;
+ bool m_voltage_output;
+ float m_r_pos;
+ float m_r_neg;
+
+ // state
+ uint8_t m_chord; // 3-bit
+ uint8_t m_step; // 4-bit
bool m_sb;
+ float m_fixed_iref;
};
// device type definition