ref: 3a25c206f5610e2626926be036b1ffaa8afab5ef
parent: 16c119ad546665eef86579cefd2a6501c0e3059f
author: Chris Moeller <kode54@gmail.com>
date: Mon Dec 2 18:17:42 EST 2013
Fixed panning and sample loops
--- a/dumb/src/it/readamf.c
+++ b/dumb/src/it/readamf.c
@@ -72,9 +72,15 @@
else effectvalue = ( effectvalue & 0x0F ) << 4;
break;
- case 0x04: if ( effectvalue & 0x80 ) { effect = IT_PORTAMENTO_UP; effectvalue = ( -( signed char ) effectvalue ) & 0x7F; }
- else { effect = IT_PORTAMENTO_DOWN; }
- break;
+ case 0x04:
+ if ( effectvalue & 0x80 ) {
+ effect = IT_PORTAMENTO_UP;
+ effectvalue = ( -( signed char ) effectvalue ) & 0x7F;
+ }
+ else {
+ effect = IT_PORTAMENTO_DOWN;
+ }
+ break;
case 0x06: effect = IT_TONE_PORTAMENTO; break;
@@ -92,30 +98,57 @@
case 0x10: effect = IT_SET_SAMPLE_OFFSET; break;
- case 0x11: if ( effectvalue ) { effect = IT_VOLUME_SLIDE;
- if ( effectvalue & 0x80 ) effectvalue = 0xF0 | ( ( -( signed char ) effectvalue ) & 0x0F );
- else effectvalue = 0x0F | ( ( effectvalue & 0x0F ) << 4 );
- } else effect = 0;
- break;
+ case 0x11:
+ if ( effectvalue ) {
+ effect = IT_VOLUME_SLIDE;
+ if ( effectvalue & 0x80 )
+ effectvalue = 0xF0 | ( ( -( signed char ) effectvalue ) & 0x0F );
+ else
+ effectvalue = 0x0F | ( ( effectvalue & 0x0F ) << 4 );
+ }
+ else
+ effect = 0;
+ break;
case 0x12:
- case 0x16: if ( effectvalue ) { int mask = ( effect == 0x16 ) ? 0xE0 : 0xF0;
- effect = ( effectvalue & 0x80 ) ? IT_PORTAMENTO_UP : IT_PORTAMENTO_DOWN;
- if ( effectvalue & 0x80 ) effectvalue = mask | ( ( -( signed char ) effectvalue ) & 0x0F );
- else effectvalue = mask | ( effectvalue & 0x0F );
- } else effect = 0;
- break;
+ case 0x16:
+ if ( effectvalue ) {
+ int mask = ( effect == 0x16 ) ? 0xE0 : 0xF0;
+ effect = ( effectvalue & 0x80 ) ? IT_PORTAMENTO_UP : IT_PORTAMENTO_DOWN;
+ if ( effectvalue & 0x80 )
+ effectvalue = mask | ( ( -( signed char ) effectvalue ) & 0x0F );
+ else
+ effectvalue = mask | ( effectvalue & 0x0F );
+ }
+ else
+ effect = 0;
+ break;
- case 0x13: effect = IT_S; effectvalue = EFFECT_VALUE( IT_S_NOTE_DELAY, effectvalue & 0x0F ); break;
+ case 0x13:
+ effect = IT_S;
+ effectvalue = EFFECT_VALUE( IT_S_NOTE_DELAY, effectvalue & 0x0F );
+ break;
- case 0x14: effect = IT_S; effectvalue = EFFECT_VALUE( IT_S_DELAYED_NOTE_CUT, effectvalue & 0x0F ); break;
+ case 0x14:
+ effect = IT_S;
+ effectvalue = EFFECT_VALUE( IT_S_DELAYED_NOTE_CUT, effectvalue & 0x0F );
+ break;
case 0x15: effect = IT_SET_SONG_TEMPO; break;
- case 0x17: effectvalue = ( effectvalue + 64 ) & 0x7F;
- if ( entry->mask & IT_ENTRY_EFFECT ) { if ( !( entry->mask & IT_ENTRY_VOLPAN ) ) { entry->volpan = ( effectvalue / 2 ) + 128; } effect = 0; }
- else { effect = IT_SET_PANNING; }
- break;
+ case 0x17:
+ effectvalue = ( effectvalue + 64 ) & 0x7F;
+ if ( entry->mask & IT_ENTRY_EFFECT ) {
+ if ( !( entry->mask & IT_ENTRY_VOLPAN ) ) {
+ entry->mask |= IT_ENTRY_VOLPAN;
+ entry->volpan = ( effectvalue / 2 ) + 128;
+ }
+ effect = 0;
+ }
+ else {
+ effect = IT_SET_PANNING;
+ }
+ break;
default: effect = effectvalue = 0;
}
@@ -202,7 +235,7 @@
sample->default_pan = 0;
sample->finetune = 0;
- if ( sample->loop_start != 0 )
+ if ( sample->loop_end > sample->loop_start + 2 && sample->loop_end <= sample->length )
sample->flags |= IT_SAMPLE_LOOP;
sample->vibrato_speed = 0;
@@ -457,7 +490,7 @@
}
/* Now let's initialise the remaining variables, and we're done! */
- sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO;
+ sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO | IT_WAS_AN_S3M;
sigdata->global_volume = 128;
sigdata->mixing_volume = 48;