toprollr: correct samples base pitch

This commit is contained in:
hap 2022-06-08 02:12:51 +02:00
parent f67daff909
commit 7994bfbffa
4 changed files with 19 additions and 14 deletions

View File

@ -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<int16_t[]>(2 * m_samples_region.bytes());
save_pointer(NAME(m_sample_buf), 2 * m_samples_region.bytes());
m_sample_buf = std::make_unique<int16_t[]>(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)

View File

@ -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<samples_device> m_samples;
required_region_ptr<uint8_t> m_samples_region;

View File

@ -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_device>("screen")->set_screen_update(FUNC(cclimber_state::screen_update_toprollr));
subdevice<cclimber_audio_device>("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 )

View File

@ -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);
}