Skip to content

Use XMP_MAX_SRATE for -f limit instead of 48000.#74

Merged
sezero merged 1 commit intolibxmp:masterfrom
AliceLR:xmp-max-srate
Jan 29, 2026
Merged

Use XMP_MAX_SRATE for -f limit instead of 48000.#74
sezero merged 1 commit intolibxmp:masterfrom
AliceLR:xmp-max-srate

Conversation

@AliceLR
Copy link
Contributor

@AliceLR AliceLR commented Jan 28, 2026

No description provided.

@AliceLR AliceLR added this to the 4.2.1 milestone Jan 28, 2026
@AliceLR AliceLR requested a review from sezero January 28, 2026 22:56
@sezero
Copy link
Collaborator

sezero commented Jan 28, 2026

Maybe the following addition?? (for builds made against libxmp >= 4.7,
but running against libxmp < 4.7.0 -- unlikely, but not impossible...)

EDIT: Removing the ifdefs which shouldn't be necessary.

diff --git a/src/options.c b/src/options.c
index 73c4967..b8939a7 100644
--- a/src/options.c
+++ b/src/options.c
@@ -385,4 +385,6 @@ void get_options(int argc, char **argv, struct options *options)
 	if (options->rate > XMP_MAX_SRATE)
 		options->rate = XMP_MAX_SRATE;	/* Max. rate 768 kHz */
+	if (xmp_vercode < 0x040700 && options->rate > 48000)
+		options->rate = 48000;	/* 48 kHz for libxmp < 4.7.0 */
 
 	/* apply guess if no driver selected */

@AliceLR
Copy link
Contributor Author

AliceLR commented Jan 29, 2026

Maybe the following addition??

I'm not opposed to this, but libxmp/libxmp#964 may require bumping the minimum libxmp version up to 4.7.0 anyway (xmp 4.3.0?).

If we go ahead and keep support for 4.4.x, that would be easy to work around by putting something like this in xmp-cli common.h + disabling 24-bit and 32-bit output for libraries older than 4.7.0:

#ifndef XMP_FORMAT_32BIT
#define XMP_FORMAT_32BIT (1 << 3)
#endif

@sezero
Copy link
Collaborator

sezero commented Jan 29, 2026

If we go ahead and keep support for 4.4.x, that would be easy to work around by putting something like this in xmp-cli common.h + disabling 24-bit and 32-bit output for libraries older than 4.7.0:

#ifndef XMP_FORMAT_32BIT
#define XMP_FORMAT_32BIT (1 << 3)
#endif

That would be ideal IMO: Let's do that in another PR where 32 bit support is added to xmp-cli.

Preserve the old limit of 48000 if xmp_vercode indicates an older
library version.
@AliceLR
Copy link
Contributor Author

AliceLR commented Jan 29, 2026

Maybe the following addition??

Done, more or less the same way you did (I separated the two conditions to maybe make it easier to merge with #75...).

@sezero sezero merged commit f960c28 into libxmp:master Jan 29, 2026
1 check passed
@sezero
Copy link
Collaborator

sezero commented Jan 29, 2026

P.S.: Should we make 8bit and 32bit mutually exclusive, or keep ignoring 8bit if 32bit is set like we do at present?

@AliceLR AliceLR deleted the xmp-max-srate branch January 29, 2026 11:03
@AliceLR
Copy link
Contributor Author

AliceLR commented Jan 29, 2026

P.S.: Should we make 8bit and 32bit mutually exclusive, or keep ignoring 8bit if 32bit is set like we do at present?

I'm not sure what would be better. They should probably be an enum like the XMP_PLAYER_INTERP values, but we're stuck with flags until libxmp 5...

(I don't think this really matters for xmp-cli since #75 makes -b clear whatever the last usage of -b set.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants