diff --git a/VERSION b/VERSION index 3b898b6..ca1569e 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -January 10 2023 +January 20 2023 diff --git a/doc/CHANGES b/doc/CHANGES index 835cb00..7b5675a 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -15037,3 +15037,35 @@ abcmidi: in event_handle_instruction(s), added code to recognize !ped(! and !ped)! in addition to !ped! and !ped-up! +January 20 2023 + +abc2midi: as remarked around June 04-06 2005, split bars and +parts were never fully working. For example, + +%%quiet +X:1 +T: split-part +M:5/4 +L:1/8 +Q:1/4=132 +P:A6 +K:none +%%MIDI channel 10 +P:A +CDCDC CDCDC & [I:MIDI channel 10] z2E3 E5 | + +does not convert correctly to a midi file. + +Fix: the code in partbreak() seems to have been at fault. +The program returns the wrong position of the voice in the +feature array, causing the wrong notes to be sent to the +active midi track. Permanently eliminating the function +fillvoice and always calling findvoice, fixed one of the +problems. The second fix was to replace findpart() with +findvoice() when the PART feature is encountered. Findvoice() +automatically calls findpart(). The external integer array, +dependent_voice(), is no longer used and is also eliminated. +(See this file December 12 2006.) These changes also appear +to fix the bug addressed at the same date. + + diff --git a/doc/readme.txt b/doc/readme.txt index 6f20456..aa87c9d 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -1,7 +1,7 @@ abcMIDI : abc <-> MIDI conversion utilities midi2abc version 3.58 December 09 2022 -abc2midi version 4.83 January 06 2023 +abc2midi version 4.84 January 06 2023 abc2abc version 2.19 January 08 2023 yaps version 1.92 January 06 2023 abcmatch version 1.82 June 14 2022 diff --git a/genmidi.c b/genmidi.c index b78d99e..a9d9fef 100644 --- a/genmidi.c +++ b/genmidi.c @@ -112,7 +112,6 @@ int partrepno; int err_num, err_denom; extern int voicesused; -extern int dependent_voice[]; /* Tempo handling (Q: field) */ extern long tempo; @@ -623,56 +622,6 @@ static int findchannel() } - - - -static void fillvoice(partno, xtrack, voice) -/* check length of this voice at the end of a part */ -/* if it is zero, extend it to the correct length */ -int partno, xtrack, voice; -{ - char msg[100]; - long now; - - if (partlabel <-1 || partlabel >25) printf("genmidi.c:fillvoice partlabel %d out of range\n",partlabel); - - now = tracklen + delta_time; - if (partlabel == -1) { - if (xtrack == 1) { - introlen = now; - } else { - if (now == 0) { - delta_time = delta_time + introlen; - now = introlen; - } else { - if (now != introlen) { - sprintf(msg, "Time 0-%ld voice %d, has length %ld", - introlen, voice, now); - event_error(msg); - }; - }; - }; - } else { - if (xtrack == 1) { - partlen[partlabel] = now - lastlen; - } else { - if (now - lastlen == 0) { - delta_time = delta_time + partlen[partlabel]; - now = now + partlen[partlabel]; - } else { - if (now - lastlen != partlen[partlabel]) { - sprintf(msg, "Time %ld-%ld voice %d, part %c has length %ld", - lastlen, lastlen+partlen[partlabel], voice, - (char) (partlabel + (int) 'A'), - now-lastlen); - event_error(msg); - }; - }; - }; - }; - lastlen = now; -} - static int findpart(j) int j; /* find out where next part starts and update partno */ @@ -715,13 +664,10 @@ int xtrack, voice, place; int newplace; newplace = place; - if (dependent_voice[voice]) return newplace; - if (xtrack > 0) { - fillvoice(partno, xtrack, voice); - }; + if (parts != -1) { /* go to next part label */ - newplace = findpart(newplace); + newplace = findpart(newplace); /* [SS] 2023.01.20 */ }; partlabel = (int) pitch[newplace] - (int)'A'; return(newplace); @@ -3239,7 +3185,9 @@ int xtrack; break; case PART: in_varend = 0; - j = partbreak(xtrack, trackvoice, j); + /*j = partbreak(xtrack, trackvoice, j); [SS] 2023.01.20 */ + j = findvoice(j, trackvoice, xtrack); + if (parts == -1) { char msg[1]; diff --git a/store.c b/store.c index b1913a0..ce4fe32 100644 --- a/store.c +++ b/store.c @@ -186,7 +186,7 @@ int main() */ -#define VERSION "4.83 January 10 2023 abc2midi" +#define VERSION "4.84 January 20 2023 abc2midi" /* enables reading V: indication in header */ #define XTEN1 1 @@ -377,7 +377,6 @@ struct trackstruct trackdescriptor[40]; /* trackstruct defined in genmidi.h*/ int detune_list[12]; /* [SS] 2020-06-30 */ -int dependent_voice[64]; /* flag to indicate type of voice */ int voicecount; int numsplits=0; int splitdepth = 0; @@ -1449,7 +1448,6 @@ if (v->fromsplitno == -1) { v->octaveshift = octaveshift; v->default_length = default_length; /* [SS] 2010-08-28 */ } -dependent_voice[v->indexno] = 1; /* when syncing the split voice we want to be sure that we do not include the notes in the last bar in the source voice the notes in the split voice take their place. @@ -2977,7 +2975,6 @@ struct voice_params *vp; v = getvoicecontext(n); addfeature(VOICE, v->indexno, 0, 0); - dependent_voice[v->indexno] = 0; if (vp->gotclef) { event_octave(vp->new_clef.octave_offset, 1); @@ -6376,7 +6373,6 @@ char *argv[]; oldchordconvention = 0; /* for handling +..+ chords */ for (i=0;i