shithub: ft²

Download patch

ref: 976362f41e576978e9f17d38759acb2f11b96360
parent: dc26455fbb6c025c141975da54d4cc66cc2b6541
author: Olav Sørensen <olav.sorensen@live.no>
date: Wed Sep 17 16:17:34 EDT 2025

Don't read sample volume when loading IFF samples

--- a/src/ft2_header.h
+++ b/src/ft2_header.h
@@ -12,7 +12,7 @@
 #endif
 #include "ft2_replayer.h"
 
-#define PROG_VER_STR "1.98"
+#define PROG_VER_STR "1.99"
 
 // do NOT change these! It will only mess things up...
 
--- a/src/smploaders/ft2_load_iff.c
+++ b/src/smploaders/ft2_load_iff.c
@@ -1,5 +1,8 @@
-/* IFF (Amiga/FT2) sample loader
+/* IFF (Amiga/FT2) sample loader.
 **
+** Intentionally avoids reading the sample volume from the IFF header,
+** as the IFF vol range can differ depending on the software used.
+**
 ** Note: Vol/loop sanitation is done in the last stage
 ** of sample loading, so you don't need to do that here.
 ** Do NOT close the file handle!
@@ -17,7 +20,7 @@
 bool loadIFF(FILE *f, uint32_t filesize)
 {
 	char hdr[4+1];
-	uint32_t length, volume, loopStart, loopLength, sampleRate;
+	uint32_t length, loopStart, loopLength, sampleRate;
 	sample_t *s = &tmpSmp;
 
 	if (filesize < 12)
@@ -100,12 +103,6 @@
 		return false;
 	}
 
-	fread(&volume, 4, 1, f); volume = SWAP32(volume);
-	if (volume > 65535)
-		volume = 65535;
-
-	volume = (volume + 512) / 1024; // rounded
-
 	length = bodyLen;
 	if (sample16Bit)
 	{
@@ -140,7 +137,7 @@
 	if (sample16Bit)
 		s->flags |= SAMPLE_16BIT;
 
-	s->volume = (uint8_t)volume;
+	s->volume = 64;
 	s->panning = 128;
 
 	setSampleC4Hz(s, sampleRate);
--