shithub: dumb

Download patch

ref: c7aadf292975e96c3036fc4f2e4248a5c727fa5d
parent: ff84ff32fe1fc82926020feedf894c4fb5c37ccd
author: Chris Moeller <kode54@gmail.com>
date: Sun Feb 10 06:45:04 EST 2013

Fixed loop start for STK modules

--- a/dumb/src/it/readmod.c
+++ b/dumb/src/it/readmod.c
@@ -118,7 +118,7 @@
 
 
 
-static int it_mod_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
+static int it_mod_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f, int stk)
 {
 	int finetune, loop_start, loop_length;
 
@@ -141,7 +141,8 @@
 /** Each  finetune step changes  the note 1/8th  of  a  semitone. */
 	sample->global_volume = 64;
 	sample->default_volume = dumbfile_getc(f); // Should we be setting global_volume to this instead?
-	loop_start = dumbfile_mgetw(f) << 1;
+	loop_start = dumbfile_mgetw(f);
+	if ( !stk ) loop_start <<= 1;
 	loop_length = dumbfile_mgetw(f) << 1;
 	if ( loop_length > 2 && loop_start + loop_length > sample->length && loop_start / 2 + loop_length <= sample->length )
 		loop_start /= 2;
@@ -411,7 +412,7 @@
 		sigdata->sample[i].data = NULL;
 
 	for (i = 0; i < sigdata->n_samples; i++) {
-		if (it_mod_read_sample_header(&sigdata->sample[i], f)) {
+		if (it_mod_read_sample_header(&sigdata->sample[i], f, sigdata->n_samples == 15)) {
 			_dumb_it_unload_sigdata(sigdata);
             return NULL;
 		}