Mercurial > hg > dmlib
comparison tools/xm2jss.c @ 1342:f2fd1ad84829
Constify and move effect conversion back to where it was.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 22 Aug 2017 20:55:53 +0300 |
parents | 04b1bf207636 |
children | cffb1597ab06 |
comparison
equal
deleted
inserted
replaced
1341:ae2ba8cb510f | 1342:f2fd1ad84829 |
---|---|
730 return DMERR_OK; | 730 return DMERR_OK; |
731 } | 731 } |
732 | 732 |
733 | 733 |
734 /* Scan given pattern for used instruments and channels. | 734 /* Scan given pattern for used instruments and channels. |
735 * Also checks if the pattern is empty and convert certain effects. | 735 * Also checks if the pattern is empty. |
736 */ | 736 */ |
737 void scanPattern(JSSModule *module, JSSPattern *pattern, int npattern, BOOL *usedExtInstruments, BOOL *usedChannels, BOOL *empty) | 737 void scanPattern(const JSSModule *module, const JSSPattern *pattern, |
738 const int npattern, BOOL *usedExtInstruments, BOOL *usedChannels, BOOL *empty) | |
738 { | 739 { |
739 JSSNote *n = pattern->data; | 740 JSSNote *n = pattern->data; |
740 *empty = FALSE; | 741 *empty = FALSE; |
741 | 742 |
742 // Check all notes in this pattern | 743 // Check all notes in this pattern |
743 for (int row = 0; row < pattern->nrows; row++) | 744 for (int row = 0; row < pattern->nrows; row++) |
744 for (int channel = 0; channel < pattern->nchannels; channel++, n++) | 745 for (int channel = 0; channel < pattern->nchannels; channel++, n++) |
745 { | 746 { |
746 char effect; | |
747 | |
748 // Is the instrument set? | 747 // Is the instrument set? |
749 if (n->instrument != jsetNotSet) | 748 if (n->instrument != jsetNotSet) |
750 { | 749 { |
751 // Is it valid? | 750 // Is it valid? |
752 if (n->instrument >= 0 && n->instrument < module->nextInstruments) | 751 if (n->instrument >= 0 && n->instrument < module->nextInstruments) |
765 n->effect != jsetNotSet || | 764 n->effect != jsetNotSet || |
766 n->param != jsetNotSet) | 765 n->param != jsetNotSet) |
767 { | 766 { |
768 usedChannels[channel] = TRUE; | 767 usedChannels[channel] = TRUE; |
769 *empty = FALSE; | 768 *empty = FALSE; |
770 } | |
771 | |
772 // Convert certain effects | |
773 JMPGETEFFECT(effect, n->effect); | |
774 switch (effect) | |
775 { | |
776 case 'C': // Cxx = Set volume | |
777 if (n->volume == jsetNotSet) | |
778 { | |
779 n->volume = n->param; | |
780 n->effect = jsetNotSet; | |
781 n->param = jsetNotSet; | |
782 } | |
783 break; | |
784 } | 769 } |
785 } | 770 } |
786 } | 771 } |
787 | 772 |
788 | 773 |
1118 { | 1103 { |
1119 dmErrorMsg("Non-existing instrument used #%d, INTERNAL ERROR.\n", | 1104 dmErrorMsg("Non-existing instrument used #%d, INTERNAL ERROR.\n", |
1120 n->instrument + 1); | 1105 n->instrument + 1); |
1121 } | 1106 } |
1122 } | 1107 } |
1108 | |
1109 // Convert certain effects | |
1110 char effect; | |
1111 JMPGETEFFECT(effect, n->effect); | |
1112 switch (effect) | |
1113 { | |
1114 case 'C': // Cxx = Set volume | |
1115 if (n->volume == jsetNotSet) | |
1116 { | |
1117 n->volume = n->param; | |
1118 n->effect = jsetNotSet; | |
1119 n->param = jsetNotSet; | |
1120 } | |
1121 break; | |
1122 } | |
1123 } | 1123 } |
1124 } | 1124 } |
1125 | 1125 |
1126 // | 1126 // |
1127 // Remap orders list | 1127 // Remap orders list |