From feaaccb7e7961c2d8d51a6bb0e65d45d57ceb31b Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 8 Nov 2020 17:49:19 -0500 Subject: [PATCH] multipcm: Found the real 12-bit format flag. [R. Belmont] mu5: Adjusted PCM clock closer to correct. [R. Belmont] --- src/devices/sound/multipcm.cpp | 7 +++++-- src/mame/drivers/ymmu5.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp index 370d242ff3b..3e974703372 100644 --- a/src/devices/sound/multipcm.cpp +++ b/src/devices/sound/multipcm.cpp @@ -21,7 +21,9 @@ * bytes per instrument sample. This is very similar to the YMF278B 'OPL4'. * This sample format might be derived from the one used by the older YM7138 'GEW6' chip. * - * The first 3 bytes are the offset into the file (big endian). (0, 1, 2) + * The first 3 bytes are the offset into the file (big endian). (0, 1, 2). + Bit 23 is the sample format flag: 0 for 8-bit linear, 1 for 12-bit linear. + Bits 21 and 22 are used by the MU5 on some samples for as-yet unknown purposes. * The next 2 are the loop start point, in samples (big endian) (3, 4) * The next 2 are the 2's complement negation of of the total number of samples (big endian) (5, 6) * The next byte is LFO freq + depth (copied to reg 6 ?) (7, 8) @@ -80,6 +82,7 @@ void multipcm_device::init_sample(sample_t *sample, uint32_t index) uint32_t address = index * 12; sample->m_start = (read_byte(address) << 16) | (read_byte(address + 1) << 8) | read_byte(address + 2); + sample->m_format = (sample->m_start>>20) & 0xfe; sample->m_start &= 0x3fffff; sample->m_loop = (read_byte(address + 3) << 8) | read_byte(address + 4); sample->m_end = 0xffff - ((read_byte(address + 5) << 8) | read_byte(address + 6)); @@ -328,7 +331,6 @@ void multipcm_device::write_slot(slot_t &slot, int32_t reg, uint8_t data) { case 0: // PANPOT slot.m_pan = (data >> 4) & 0xf; - slot.m_format = (data & 0x0f); // bit 3: 0 = 8-bit linear, 1 = 12-bit linear break; case 1: // Sample @@ -367,6 +369,7 @@ void multipcm_device::write_slot(slot_t &slot, int32_t reg, uint8_t data) slot.m_offset = 0; slot.m_prev_sample = 0; slot.m_total_level = slot.m_dest_total_level << TL_SHIFT; + slot.m_format = slot.m_sample.m_format; envelope_generator_calc(slot); slot.m_envelope_gen.m_state = state_t::ATTACK; diff --git a/src/mame/drivers/ymmu5.cpp b/src/mame/drivers/ymmu5.cpp index f9da847382b..be7a4cd5866 100644 --- a/src/mame/drivers/ymmu5.cpp +++ b/src/mame/drivers/ymmu5.cpp @@ -225,7 +225,7 @@ void mu5_state::mu5(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MULTIPCM(config, m_ymw258, 9400000); + MULTIPCM(config, m_ymw258, 7500000); m_ymw258->set_addrmap(0, &mu5_state::ymw258_map); m_ymw258->add_route(0, "lspeaker", 1.0); m_ymw258->add_route(1, "rspeaker", 1.0);