summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/wave.h
blob: e374717bad9624414f63564bfd3d0ea43653b90c (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:Nathan Woods
/**********************************************************************

    Cassette wave samples sound driver

**********************************************************************/

#ifndef MAME_SOUND_WAVE_H
#define MAME_SOUND_WAVE_H

#pragma once

#include "imagedev/cassette.h"


/*****************************************************************************
 *  CassetteWave interface
 *****************************************************************************/

class wave_device : public device_t, public device_sound_interface
{
public:
	template <typename T>
	wave_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cassette_tag)
		: wave_device(mconfig, tag, owner)
	{
		m_cass.set_tag(std::forward<T>(cassette_tag));
	}
	wave_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock = XTAL());

	template <typename T> void set_cassette_tag(T &&cassette_tag) { m_cass.set_tag(std::forward<T>(cassette_tag)); }

protected:
	// device-level overrides
	virtual void device_start() override;

	// 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;

private:
	required_device<cassette_image_device> m_cass;
	std::vector<s16> m_sample_buf;
};

DECLARE_DEVICE_TYPE(WAVE, wave_device)

#endif // MAME_SOUND_WAVE_H