From 4ebee5fd3ff9ae296a3f666b5a939a457f68bd2f Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Sat, 11 Oct 2014 09:24:04 +0000 Subject: [PATCH] given to a couple of sound devices their own include. nw. --- .gitattributes | 6 +- src/mess/audio/{vc4000.c => vc4000snd.c} | 6 +- src/mess/audio/vc4000snd.h | 45 ++++++++++++ src/mess/audio/{wswan.c => wswan_snd.c} | 6 +- src/mess/audio/wswan_snd.h | 89 ++++++++++++++++++++++++ src/mess/drivers/vc4000.c | 2 +- src/mess/drivers/wswan.c | 2 +- src/mess/includes/vc4000.h | 36 +--------- src/mess/includes/wswan.h | 81 +-------------------- src/mess/mess.mak | 4 +- 10 files changed, 150 insertions(+), 127 deletions(-) rename src/mess/audio/{vc4000.c => vc4000snd.c} (87%) create mode 100644 src/mess/audio/vc4000snd.h rename src/mess/audio/{wswan.c => wswan_snd.c} (98%) create mode 100644 src/mess/audio/wswan_snd.h diff --git a/.gitattributes b/.gitattributes index 5c1e0f93315..6727b6c7526 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8054,8 +8054,10 @@ src/mess/audio/upd1771.c svneol=native#text/plain src/mess/audio/upd1771.h svneol=native#text/plain src/mess/audio/vboy.c svneol=native#text/plain src/mess/audio/vboy.h svneol=native#text/plain -src/mess/audio/vc4000.c svneol=native#text/plain -src/mess/audio/wswan.c svneol=native#text/plain +src/mess/audio/vc4000snd.c svneol=native#text/plain +src/mess/audio/vc4000snd.h svneol=native#text/plain +src/mess/audio/wswan_snd.c svneol=native#text/plain +src/mess/audio/wswan_snd.h svneol=native#text/plain src/mess/drivers/4004clk.c svneol=native#text/plain src/mess/drivers/68ksbc.c svneol=native#text/plain src/mess/drivers/a2600.c svneol=native#text/plain diff --git a/src/mess/audio/vc4000.c b/src/mess/audio/vc4000snd.c similarity index 87% rename from src/mess/audio/vc4000.c rename to src/mess/audio/vc4000snd.c index d914930c44e..6fc29ed200f 100644 --- a/src/mess/audio/vc4000.c +++ b/src/mess/audio/vc4000snd.c @@ -5,13 +5,13 @@ ***************************************************************************/ -#include "includes/vc4000.h" +#include "vc4000snd.h" -const device_type VC4000 = &device_creator; +const device_type VC4000_SND = &device_creator; vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, VC4000, "Intertion Electronic VC 4000 Audio Custom", tag, owner, clock, "vc4000_sound", __FILE__), + : device_t(mconfig, VC4000_SND, "Intertion Electronic VC 4000 Audio Custom", tag, owner, clock, "vc4000_sound", __FILE__), device_sound_interface(mconfig, *this), m_channel(NULL), m_size(0), diff --git a/src/mess/audio/vc4000snd.h b/src/mess/audio/vc4000snd.h new file mode 100644 index 00000000000..531556084f0 --- /dev/null +++ b/src/mess/audio/vc4000snd.h @@ -0,0 +1,45 @@ +/***************************************************************************** + * + * includes/vc4000snd.h + * + ****************************************************************************/ + +#ifndef _VC4000SND_H_ +#define _VC4000SND_H_ + +#include "emu.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> vc4000_sound_device + +class vc4000_sound_device : public device_t, + public device_sound_interface +{ +public: + vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vc4000_sound_device() { } + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +public: + void soundport_w(int mode, int data); + +private: + sound_stream *m_channel; + UINT8 m_reg[1]; + int m_size; + int m_pos; + unsigned m_level; +}; + +extern const device_type VC4000_SND; + +#endif /* _VC4000SND_H_ */ diff --git a/src/mess/audio/wswan.c b/src/mess/audio/wswan_snd.c similarity index 98% rename from src/mess/audio/wswan.c rename to src/mess/audio/wswan_snd.c index 68c0b6a9a5d..e24f060dfda 100644 --- a/src/mess/audio/wswan.c +++ b/src/mess/audio/wswan_snd.c @@ -11,11 +11,11 @@ The noise taps and behavior are the same as the Virtual Boy. **************************************************************************************/ -#include "includes/wswan.h" +#include "wswan_snd.h" // device type definition -const device_type WSWAN = &device_creator; +const device_type WSWAN_SND = &device_creator; //************************************************************************** @@ -27,7 +27,7 @@ const device_type WSWAN = &device_creator; //------------------------------------------------- wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, WSWAN, "WonderSwan Audio Custom", tag, owner, clock, "wswan_sound", __FILE__), + : device_t(mconfig, WSWAN_SND, "WonderSwan Audio Custom", tag, owner, clock, "wswan_sound", __FILE__), device_sound_interface(mconfig, *this), m_channel(NULL), m_sweep_step(0), diff --git a/src/mess/audio/wswan_snd.h b/src/mess/audio/wswan_snd.h new file mode 100644 index 00000000000..a586a002cd3 --- /dev/null +++ b/src/mess/audio/wswan_snd.h @@ -0,0 +1,89 @@ +/***************************************************************************** + * + * includes/wswan_snd.h + * + ****************************************************************************/ + +#pragma once + +#ifndef _WSWAN_SND_H_ +#define _WSWAN_SND_H_ + +#include "emu.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +struct CHAN +{ + CHAN() : + freq(0), + period(0), + pos(0), + vol_left(0), + vol_right(0), + on(0), + signal(0) { } + + UINT16 freq; /* frequency */ + UINT32 period; /* period */ + UINT32 pos; /* position */ + UINT8 vol_left; /* volume left */ + UINT8 vol_right; /* volume right */ + UINT8 on; /* on/off */ + INT8 signal; /* signal */ +}; + + +// ======================> wswan_sound_device + +class wswan_sound_device : public device_t, + public device_sound_interface +{ +public: + wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~wswan_sound_device() { } + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +public: + DECLARE_WRITE8_MEMBER( port_w ); + +private: + void wswan_ch_set_freq( CHAN *ch, UINT16 freq ); + +private: + sound_stream *m_channel; + CHAN m_audio1; /* Audio channel 1 */ + CHAN m_audio2; /* Audio channel 2 */ + CHAN m_audio3; /* Audio channel 3 */ + CHAN m_audio4; /* Audio channel 4 */ + INT8 m_sweep_step; /* Sweep step */ + UINT32 m_sweep_time; /* Sweep time */ + UINT32 m_sweep_count; /* Sweep counter */ + UINT8 m_noise_type; /* Noise generator type */ + UINT8 m_noise_reset; /* Noise reset */ + UINT8 m_noise_enable; /* Noise enable */ + UINT16 m_sample_address; /* Sample address */ + UINT8 m_audio2_voice; /* Audio 2 voice */ + UINT8 m_audio3_sweep; /* Audio 3 sweep */ + UINT8 m_audio4_noise; /* Audio 4 noise */ + UINT8 m_mono; /* mono */ + UINT8 m_voice_data; /* voice data */ + UINT8 m_output_volume; /* output volume */ + UINT8 m_external_stereo; /* external stereo */ + UINT8 m_external_speaker; /* external speaker */ + UINT16 m_noise_shift; /* Noise counter shift register */ + UINT8 m_master_volume; /* Master volume */ +}; + +extern const device_type WSWAN_SND; + +#endif diff --git a/src/mess/drivers/vc4000.c b/src/mess/drivers/vc4000.c index ce5f7c490d2..085fb44ec62 100644 --- a/src/mess/drivers/vc4000.c +++ b/src/mess/drivers/vc4000.c @@ -539,7 +539,7 @@ static MACHINE_CONFIG_START( vc4000, vc4000_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("custom", VC4000, 0) + MCFG_SOUND_ADD("custom", VC4000_SND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* quickload */ diff --git a/src/mess/drivers/wswan.c b/src/mess/drivers/wswan.c index edbc4eab746..a4c7c1ed4a2 100644 --- a/src/mess/drivers/wswan.c +++ b/src/mess/drivers/wswan.c @@ -126,7 +126,7 @@ static MACHINE_CONFIG_START( wswan, wswan_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("custom", WSWAN, 0) + MCFG_SOUND_ADD("custom", WSWAN_SND, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) diff --git a/src/mess/includes/vc4000.h b/src/mess/includes/vc4000.h index bdba708b86c..82c59b38809 100644 --- a/src/mess/includes/vc4000.h +++ b/src/mess/includes/vc4000.h @@ -8,6 +8,7 @@ #define VC4000_H_ #include "emu.h" +#include "audio/vc4000snd.h" #include "cpu/s2650/s2650.h" #include "imagedev/snapquik.h" #include "imagedev/cassette.h" @@ -148,39 +149,4 @@ protected: inline void vc4000_draw_grid(UINT8 *collision); }; -/*----------- defined in audio/vc4000.c -----------*/ - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> vc4000_sound_device - -class vc4000_sound_device : public device_t, - public device_sound_interface -{ -public: - vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~vc4000_sound_device() { } - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -public: - void soundport_w(int mode, int data); - -private: - sound_stream *m_channel; - UINT8 m_reg[1]; - int m_size; - int m_pos; - unsigned m_level; -}; - -extern const device_type VC4000; - #endif /* VC4000_H_ */ diff --git a/src/mess/includes/wswan.h b/src/mess/includes/wswan.h index 3cf394adebf..c92c9d95e31 100644 --- a/src/mess/includes/wswan.h +++ b/src/mess/includes/wswan.h @@ -17,6 +17,7 @@ #include "emu.h" #include "cpu/v30mz/v30mz.h" +#include "audio/wswan_snd.h" #include "machine/nvram.h" #include "bus/wswan/slot.h" #include "bus/wswan/rom.h" @@ -75,8 +76,6 @@ struct VDP emu_timer *timer; }; -class wswan_sound_device; - class wswan_state : public driver_device { @@ -161,82 +160,4 @@ protected: }; -/*----------- defined in audio/wswan.c -----------*/ - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -struct CHAN -{ - CHAN() : - freq(0), - period(0), - pos(0), - vol_left(0), - vol_right(0), - on(0), - signal(0) { } - - UINT16 freq; /* frequency */ - UINT32 period; /* period */ - UINT32 pos; /* position */ - UINT8 vol_left; /* volume left */ - UINT8 vol_right; /* volume right */ - UINT8 on; /* on/off */ - INT8 signal; /* signal */ -}; - - -// ======================> wswan_sound_device - -class wswan_sound_device : public device_t, - public device_sound_interface -{ -public: - wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~wswan_sound_device() { } - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); - -public: - DECLARE_WRITE8_MEMBER( port_w ); - -private: - void wswan_ch_set_freq( CHAN *ch, UINT16 freq ); - -private: - sound_stream *m_channel; - CHAN m_audio1; /* Audio channel 1 */ - CHAN m_audio2; /* Audio channel 2 */ - CHAN m_audio3; /* Audio channel 3 */ - CHAN m_audio4; /* Audio channel 4 */ - INT8 m_sweep_step; /* Sweep step */ - UINT32 m_sweep_time; /* Sweep time */ - UINT32 m_sweep_count; /* Sweep counter */ - UINT8 m_noise_type; /* Noise generator type */ - UINT8 m_noise_reset; /* Noise reset */ - UINT8 m_noise_enable; /* Noise enable */ - UINT16 m_sample_address; /* Sample address */ - UINT8 m_audio2_voice; /* Audio 2 voice */ - UINT8 m_audio3_sweep; /* Audio 3 sweep */ - UINT8 m_audio4_noise; /* Audio 4 noise */ - UINT8 m_mono; /* mono */ - UINT8 m_voice_data; /* voice data */ - UINT8 m_output_volume; /* output volume */ - UINT8 m_external_stereo; /* external stereo */ - UINT8 m_external_speaker; /* external speaker */ - UINT16 m_noise_shift; /* Noise counter shift register */ - UINT8 m_master_volume; /* Master volume */ -}; - -extern const device_type WSWAN; - - #endif /* WSWAN_H_ */ diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 7821e176761..37f2bcf3574 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1026,7 +1026,7 @@ $(MESSOBJ)/bally.a: \ $(MESSOBJ)/bandai.a: \ $(MESS_DRIVERS)/sv8000.o \ $(MESS_DRIVERS)/rx78.o \ - $(MESS_DRIVERS)/wswan.o $(MESS_AUDIO)/wswan.o $(MESS_MACHINE)/wswan.o $(MESS_VIDEO)/wswan.o \ + $(MESS_DRIVERS)/wswan.o $(MESS_AUDIO)/wswan_snd.o $(MESS_MACHINE)/wswan.o $(MESS_VIDEO)/wswan.o \ $(MESSOBJ)/be.a: \ $(MESS_DRIVERS)/bebox.o $(MESS_MACHINE)/bebox.o \ @@ -1308,7 +1308,7 @@ $(MESSOBJ)/imp.a: \ $(MESS_DRIVERS)/tim100.o \ $(MESSOBJ)/interton.a: \ - $(MESS_DRIVERS)/vc4000.o $(MESS_AUDIO)/vc4000.o $(MESS_VIDEO)/vc4000.o \ + $(MESS_DRIVERS)/vc4000.o $(MESS_AUDIO)/vc4000snd.o $(MESS_VIDEO)/vc4000.o \ $(MESSOBJ)/intv.a: \ $(MESS_DRIVERS)/intv.o $(MESS_MACHINE)/intv.o $(MESS_VIDEO)/intv.o $(MESS_VIDEO)/stic.o \