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

Switch to libxmp for most tracker formats #62

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

Cacodemon345
Copy link
Contributor

@Cacodemon345 Cacodemon345 commented Oct 4, 2024

This PR switches to libxmp (the 4.6.0 release) for most tracker formats (DUMB was officially declared dead in April of this year).

DSM still needs foo_DUMB for playback since libxmp does not support it so it has been left there.

What is supported:

  1. All foo_DUMB formats except DSM.
  2. Galaxy Sound System formats.
  3. UMX container format (tracker-only, no support for WAV/MP2 types).
  4. Pretty much all formats listed as supported in https://xmp.sourceforge.net/.
  5. Master volume (hard clamped to 0-200).
  6. Interpolation modes.
  7. Sample rate adjustment.

What isn't supported:

  1. Volume ramp style (appears to be handled dynamically).
  2. Chip-O-Matic (interpolation can't be turned off for individual samples).
  3. Interpolations modes other than Aliasing/Nearest, Linear, Cubic.

Copy link
Member

@coelckers coelckers left a comment

Choose a reason for hiding this comment

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

Please fix these warnings:

6>LINK : warning LNK4217: symbol 'xmp_create_context' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"class StreamSource * __cdecl XMP_OpenSong(struct MusicIO::FileInterface *,int)" (?XMP_OpenSong@@YAPEAVStreamSource@@PEAUFileInterface@MusicIO@@h@Z)'
6>LINK : warning LNK4217: symbol 'xmp_load_module_from_callbacks' defined in 'load.obj' is imported by 'music_libxmp.obj' in function '"class StreamSource * __cdecl XMP_OpenSong(struct MusicIO::FileInterface *,int)" (?XMP_OpenSong@@YAPEAVStreamSource@@PEAUFileInterface@MusicIO@@h@Z)'
6>LINK : warning LNK4217: symbol 'xmp_test_module_from_callbacks' defined in 'load.obj' is imported by 'music_libxmp.obj' in function '"class StreamSource * __cdecl XMP_OpenSong(struct MusicIO::FileInterface *,int)" (?XMP_OpenSong@@YAPEAVStreamSource@@PEAUFileInterface@MusicIO@@h@Z)'
6>LINK : warning LNK4217: symbol 'xmp_start_player' defined in 'player.obj' is imported by 'music_libxmp.obj' in function '"public: virtual bool __cdecl XMPSong::Start(void)" (?Start@XMPSong@@UEAA_NXZ)'
6>LINK : warning LNK4217: symbol 'xmp_play_buffer' defined in 'player.obj' is imported by 'music_libxmp.obj' in function '"protected: virtual bool __cdecl XMPSong::GetData(void *,unsigned __int64)" (?GetData@XMPSong@@MEAA_NPEAX_K@Z)'
6>LINK : warning LNK4217: symbol 'xmp_set_position' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"protected: virtual bool __cdecl XMPSong::GetData(void *,unsigned __int64)" (?GetData@XMPSong@@MEAA_NPEAX_K@Z)'
6>LINK : warning LNK4217: symbol 'xmp_restart_module' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"protected: virtual bool __cdecl XMPSong::GetData(void *,unsigned __int64)" (?GetData@XMPSong@@MEAA_NPEAX_K@Z)'
6>LINK : warning LNK4217: symbol 'xmp_set_player' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"public: __cdecl XMPSong::XMPSong(char *,int)" (??0XMPSong@@qeaa@PEADH@Z)'
6>LINK : warning LNK4217: symbol 'xmp_get_player' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"public: virtual bool __cdecl XMPSong::SetSubsong(int)" (?SetSubsong@XMPSong@@UEAA_NH@Z)'
5>LINK : warning LNK4217: symbol 'xmp_create_context' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"class StreamSource * __cdecl XMP_OpenSong(struct MusicIO::FileInterface *,int)" (?XMP_OpenSong@@YAPEAVStreamSource@@PEAUFileInterface@MusicIO@@h@Z)'
5>LINK : warning LNK4217: symbol 'xmp_load_module_from_callbacks' defined in 'load.obj' is imported by 'music_libxmp.obj' in function '"class StreamSource * __cdecl XMP_OpenSong(struct MusicIO::FileInterface *,int)" (?XMP_OpenSong@@YAPEAVStreamSource@@PEAUFileInterface@MusicIO@@h@Z)'
5>LINK : warning LNK4217: symbol 'xmp_test_module_from_callbacks' defined in 'load.obj' is imported by 'music_libxmp.obj' in function '"class StreamSource * __cdecl XMP_OpenSong(struct MusicIO::FileInterface *,int)" (?XMP_OpenSong@@YAPEAVStreamSource@@PEAUFileInterface@MusicIO@@h@Z)'
5>LINK : warning LNK4217: symbol 'xmp_start_player' defined in 'player.obj' is imported by 'music_libxmp.obj' in function '"public: virtual bool __cdecl XMPSong::Start(void)" (?Start@XMPSong@@UEAA_NXZ)'
5>LINK : warning LNK4217: symbol 'xmp_play_buffer' defined in 'player.obj' is imported by 'music_libxmp.obj' in function '"protected: virtual bool __cdecl XMPSong::GetData(void *,unsigned __int64)" (?GetData@XMPSong@@MEAA_NPEAX_K@Z)'
5>LINK : warning LNK4217: symbol 'xmp_set_position' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"protected: virtual bool __cdecl XMPSong::GetData(void *,unsigned __int64)" (?GetData@XMPSong@@MEAA_NPEAX_K@Z)'
5>LINK : warning LNK4217: symbol 'xmp_restart_module' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"protected: virtual bool __cdecl XMPSong::GetData(void *,unsigned __int64)" (?GetData@XMPSong@@MEAA_NPEAX_K@Z)'
5>LINK : warning LNK4217: symbol 'xmp_set_player' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"public: __cdecl XMPSong::XMPSong(char *,int)" (??0XMPSong@@qeaa@PEADH@Z)'
5>LINK : warning LNK4217: symbol 'xmp_get_player' defined in 'control.obj' is imported by 'music_libxmp.obj' in function '"public: virtual bool __cdecl XMPSong::SetSubsong(int)" (?SetSubsong@XMPSong@@UEAA_NH@Z)'

@Cacodemon345
Copy link
Contributor Author

Done.

Copy link
Member

@coelckers coelckers left a comment

Choose a reason for hiding this comment

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

Please do not apply the master volume through the library's API - the output is only 16 bit integer which has finite range. Instead do it like the DUMB player does by converting the sound to float and then apply it during the conversion. With 16 bit this can easily cause clipping and distortion.

@Cacodemon345
Copy link
Contributor Author

libxmp's output shouldn't require float conversion on any merits; it already internally clamps the output to avoid clipping problems and was tested specifically for that.

It also employs additional safeguards to not cause clipping problems IIRC. So it doesn't make sense to convert the output to float and apply the master volume like that when the library can already do it without any problems.

@Cacodemon345
Copy link
Contributor Author

Switched to float output anyways.

@coelckers coelckers merged commit 05601a9 into ZDoom:master Oct 5, 2024
8 checks passed
@coelckers
Copy link
Member

That's better.

I think we should add an option to select the default module player as a user setting and as a song setting, similar to $mididevice.
XMP tends to sound a little different than Dumb and some people may prefer Dumb. I'll look into that.

@Cacodemon345
Copy link
Contributor Author

I don't really believe DUMB should be made available anymore; the author tells people to use libopenmpt because of it having similar or better playback quality than it, and it's not exactly maintained.

It can be maybe left as an option anyways, but libxmp should remain the default for now.

@coelckers
Copy link
Member

Our Dumb version hasn't been updated for 10 years or so, so it doesn't really matter what the author says - but the fact remains that it can sound different and some people may be bothered by it. The option doesn't cost much except for a new entry in the menu, so why not?

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.

2 participants