summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/waveblaster/waveblaster.h
blob: bfc58e7b98a8f2235e801ed61362d8fe3caa90c1 (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
49
50
51
52
53
54
55
56
57
58
59
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert

// Waveblaster midi extension cards

#ifndef MAME_BUS_WAVEBLASTER_WAVEBLASTER_H
#define MAME_BUS_WAVEBLASTER_WAVEBLASTER_H

#pragma once

class device_waveblaster_interface;

class waveblaster_connector: public device_t, public device_single_card_slot_interface<device_waveblaster_interface>, public device_mixer_interface
{
public:
	template <typename T>
	waveblaster_connector(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
		: waveblaster_connector(mconfig, tag, owner, (uint32_t)0)
	{
		option_reset();
		opts(*this);
		set_default_option(dflt);
		set_fixed(false);
	}

	waveblaster_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	void midi_rx(int state);
	auto midi_tx() { return m_midi_tx.bind(); }

	void do_midi_tx(int state) { m_midi_tx(state); }

protected:
	devcb_write_line m_midi_tx;

	virtual void device_start() override ATTR_COLD;
};

class device_waveblaster_interface: public device_interface
{
public:
	virtual ~device_waveblaster_interface();

	virtual void midi_rx(int state) = 0;

protected:
	waveblaster_connector *m_connector;

	device_waveblaster_interface(const machine_config &mconfig, device_t &device);

	virtual void interface_pre_start() override;
};

DECLARE_DEVICE_TYPE(WAVEBLASTER_CONNECTOR, waveblaster_connector)

void waveblaster_intf(device_slot_interface &device);

#endif // MAME_BUS_WAVEBLASTER_WAVEBLASTER_H