blob: 6493dbc7bd42409bdd08c966269d94eceb37dd76 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// license:BSD-3-Clause
// copyright-holders:smf
/***************************************************************************
volt_reg.h
Voltage Regulator
***************************************************************************/
#ifndef MAME_SOUND_VOLT_REG_H
#define MAME_SOUND_VOLT_REG_H
#pragma once
#define MCFG_VOLTAGE_REGULATOR_OUTPUT(_output) \
downcast<voltage_regulator_device &>(*device).set_output(_output);
class voltage_regulator_device : public device_t, public device_sound_interface
{
public:
void set_output(double analogue_dc) { m_output = (analogue_dc * 32768) / 5.0f; }
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner)
: voltage_regulator_device(mconfig, tag, owner, (uint32_t)0)
{
}
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual bool issound() override { return false; }
protected:
// device-level overrides
virtual void device_start() 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:
sound_stream* m_stream;
stream_sample_t m_output;
};
DECLARE_DEVICE_TYPE(VOLTAGE_REGULATOR, voltage_regulator_device)
#endif // MAME_SOUND_VOLT_REG_H
|