Skip to content

Commit 0575659

Browse files
committed
Don't read sample volume when loading IFF samples
1 parent 6a2cf0e commit 0575659

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/pt2_header.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "pt2_unicode.h"
1515
#include "pt2_palette.h"
1616

17-
#define PROG_VER_STR "1.77"
17+
#define PROG_VER_STR "1.78"
1818

1919
#ifdef _WIN32
2020
#define DIR_DELIMITER '\\'

src/smploaders/pt2_load_iff.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* Tnis IFF loader intentionally avoids reading the sample volume from the
2+
** IFF header as the IFF vol range can differ depending on the software used.
3+
*/
4+
15
#include <stdio.h>
26
#include <stdlib.h>
37
#include <stdint.h>
@@ -31,7 +35,6 @@ bool loadIFFSample(FILE *f, uint32_t filesize, moduleSample_t *s)
3135
bool is16Bit = !strncmp(tmpCharBuf, "16SV", 4);
3236

3337
int32_t sampleLength = 0;
34-
uint32_t sampleVolume = 65536; // max volume
3538

3639
fseek(f, 12, SEEK_SET);
3740
while (!feof(f) && (uint32_t)ftell(f) < filesize-12)
@@ -99,14 +102,6 @@ bool loadIFFSample(FILE *f, uint32_t filesize, moduleSample_t *s)
99102
return false;
100103
}
101104

102-
fread(&sampleVolume, 4, 1, f); sampleVolume = SWAP32(sampleVolume);
103-
if (sampleVolume > 65536)
104-
sampleVolume = 65536;
105-
106-
sampleVolume = (sampleVolume + 512) / 1024; // rounded
107-
if (sampleVolume > 64)
108-
sampleVolume = 64;
109-
110105
sampleLength = bodyLen;
111106

112107
if (sampleLength == 0)
@@ -226,7 +221,7 @@ bool loadIFFSample(FILE *f, uint32_t filesize, moduleSample_t *s)
226221
}
227222

228223
// set sample attributes
229-
s->volume = (int8_t)sampleVolume;
224+
s->volume = 64;
230225
s->fineTune = 0;
231226
s->length = sampleLength;
232227
s->loopStart = loopStart;

0 commit comments

Comments
 (0)