View Issue Details

IDProjectCategoryView StatusLast Update
0001932OpenMPTopenmpt123public2025-12-06 13:04
Reporterlaamaa Assigned Tomanx  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAppleOSMacOSOS VersionTahoe 26.1
Product VersionOpenMPT 1.32.05.00 / libopenmpt 0.8.3 (current stable) 
Fixed in VersionOpenMPT 1.32.06.00 / libopenmpt 0.8.4 (upcoming stable) 
Summary0001932: Rendering 32bit floating point WAV files with libopenmpt + sndfile not working
Description

Hi! =)

When trying to render modules with openmpt123 using floating point on MacOS, the resulting files are always 16 bit.

I think the check for float in sndfile logic isn't working correctly at the moment, I attached a patch for reference of how I fixed it for myself.

  • Jonne / laamaa
Steps To Reproduce

Render a module, for example:
./openmpt123 --render --float --force -- ~/Downloads/laamaa_-_oplomega.s3m

Resulting file should be 32bit, but is 16bit.

TagsNo tags attached.
Attached Files
openmpt123_sndfile.hpp.patch (2,794 bytes)   
diff --git a/openmpt123/openmpt123_sndfile.hpp b/openmpt123/openmpt123_sndfile.hpp
index f2947cde3..8880fb1e0 100644
--- a/openmpt123/openmpt123_sndfile.hpp
+++ b/openmpt123/openmpt123_sndfile.hpp
@@ -123,9 +123,7 @@ private:
 							} else if ( !flags.use_float && ( subformat_info.format == SF_FORMAT_PCM_16 ) ) {
 								return matched_result( format, format_info, subformat_info, match_mode );
 							}
-						}
-						break;
-						if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) {
+						} else if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) {
 							if ( flags.use_float && ( subformat_info.format == SF_FORMAT_FLOAT ) ) {
 								return matched_result( format, format_info, subformat_info, match_mode );
 							} else if ( !flags.use_float && ( subformat_info.format == SF_FORMAT_PCM_16 ) ) {
@@ -137,15 +135,13 @@ private:
 						if ( subformat_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == subformat_info.extension ) ) {
 							if ( flags.use_float && ( subformat_info.format == SF_FORMAT_FLOAT || subformat_info.format == SF_FORMAT_DOUBLE ) ) {
 								return matched_result( format, format_info, subformat_info, match_mode );
-							} else if ( !flags.use_float && ( subformat_info.format & ( subformat_info.format == SF_FORMAT_PCM_16 || subformat_info.format == SF_FORMAT_PCM_24 || subformat_info.format == SF_FORMAT_PCM_32 ) ) ) {
+							} else if ( !flags.use_float && ( subformat_info.format == SF_FORMAT_PCM_16 || subformat_info.format == SF_FORMAT_PCM_24 || subformat_info.format == SF_FORMAT_PCM_32 ) ) {
 								return matched_result( format, format_info, subformat_info, match_mode );
 							}
-						}
-						break;
-						if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) {
+						} else if ( format_info.extension && ( mpt::transcode<std::string>( sndfile_encoding, extension ) == format_info.extension ) ) {
 							if ( flags.use_float && ( subformat_info.format == SF_FORMAT_FLOAT || subformat_info.format == SF_FORMAT_DOUBLE ) ) {
 								return matched_result( format, format_info, subformat_info, match_mode );
-							} else if ( !flags.use_float && ( subformat_info.format & ( subformat_info.format == SF_FORMAT_PCM_16 || subformat_info.format == SF_FORMAT_PCM_24 || subformat_info.format == SF_FORMAT_PCM_32 ) ) ) {
+							} else if ( !flags.use_float && ( subformat_info.format == SF_FORMAT_PCM_16 || subformat_info.format == SF_FORMAT_PCM_24 || subformat_info.format == SF_FORMAT_PCM_32 ) ) {
 								return matched_result( format, format_info, subformat_info, match_mode );
 							}
 						}
openmpt123_sndfile.hpp.patch (2,794 bytes)   
Has the bug occurred in previous versions?
Tested code revision (in case you know it)

Activities

manx

manx

2025-12-06 13:04

administrator   ~0006522

Thanks for reporting.

I slightly modified your patch. I do not think we want the second block in an else if branch, because if both format and subformat claim the same extension, but only the format allows the exact sample format match (for whatever reason, I have not checked if this happens in practice).

Fixed in:

I also removed the bogus subformat_info.format & in 0.6, 0.5, and 0.4.

Issue History

Date Modified Username Field Change
2025-12-06 12:21 laamaa New Issue
2025-12-06 12:21 laamaa File Added: openmpt123_sndfile.hpp.patch
2025-12-06 12:31 manx Assigned To => manx
2025-12-06 12:31 manx Status new => assigned
2025-12-06 13:04 manx Status assigned => resolved
2025-12-06 13:04 manx Resolution open => fixed
2025-12-06 13:04 manx Fixed in Version => OpenMPT 1.32.06.00 / libopenmpt 0.8.4 (upcoming stable)
2025-12-06 13:04 manx Note Added: 0006522