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

sound/swp00.cpp: Improved DPCM sample decompression #12300

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

TaleTN
Copy link
Contributor

@TaleTN TaleTN commented Apr 23, 2024

Through reverse engineering the ROMs of the MU50 and related sound modules I think I've figured out that the magic number that the MU50 stores along with the sample format isn't the fractional part of the loop point, but instead holds an offset and scale for DPCM decompression (which I guess makes it ADPCM).

I guess some of the related sound devices (like maybe the SWP30?) cloud also use this patch.

@@ -43,6 +43,7 @@ class swp00_device : public device_t, public device_sound_interface, public devi
static const std::array<s32, 0x20> decay_linear_step;
static const std::array<s32, 16> panmap;
std::array<s32, 0x80> m_global_step;
static const std::array<u8, 4> m_dpcm_offset;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn’t use m_ prefixes for static data members, only instance members. It’s also clearer to group static data members and instance data members rather than intermixing them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cuavas Ah right... Will fix (but maybe I'll wait a bit, in case there are other issues). Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galibert is probably the best person to review the functional changes here.

@cuavas cuavas changed the title Improve SWP00 (MU50) DPCM decompression sound/swp00.cpp: Improved DPCM sample decompression Apr 23, 2024
@galibert
Copy link
Member

Yeah, looks nice. And I need to add that to the swp30 and the swx00...

@TaleTN
Copy link
Contributor Author

TaleTN commented Apr 24, 2024

@galibert I could also (try to) apply the fix to the swp30 and swx00, if that helps.

BTW, do you want me to squash the current two commits into one commit?

@galibert galibert merged commit 48161ce into mamedev:master Apr 24, 2024
5 checks passed
@galibert
Copy link
Member

It's ok, github allows to squash when merging. If you have to time to add that to the other two (swp20 does not have the audio implemented yet) I'd love that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants