From 9a7303ce8b654d2a101e8b2d07fff5d1e91cfc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Banaan=20Ananas?= Date: Thu, 22 May 2014 18:11:04 +0000 Subject: [PATCH] give cps3 sound its own headerfile --- .gitattributes | 1 + src/mame/audio/cps3.c | 7 ++-- src/mame/audio/cps3.h | 52 +++++++++++++++++++++++++++ src/mame/drivers/cps3.c | 1 + src/mame/includes/cps3.h | 76 +++++++--------------------------------- 5 files changed, 71 insertions(+), 66 deletions(-) create mode 100644 src/mame/audio/cps3.h diff --git a/.gitattributes b/.gitattributes index 0493649cb58..721ac8b11d0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4096,6 +4096,7 @@ src/mame/audio/circus.c svneol=native#text/plain src/mame/audio/cliffhgr.c svneol=native#text/plain src/mame/audio/copsnrob.c svneol=native#text/plain src/mame/audio/cps3.c svneol=native#text/plain +src/mame/audio/cps3.h svneol=native#text/plain src/mame/audio/crbaloon.c svneol=native#text/plain src/mame/audio/cyberbal.c svneol=native#text/plain src/mame/audio/dcs.c svneol=native#text/plain diff --git a/src/mame/audio/cps3.c b/src/mame/audio/cps3.c index a2d12c3c034..bc7767736d6 100644 --- a/src/mame/audio/cps3.c +++ b/src/mame/audio/cps3.c @@ -5,7 +5,8 @@ ***************************************************************************/ #include "emu.h" -#include "includes/cps3.h" +#include "includes/cps3.h" // ! see m_base +#include "cps3.h" // device type definition @@ -55,7 +56,7 @@ void cps3_sound_device::sound_stream_update(sound_stream &stream, stream_sample_ memset(outputs[0], 0, samples*sizeof(*outputs[0])); memset(outputs[1], 0, samples*sizeof(*outputs[1])); - for (int i = 0; i < CPS3_VOICES; i ++) + for (int i = 0; i < 16; i ++) { if (m_key & (1 << i)) { @@ -147,7 +148,7 @@ WRITE32_MEMBER( cps3_sound_device::cps3_sound_w ) UINT16 key = data >> 16; - for (int i = 0; i < CPS3_VOICES; i++) + for (int i = 0; i < 16; i++) { // Key off -> Key on if ((key & (1 << i)) && !(m_key & (1 << i))) diff --git a/src/mame/audio/cps3.h b/src/mame/audio/cps3.h new file mode 100644 index 00000000000..bd4609288de --- /dev/null +++ b/src/mame/audio/cps3.h @@ -0,0 +1,52 @@ +/*************************************************************************** + + Capcom CPS-3 Sound Hardware + +****************************************************************************/ + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +struct cps3_voice +{ + cps3_voice() : + pos(0), + frac(0) + { + memset(regs, 0, sizeof(UINT32)*8); + } + + UINT32 regs[8]; + UINT32 pos; + UINT32 frac; +}; + +// ======================> cps3_sound_device + +class cps3_sound_device : public device_t, + public device_sound_interface +{ +public: + cps3_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~cps3_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: + DECLARE_WRITE32_MEMBER( cps3_sound_w ); + DECLARE_READ32_MEMBER( cps3_sound_r ); + +private: + sound_stream *m_stream; + cps3_voice m_voice[16]; + UINT16 m_key; + INT8* m_base; +}; + +extern const device_type CPS3; diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 6068ca12319..e5786c6d9b4 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -462,6 +462,7 @@ hardware modification to the security cart..... #include "machine/intelfsh.h" #include "machine/nvram.h" #include "includes/cps3.h" +#include "audio/cps3.h" #include "bus/scsi/scsi.h" #include "bus/scsi/scsicd.h" #include "machine/wd33c93.h" diff --git a/src/mame/includes/cps3.h b/src/mame/includes/cps3.h index 3caf2b16bf5..ba75b7fa776 100644 --- a/src/mame/includes/cps3.h +++ b/src/mame/includes/cps3.h @@ -12,6 +12,9 @@ class cps3_state : public driver_device public: cps3_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), m_mainram(*this, "mainram"), m_spriteram(*this, "spriteram"), m_colourram(*this, "colourram"), @@ -20,10 +23,12 @@ public: m_tilemap40_regs_base(*this, "tmap40_regs"), m_tilemap50_regs_base(*this, "tmap50_regs"), m_fullscreenzoom(*this, "fullscreenzoom"), - m_0xc0000000_ram(*this, "0xc0000000_ram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_0xc0000000_ram(*this, "0xc0000000_ram") + { } + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; required_shared_ptr m_mainram; required_shared_ptr m_spriteram; @@ -71,6 +76,7 @@ public: unsigned short m_lastb; unsigned short m_lastb2; UINT8* m_user5region; + DECLARE_READ32_MEMBER(cps3_ssram_r); DECLARE_WRITE32_MEMBER(cps3_ssram_w); DECLARE_WRITE32_MEMBER(cps3_0xc0000000_ram_w); @@ -130,63 +136,7 @@ public: void cps3_process_character_dma(UINT32 address); void copy_from_nvram(); inline void cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangle &clip, gfx_element *gfx, - unsigned int code, unsigned int color, int flipx, int flipy, int sx, int sy, - int transparency, int transparent_color, - int scalex, int scaley, bitmap_ind8 *pri_buffer, UINT32 pri_mask); - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; + unsigned int code, unsigned int color, int flipx, int flipy, int sx, int sy, + int transparency, int transparent_color, + int scalex, int scaley, bitmap_ind8 *pri_buffer, UINT32 pri_mask); }; - - -/*----------- defined in audio/cps3.c -----------*/ - -#define CPS3_VOICES (16) - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -struct cps3_voice -{ - cps3_voice() : - pos(0), - frac(0) - { - memset(regs, 0, sizeof(UINT32)*8); - } - - UINT32 regs[8]; - UINT32 pos; - UINT32 frac; -}; - -// ======================> cps3_sound_device - -class cps3_sound_device : public device_t, - public device_sound_interface -{ -public: - cps3_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~cps3_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: - DECLARE_WRITE32_MEMBER( cps3_sound_w ); - DECLARE_READ32_MEMBER( cps3_sound_r ); - -private: - sound_stream *m_stream; - cps3_voice m_voice[CPS3_VOICES]; - UINT16 m_key; - INT8* m_base; -}; - -extern const device_type CPS3;