From 7994bfbffa5b50a38df03e2172d2695911e18043 Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 8 Jun 2022 02:12:51 +0200 Subject: toprollr: correct samples base pitch --- src/mame/audio/cclimber.cpp | 17 ++++++++--------- src/mame/audio/cclimber.h | 3 +++ src/mame/drivers/cclimber.cpp | 11 +++++++---- src/mame/drivers/galaxian.cpp | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/mame/audio/cclimber.cpp b/src/mame/audio/cclimber.cpp index 9a4f248eb0a..60e488afe16 100644 --- a/src/mame/audio/cclimber.cpp +++ b/src/mame/audio/cclimber.cpp @@ -9,12 +9,10 @@ // macro to convert 4-bit unsigned samples to 16-bit signed samples #define SAMPLE_CONV4(a) (0x1111*((a&0x0f))-0x8000) -#define SND_CLOCK 3072000 /* 3.072 MHz */ - SAMPLES_START_CB_MEMBER( cclimber_audio_device::sh_start ) { - m_sample_buf = std::make_unique(2 * m_samples_region.bytes()); - save_pointer(NAME(m_sample_buf), 2 * m_samples_region.bytes()); + m_sample_buf = std::make_unique(2 * m_samples_region.bytes()); + save_pointer(NAME(m_sample_buf), 2 * m_samples_region.bytes()); } //************************************************************************** @@ -28,12 +26,13 @@ DEFINE_DEVICE_TYPE(CCLIMBER_AUDIO, cclimber_audio_device, "cclimber_audio", "Cra // cclimber_audio_device: Constructor //------------------------------------------------- -cclimber_audio_device::cclimber_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, CCLIMBER_AUDIO, tag, owner, clock), +cclimber_audio_device::cclimber_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, CCLIMBER_AUDIO, tag, owner, clock), m_sample_buf(nullptr), m_sample_num(0), m_sample_freq(0), m_sample_volume(0), + m_sample_clockdiv(2), m_samples(*this, "samples"), m_samples_region(*this, "samples") { @@ -56,7 +55,7 @@ void cclimber_audio_device::device_start() void cclimber_audio_device::device_add_mconfig(machine_config &config) { - ay8910_device &aysnd(AY8910(config, "aysnd", SND_CLOCK/2)); + ay8910_device &aysnd(AY8910(config, "aysnd", DERIVED_CLOCK(1, 1))); aysnd.port_a_write_callback().set(FUNC(cclimber_audio_device::sample_select_w)); aysnd.add_route(ALL_OUTPUTS, ":speaker", 0.5); @@ -75,12 +74,12 @@ void cclimber_audio_device::sample_select_w(uint8_t data) void cclimber_audio_device::sample_rate_w(uint8_t data) { // calculate the sampling frequency - m_sample_freq = SND_CLOCK / 4 / (256 - data); + m_sample_freq = clock() / m_sample_clockdiv / (256 - data); } void cclimber_audio_device::sample_volume_w(uint8_t data) { - m_sample_volume = data & 0x1f; // range 0-31 + m_sample_volume = data & 0x1f; // range 0-31 } void cclimber_audio_device::sample_trigger(int state) diff --git a/src/mame/audio/cclimber.h b/src/mame/audio/cclimber.h index 0ff00ab112c..8d5bc8131bf 100644 --- a/src/mame/audio/cclimber.h +++ b/src/mame/audio/cclimber.h @@ -24,6 +24,8 @@ public: // construction/destruction cclimber_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + auto &set_sample_clockdiv(uint8_t div) { m_sample_clockdiv = div; return *this; } // determines base sound pitch (default 2) + void sample_trigger(int state); void sample_trigger_w(uint8_t data); void sample_rate_w(uint8_t data); @@ -41,6 +43,7 @@ private: uint8_t m_sample_num; uint32_t m_sample_freq; uint8_t m_sample_volume; + uint8_t m_sample_clockdiv; required_device m_samples; required_region_ptr m_samples_region; diff --git a/src/mame/drivers/cclimber.cpp b/src/mame/drivers/cclimber.cpp index de9d7265991..4e1114beb8f 100644 --- a/src/mame/drivers/cclimber.cpp +++ b/src/mame/drivers/cclimber.cpp @@ -146,14 +146,15 @@ TODO: - bg gradient color decode & table selection - Top Roller: - ---------- + Top Roller: + ---------- It's made by the same developers as Yamato and use probably the same encrypted SEGA cpu as Yamato. lives - $6155 TODO: + - some of the samples should loop (truck, helicopter, motorcycle) - COINB DSW is missing - few issues in cocktail mode @@ -1165,7 +1166,7 @@ void cclimber_state::cclimber(machine_config &config) /* sound hardware */ SPEAKER(config, "speaker").front_center(); - CCLIMBER_AUDIO(config, "cclimber_audio", 0); + CCLIMBER_AUDIO(config, "cclimber_audio", XTAL(18'432'000)/3/2/2); } void cclimber_state::rpatrol(machine_config &config) @@ -1272,6 +1273,8 @@ void cclimber_state::toprollr(machine_config &config) MCFG_VIDEO_START_OVERRIDE(cclimber_state,toprollr) subdevice("screen")->set_screen_update(FUNC(cclimber_state::screen_update_toprollr)); + + subdevice("cclimber_audio")->set_sample_clockdiv(4); } @@ -2805,4 +2808,4 @@ GAME( 1983, guzzlers, guzzler, guzzler, guzzler, cclimber_state, empty_i GAME( 1983, yamato, 0, yamato, yamato, cclimber_state, init_yamato, ROT90, "Sega", "Yamato (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1983, yamato2, yamato, yamato, yamato, cclimber_state, init_yamato, ROT90, "Sega", "Yamato (World?)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1983, toprollr, 0, toprollr, toprollr, cclimber_state, init_toprollr, ROT90, "Jaleco", "Top Roller", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, toprollr, 0, toprollr, toprollr, cclimber_state, init_toprollr, ROT90, "Jaleco", "Top Roller", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 4866b6f1b19..24787e32547 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -7859,7 +7859,7 @@ void mshuttle_state::mshuttle(machine_config &config) set_irq_line(0); // sound hardware - CCLIMBER_AUDIO(config, "cclimber_audio", 0); + CCLIMBER_AUDIO(config, "cclimber_audio", GALAXIAN_PIXEL_CLOCK/3/2/2); } -- cgit v1.2.3