mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-13 06:01:01 +00:00
Compare commits
2 Commits
2023.01.08
...
2022.01.22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9e10a7229 | ||
|
|
ea71f7963b |
36
doc/CHANGES
36
doc/CHANGES
@@ -15031,5 +15031,41 @@ called from abc2abc and return 0. The function parseother(),
|
||||
which is called from parsevoice() or parsekey(), will output
|
||||
all other directives in the K: or V: command.
|
||||
|
||||
January 10 2023
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
abcMIDI : abc <-> MIDI conversion utilities
|
||||
|
||||
midi2abc version 3.58 December 09 2022
|
||||
abc2midi version 4.82 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
|
||||
|
||||
62
genmidi.c
62
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];
|
||||
|
||||
|
||||
19
store.c
19
store.c
@@ -186,7 +186,7 @@ int main()
|
||||
|
||||
*/
|
||||
|
||||
#define VERSION "4.82 January 06 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);
|
||||
@@ -4694,6 +4691,13 @@ if (nofnop == 0) {
|
||||
done = 1;
|
||||
};
|
||||
|
||||
/* [SS] 2023-01-10 */
|
||||
if (strcmp(p, "ped(") == 0) {
|
||||
addfeature(PEDAL_ON, 0, 0, 0);
|
||||
done = 1;
|
||||
};
|
||||
|
||||
|
||||
/* [SS] 2011-10-19 [SS] 2018-05-02*/
|
||||
if (strcmp(p, "ped-end") == 0) {
|
||||
addfeature(PEDAL_OFF, 0, 0, 0);
|
||||
@@ -4710,6 +4714,12 @@ if (nofnop == 0) {
|
||||
done = 1;
|
||||
};
|
||||
|
||||
/* [SS] 2023-01-10 */
|
||||
if (strcmp(p, "ped)") == 0) {
|
||||
addfeature(PEDAL_OFF, 0, 0, 0);
|
||||
done = 1;
|
||||
};
|
||||
|
||||
if (strcmp(s, "breath") == 0) {
|
||||
decorators_passback[BREATH] =1;
|
||||
done = 1;
|
||||
@@ -6363,7 +6373,6 @@ char *argv[];
|
||||
oldchordconvention = 0; /* for handling +..+ chords */
|
||||
|
||||
for (i=0;i<DECSIZE;i++) decorators_passback[i]=0;
|
||||
for (i=0;i<64;i++) dependent_voice[i]=0;
|
||||
set_control_defaults();
|
||||
|
||||
event_init(argc, argv, &filename);
|
||||
|
||||
Reference in New Issue
Block a user