Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio/flower.cpp: Fix Volume LUT ROM accessing, Add notes #9011

Merged
merged 1 commit into from
Dec 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/mame/audio/flower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<

for (int i = 0; i < buffer.samples(); i++)
{
// Volume LUT ROM address bit:
// Bit 0-7: Sample ROM data
// Bit 8-11: Channel Volume
// Bit 12: Sample Position bit 6 (Sample nibble select bit for 4 bit data)
// Bit 13: Volume LUT bank select? (4 bit/8 bit data mode or wavetable/PCM?)
const u16 volume_index = (((ch_volume | voice.volume_bank) & 0x2f) << 8) | (BIT(voice.position, 6) << 12);
if (voice.repeat)
{
raw_sample = m_sample_rom[((voice.start_address >> 7) & 0x7e00) | ((voice.position >> 7) & 0x1ff)];
Expand All @@ -160,9 +166,7 @@ void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<
break;
}
}
ch_volume |= voice.volume_bank;

*mix++ += m_volume_rom[(ch_volume << 8 | raw_sample) & 0x3fff] - 0x80;
*mix++ += m_volume_rom[(volume_index | raw_sample) & 0x3fff] - 0x80;
voice.position += ch_frequency;
}
}
Expand Down