comparison minijss/jloadxm.c @ 1177:dc26df8b642c

Some support for 0x0102 version of the XM format. Does not work fully yet, probably due to different pattern data storing method or something.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Mar 2015 09:58:07 +0200
parents afdbf62ce8ad
children e7a951937374
comparison
equal deleted inserted replaced
1176:afdbf62ce8ad 1177:dc26df8b642c
643 "Ext.instrument #%d sNumForNotes[%d] out of range (%d).\n", 643 "Ext.instrument #%d sNumForNotes[%d] out of range (%d).\n",
644 ninst, i, tmp); 644 ninst, i, tmp);
645 } 645 }
646 } 646 }
647 647
648 // Read sample data if needed
649 if (module->intVersion == 0x0104)
650 {
648 if ((ret = jssXMLoadInstrumentSamples(inFile, module, einst, ninst)) != DMERR_OK) 651 if ((ret = jssXMLoadInstrumentSamples(inFile, module, einst, ninst)) != DMERR_OK)
649 return ret; 652 return ret;
653 }
654
650 return DMERR_OK; 655 return DMERR_OK;
651 } 656 }
652 657
653 658
654 static int jssXMLoadPatterns(DMResource *inFile, JSSModule *module, XMHeader *xmH) 659 static int jssXMLoadPatterns(DMResource *inFile, JSSModule *module, XMHeader *xmH)
832 } 837 }
833 838
834 switch (xmH.version) 839 switch (xmH.version)
835 { 840 {
836 case 0x0104: 841 case 0x0104:
842 case 0x0102:
837 break; 843 break;
838 844
839 default: 845 default:
840 JSSWARNING(DMERR_NOT_SUPPORTED, DMERR_NOT_SUPPORTED, 846 JSSWARNING(DMERR_NOT_SUPPORTED, DMERR_NOT_SUPPORTED,
841 "Unsupported version of XM format 0x%04x.\n", 847 "Unsupported version of XM format 0x%04x.\n",
900 906
901 if ((ret = jssXMLoadInstruments(inFile, module)) != DMERR_OK) 907 if ((ret = jssXMLoadInstruments(inFile, module)) != DMERR_OK)
902 goto out; 908 goto out;
903 break; 909 break;
904 910
911 case 0x0102:
912 if ((ret = jssXMLoadInstruments(inFile, module)) != DMERR_OK)
913 goto out;
914
915 if ((ret = jssXMLoadPatterns(inFile, module, &xmH)) != DMERR_OK)
916 goto out;
917
918 // Read sample data if needed
919 for (index = 0; index < module->nextInstruments; index++)
920 {
921 JSSExtInstrument *einst = module->extInstruments[index];
922 if ((ret = jssXMLoadInstrumentSamples(inFile, module, einst, index)) != DMERR_OK)
923 goto out;
924 }
925 break;
905 } 926 }
906 927
907 out: 928 out:
908 929
909 return ret; 930 return ret;