From 9e467e90bd31d3fa425ef154684955664b66bd3d Mon Sep 17 00:00:00 2001 From: Wolfgang Drescher Date: Mon, 12 Feb 2024 13:01:25 +0100 Subject: [PATCH 1/2] Keep *mclef and *oclef interpretations in myank --- include/tool-myank.h | 18 +++- min/humlib.cpp | 222 ++++++++++++++++++++++++++++++++++++++++++- min/humlib.h | 20 +++- src/tool-myank.cpp | 220 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 474 insertions(+), 6 deletions(-) diff --git a/include/tool-myank.h b/include/tool-myank.h index 07028d0b..ae671c8d 100644 --- a/include/tool-myank.h +++ b/include/tool-myank.h @@ -33,20 +33,26 @@ class MeasureInfo { public: MeasureInfo(void) { clear(); } void clear(void) { num = seg = start = stop = -1; - sclef.resize(0); skeysig.resize(0); skey.resize(0); + sclef.resize(0); smclef.resize(0); soclef.resize(0); + skeysig.resize(0); skey.resize(0); stimesig.resize(0); smet.resize(0); stempo.resize(0); - eclef.resize(0); ekeysig.resize(0); ekey.resize(0); + eclef.resize(0); emclef.resize(0); eoclef.resize(0); + ekeysig.resize(0); ekey.resize(0); etimesig.resize(0); emet.resize(0); etempo.resize(0); file = NULL; } void setTrackCount(int tcount) { sclef.resize(tcount+1); + smclef.resize(tcount+1); + soclef.resize(tcount+1); skeysig.resize(tcount+1); skey.resize(tcount+1); stimesig.resize(tcount+1); smet.resize(tcount+1); stempo.resize(tcount+1); eclef.resize(tcount+1); + emclef.resize(tcount+1); + eoclef.resize(tcount+1); ekeysig.resize(tcount+1); ekey.resize(tcount+1); etimesig.resize(tcount+1); @@ -55,12 +61,16 @@ class MeasureInfo { int i; for (i=0; i sclef; // starting clef of segment + vector smclef; // starting mclef of segment + vector soclef; // starting oclef of segment vector skeysig; // starting keysig of segment vector skey; // starting key of segment vector stimesig; // starting timesig of segment @@ -88,6 +100,8 @@ class MeasureInfo { // musical settings at start of measure vector eclef; // ending clef of segment + vector emclef; // ending mclef of segment + vector eoclef; // ending oclef of segment vector ekeysig; // ending keysig of segment vector ekey; // ending key of segment vector etimesig; // ending timesig of segment diff --git a/min/humlib.cpp b/min/humlib.cpp index 065237f8..bc6f3478 100644 --- a/min/humlib.cpp +++ b/min/humlib.cpp @@ -1,7 +1,7 @@ // // Programmer: Craig Stuart Sapp // Creation Date: Sat Aug 8 12:24:49 PDT 2015 -// Last Modified: Tue Feb 6 22:50:09 PST 2024 +// Last Modified: Mo 12 Feb 2024 13:00:50 CET // Filename: min/humlib.cpp // URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.cpp // Syntax: C++11 @@ -105137,6 +105137,8 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, // } int clefQ = 0; + int mclefQ = 0; + int oclefQ = 0; int keysigQ = 0; int keyQ = 0; int timesigQ = 0; @@ -105171,6 +105173,30 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, } } + if (!mclefQ && (outmeasures[index].smclef.size() > 0)) { + x = outmeasures[index].smclef[i].x; + y = outmeasures[index].smclef[i].y; + xo = outmeasures[index-1].emclef[i].x; + yo = outmeasures[index-1].emclef[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + mclefQ = 1; + } + } + } + + if (!oclefQ && (outmeasures[index].soclef.size() > 0)) { + x = outmeasures[index].soclef[i].x; + y = outmeasures[index].soclef[i].y; + xo = outmeasures[index-1].eoclef[i].x; + yo = outmeasures[index-1].eoclef[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + oclefQ = 1; + } + } + } + if (!keysigQ && (outmeasures[index].skeysig.size() > 0)) { x = outmeasures[index].skeysig[i].x; y = outmeasures[index].skeysig[i].y; @@ -105257,6 +105283,52 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mclefQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].smclef[track].x; + y = outmeasures[index].smclef[track].y; + xo = outmeasures[index-1].emclef[track].x; + yo = outmeasures[index-1].emclef[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (oclefQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].soclef[track].x; + y = outmeasures[index].soclef[track].y; + xo = outmeasures[index-1].eoclef[track].x; + yo = outmeasures[index-1].eoclef[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (keysigQ) { for (int i=0; igetTrack(); @@ -105391,6 +105463,8 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, int i; int clefQ = 0; + int mclefQ = 0; + int oclefQ = 0; int keysigQ = 0; int keyQ = 0; int timesigQ = 0; @@ -105419,6 +105493,24 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, } } + if (!mclefQ) { + x = outmeasures[index].smclef[i].x; + y = outmeasures[index].smclef[i].y; + + if ((x>=0)&&(y>=0)) { + mclefQ = 1; + } + } + + if (!oclefQ) { + x = outmeasures[index].soclef[i].x; + y = outmeasures[index].soclef[i].y; + + if ((x>=0)&&(y>=0)) { + oclefQ = 1; + } + } + if (!keysigQ) { x = outmeasures[index].skeysig[i].x; y = outmeasures[index].skeysig[i].y; @@ -105479,6 +105571,40 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mclefQ) { + for (i=0; igetTrack(); + x = outmeasures[index].smclef[ptrack].x; + y = outmeasures[index].smclef[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (oclefQ) { + for (i=0; igetTrack(); + x = outmeasures[index].soclef[ptrack].x; + y = outmeasures[index].soclef[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (keysigQ) { for (i=0; igetTrack(); @@ -106485,6 +106611,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me // cerr << "MAX TRACKS " << tracks << " ===============================" << endl; vector currclef(tracks+1); + vector currmclef(tracks+1); + vector curroclef(tracks+1); vector currkeysig(tracks+1); vector currkey(tracks+1); vector currtimesig(tracks+1); @@ -106495,6 +106623,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me undefMyCoord.clear(); fill(currclef.begin(), currclef.end(), undefMyCoord); + fill(currmclef.begin(), currmclef.end(), undefMyCoord); + fill(curroclef.begin(), curroclef.end(), undefMyCoord); fill(currkeysig.begin(), currkeysig.end(), undefMyCoord); fill(currkey.begin(), currkey.end(), undefMyCoord); fill(currtimesig.begin(), currtimesig.end(), undefMyCoord); @@ -106520,6 +106650,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me // store state of global music values at end of measure if (currmeasure >= 0) { measurein[inmap[currmeasure]].eclef = currclef; + measurein[inmap[currmeasure]].emclef = currmclef; + measurein[inmap[currmeasure]].eoclef = curroclef; measurein[inmap[currmeasure]].ekeysig = currkeysig; measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; @@ -106544,6 +106676,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me // } // cerr << endl; measurein[inmap[currmeasure]].sclef = currclef; + measurein[inmap[currmeasure]].smclef = currmclef; + measurein[inmap[currmeasure]].soclef = curroclef; measurein[inmap[currmeasure]].skeysig = currkeysig; measurein[inmap[currmeasure]].skey = currkey; measurein[inmap[currmeasure]].stimesig = currtimesig; @@ -106566,6 +106700,12 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me if (infile.token(i, j)->compare(0, 5, "*clef") == 0) { measurein[inmap[currmeasure]].sclef[track].x = -1; measurein[inmap[currmeasure]].sclef[track].y = -1; + } else if (infile.token(i, j)->compare(0, 6, "*mclef") == 0) { + measurein[inmap[currmeasure]].smclef[track].x = -1; + measurein[inmap[currmeasure]].smclef[track].y = -1; + } else if (infile.token(i, j)->compare(0, 6, "*oclef") == 0) { + measurein[inmap[currmeasure]].soclef[track].x = -1; + measurein[inmap[currmeasure]].soclef[track].y = -1; } else if (hre.search(infile.token(i, j), "^\\*k\\[.*\\]", "")) { measurein[inmap[currmeasure]].skeysig[track].x = -1; measurein[inmap[currmeasure]].skeysig[track].y = -1; @@ -106589,6 +106729,16 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me currclef[track].y = j; continue; } + if (infile.token(i, j)->compare(0, 6, "*mclef") == 0) { + currmclef[track].x = i; + currmclef[track].y = j; + continue; + } + if (infile.token(i, j)->compare(0, 6, "*oclef") == 0) { + curroclef[track].x = i; + curroclef[track].y = j; + continue; + } if (hre.search(infile.token(i, j), R"(^\*k\[.*\])")) { currkeysig[track].x = i; currkeysig[track].y = j; @@ -106626,6 +106776,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me if ((currmeasure >= 0) && (currmeasure < (int)inmap.size()) && (inmap[currmeasure] >= 0)) { measurein[inmap[currmeasure]].eclef = currclef; + measurein[inmap[currmeasure]].emclef = currmclef; + measurein[inmap[currmeasure]].eoclef = curroclef; measurein[inmap[currmeasure]].ekeysig = currkeysig; measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; @@ -106640,18 +106792,50 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[i].sclef.resize(tracks+1); fill(measurein[i].sclef.begin(), measurein[i].sclef.end(), undefMyCoord); } + if (measurein[i].smclef.size() == 0) { + measurein[i].smclef.resize(tracks+1); + fill(measurein[i].smclef.begin(), measurein[i].smclef.end(), undefMyCoord); + } + if (measurein[i].soclef.size() == 0) { + measurein[i].soclef.resize(tracks+1); + fill(measurein[i].soclef.begin(), measurein[i].soclef.end(), undefMyCoord); + } if (measurein[i].eclef.size() == 0) { measurein[i].eclef.resize(tracks+1); fill(measurein[i].eclef.begin(), measurein[i].eclef.end(), undefMyCoord); } + if (measurein[i].emclef.size() == 0) { + measurein[i].emclef.resize(tracks+1); + fill(measurein[i].emclef.begin(), measurein[i].emclef.end(), undefMyCoord); + } + if (measurein[i].eoclef.size() == 0) { + measurein[i].eoclef.resize(tracks+1); + fill(measurein[i].eoclef.begin(), measurein[i].eoclef.end(), undefMyCoord); + } if (measurein[i+1].sclef.size() == 0) { measurein[i+1].sclef.resize(tracks+1); fill(measurein[i+1].sclef.begin(), measurein[i+1].sclef.end(), undefMyCoord); } + if (measurein[i+1].smclef.size() == 0) { + measurein[i+1].smclef.resize(tracks+1); + fill(measurein[i+1].smclef.begin(), measurein[i+1].smclef.end(), undefMyCoord); + } + if (measurein[i+1].soclef.size() == 0) { + measurein[i+1].soclef.resize(tracks+1); + fill(measurein[i+1].soclef.begin(), measurein[i+1].soclef.end(), undefMyCoord); + } if (measurein[i+1].eclef.size() == 0) { measurein[i+1].eclef.resize(tracks+1); fill(measurein[i+1].eclef.begin(), measurein[i+1].eclef.end(), undefMyCoord); } + if (measurein[i+1].emclef.size() == 0) { + measurein[i+1].emclef.resize(tracks+1); + fill(measurein[i+1].emclef.begin(), measurein[i+1].emclef.end(), undefMyCoord); + } + if (measurein[i+1].eoclef.size() == 0) { + measurein[i+1].eoclef.resize(tracks+1); + fill(measurein[i+1].eoclef.begin(), measurein[i+1].eoclef.end(), undefMyCoord); + } for (j=1; j<(int)measurein[i].sclef.size(); j++) { if (!measurein[i].eclef[j].isValid()) { if (measurein[i].sclef[j].isValid()) { @@ -106664,6 +106848,30 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me } } } + for (j=1; j<(int)measurein[i].smclef.size(); j++) { + if (!measurein[i].emclef[j].isValid()) { + if (measurein[i].smclef[j].isValid()) { + measurein[i].emclef[j] = measurein[i].smclef[j]; + } + } + if (!measurein[i+1].smclef[j].isValid()) { + if (measurein[i].emclef[j].isValid()) { + measurein[i+1].smclef[j] = measurein[i].emclef[j]; + } + } + } + for (j=1; j<(int)measurein[i].soclef.size(); j++) { + if (!measurein[i].eoclef[j].isValid()) { + if (measurein[i].soclef[j].isValid()) { + measurein[i].eoclef[j] = measurein[i].soclef[j]; + } + } + if (!measurein[i+1].soclef[j].isValid()) { + if (measurein[i].eoclef[j].isValid()) { + measurein[i+1].soclef[j] = measurein[i].eoclef[j]; + } + } + } if (measurein[i].skeysig.size() == 0) { measurein[i].skeysig.resize(tracks+1); @@ -106880,6 +107088,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stop = inmeasures[inmap[i]].stop; current.sclef = inmeasures[inmap[i]].sclef; + current.smclef = inmeasures[inmap[i]].smclef; + current.soclef = inmeasures[inmap[i]].soclef; current.skeysig = inmeasures[inmap[i]].skeysig; current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; @@ -106887,6 +107097,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; + current.emclef = inmeasures[inmap[i]].emclef; + current.eoclef = inmeasures[inmap[i]].eoclef; current.ekeysig = inmeasures[inmap[i]].ekeysig; current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; @@ -106907,6 +107119,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stop = inmeasures[inmap[i]].stop; current.sclef = inmeasures[inmap[i]].sclef; + current.smclef = inmeasures[inmap[i]].smclef; + current.soclef = inmeasures[inmap[i]].soclef; current.skeysig = inmeasures[inmap[i]].skeysig; current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; @@ -106914,6 +107128,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; + current.emclef = inmeasures[inmap[i]].emclef; + current.eoclef = inmeasures[inmap[i]].eoclef; current.ekeysig = inmeasures[inmap[i]].ekeysig; current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; @@ -106943,6 +107159,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stop = inmeasures[inmap[value]].stop; current.sclef = inmeasures[inmap[value]].sclef; + current.smclef = inmeasures[inmap[value]].smclef; + current.soclef = inmeasures[inmap[value]].soclef; current.skeysig = inmeasures[inmap[value]].skeysig; current.skey = inmeasures[inmap[value]].skey; current.stimesig = inmeasures[inmap[value]].stimesig; @@ -106950,6 +107168,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stempo = inmeasures[inmap[value]].stempo; current.eclef = inmeasures[inmap[value]].eclef; + current.emclef = inmeasures[inmap[value]].emclef; + current.eoclef = inmeasures[inmap[value]].eoclef; current.ekeysig = inmeasures[inmap[value]].ekeysig; current.ekey = inmeasures[inmap[value]].ekey; current.etimesig = inmeasures[inmap[value]].etimesig; diff --git a/min/humlib.h b/min/humlib.h index ae3ded61..97be51d0 100644 --- a/min/humlib.h +++ b/min/humlib.h @@ -1,7 +1,7 @@ // // Programmer: Craig Stuart Sapp // Creation Date: Sat Aug 8 12:24:49 PDT 2015 -// Last Modified: Tue Feb 6 22:50:09 PST 2024 +// Last Modified: Mo 12 Feb 2024 13:00:50 CET // Filename: min/humlib.h // URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.h // Syntax: C++11 @@ -9239,20 +9239,26 @@ class MeasureInfo { public: MeasureInfo(void) { clear(); } void clear(void) { num = seg = start = stop = -1; - sclef.resize(0); skeysig.resize(0); skey.resize(0); + sclef.resize(0); smclef.resize(0); soclef.resize(0); + skeysig.resize(0); skey.resize(0); stimesig.resize(0); smet.resize(0); stempo.resize(0); - eclef.resize(0); ekeysig.resize(0); ekey.resize(0); + eclef.resize(0); emclef.resize(0); eoclef.resize(0); + ekeysig.resize(0); ekey.resize(0); etimesig.resize(0); emet.resize(0); etempo.resize(0); file = NULL; } void setTrackCount(int tcount) { sclef.resize(tcount+1); + smclef.resize(tcount+1); + soclef.resize(tcount+1); skeysig.resize(tcount+1); skey.resize(tcount+1); stimesig.resize(tcount+1); smet.resize(tcount+1); stempo.resize(tcount+1); eclef.resize(tcount+1); + emclef.resize(tcount+1); + eoclef.resize(tcount+1); ekeysig.resize(tcount+1); ekey.resize(tcount+1); etimesig.resize(tcount+1); @@ -9261,12 +9267,16 @@ class MeasureInfo { int i; for (i=0; i sclef; // starting clef of segment + vector smclef; // starting mclef of segment + vector soclef; // starting oclef of segment vector skeysig; // starting keysig of segment vector skey; // starting key of segment vector stimesig; // starting timesig of segment @@ -9294,6 +9306,8 @@ class MeasureInfo { // musical settings at start of measure vector eclef; // ending clef of segment + vector emclef; // ending mclef of segment + vector eoclef; // ending oclef of segment vector ekeysig; // ending keysig of segment vector ekey; // ending key of segment vector etimesig; // ending timesig of segment diff --git a/src/tool-myank.cpp b/src/tool-myank.cpp index b1bedab2..17daf42b 100644 --- a/src/tool-myank.cpp +++ b/src/tool-myank.cpp @@ -889,6 +889,8 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, // } int clefQ = 0; + int mclefQ = 0; + int oclefQ = 0; int keysigQ = 0; int keyQ = 0; int timesigQ = 0; @@ -923,6 +925,30 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, } } + if (!mclefQ && (outmeasures[index].smclef.size() > 0)) { + x = outmeasures[index].smclef[i].x; + y = outmeasures[index].smclef[i].y; + xo = outmeasures[index-1].emclef[i].x; + yo = outmeasures[index-1].emclef[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + mclefQ = 1; + } + } + } + + if (!oclefQ && (outmeasures[index].soclef.size() > 0)) { + x = outmeasures[index].soclef[i].x; + y = outmeasures[index].soclef[i].y; + xo = outmeasures[index-1].eoclef[i].x; + yo = outmeasures[index-1].eoclef[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + oclefQ = 1; + } + } + } + if (!keysigQ && (outmeasures[index].skeysig.size() > 0)) { x = outmeasures[index].skeysig[i].x; y = outmeasures[index].skeysig[i].y; @@ -1009,6 +1035,52 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mclefQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].smclef[track].x; + y = outmeasures[index].smclef[track].y; + xo = outmeasures[index-1].emclef[track].x; + yo = outmeasures[index-1].emclef[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (oclefQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].soclef[track].x; + y = outmeasures[index].soclef[track].y; + xo = outmeasures[index-1].eoclef[track].x; + yo = outmeasures[index-1].eoclef[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (keysigQ) { for (int i=0; igetTrack(); @@ -1143,6 +1215,8 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, int i; int clefQ = 0; + int mclefQ = 0; + int oclefQ = 0; int keysigQ = 0; int keyQ = 0; int timesigQ = 0; @@ -1171,6 +1245,24 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, } } + if (!mclefQ) { + x = outmeasures[index].smclef[i].x; + y = outmeasures[index].smclef[i].y; + + if ((x>=0)&&(y>=0)) { + mclefQ = 1; + } + } + + if (!oclefQ) { + x = outmeasures[index].soclef[i].x; + y = outmeasures[index].soclef[i].y; + + if ((x>=0)&&(y>=0)) { + oclefQ = 1; + } + } + if (!keysigQ) { x = outmeasures[index].skeysig[i].x; y = outmeasures[index].skeysig[i].y; @@ -1231,6 +1323,40 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mclefQ) { + for (i=0; igetTrack(); + x = outmeasures[index].smclef[ptrack].x; + y = outmeasures[index].smclef[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (oclefQ) { + for (i=0; igetTrack(); + x = outmeasures[index].soclef[ptrack].x; + y = outmeasures[index].soclef[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (keysigQ) { for (i=0; igetTrack(); @@ -2237,6 +2363,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me // cerr << "MAX TRACKS " << tracks << " ===============================" << endl; vector currclef(tracks+1); + vector currmclef(tracks+1); + vector curroclef(tracks+1); vector currkeysig(tracks+1); vector currkey(tracks+1); vector currtimesig(tracks+1); @@ -2247,6 +2375,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me undefMyCoord.clear(); fill(currclef.begin(), currclef.end(), undefMyCoord); + fill(currmclef.begin(), currmclef.end(), undefMyCoord); + fill(curroclef.begin(), curroclef.end(), undefMyCoord); fill(currkeysig.begin(), currkeysig.end(), undefMyCoord); fill(currkey.begin(), currkey.end(), undefMyCoord); fill(currtimesig.begin(), currtimesig.end(), undefMyCoord); @@ -2272,6 +2402,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me // store state of global music values at end of measure if (currmeasure >= 0) { measurein[inmap[currmeasure]].eclef = currclef; + measurein[inmap[currmeasure]].emclef = currmclef; + measurein[inmap[currmeasure]].eoclef = curroclef; measurein[inmap[currmeasure]].ekeysig = currkeysig; measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; @@ -2296,6 +2428,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me // } // cerr << endl; measurein[inmap[currmeasure]].sclef = currclef; + measurein[inmap[currmeasure]].smclef = currmclef; + measurein[inmap[currmeasure]].soclef = curroclef; measurein[inmap[currmeasure]].skeysig = currkeysig; measurein[inmap[currmeasure]].skey = currkey; measurein[inmap[currmeasure]].stimesig = currtimesig; @@ -2318,6 +2452,12 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me if (infile.token(i, j)->compare(0, 5, "*clef") == 0) { measurein[inmap[currmeasure]].sclef[track].x = -1; measurein[inmap[currmeasure]].sclef[track].y = -1; + } else if (infile.token(i, j)->compare(0, 6, "*mclef") == 0) { + measurein[inmap[currmeasure]].smclef[track].x = -1; + measurein[inmap[currmeasure]].smclef[track].y = -1; + } else if (infile.token(i, j)->compare(0, 6, "*oclef") == 0) { + measurein[inmap[currmeasure]].soclef[track].x = -1; + measurein[inmap[currmeasure]].soclef[track].y = -1; } else if (hre.search(infile.token(i, j), "^\\*k\\[.*\\]", "")) { measurein[inmap[currmeasure]].skeysig[track].x = -1; measurein[inmap[currmeasure]].skeysig[track].y = -1; @@ -2341,6 +2481,16 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me currclef[track].y = j; continue; } + if (infile.token(i, j)->compare(0, 6, "*mclef") == 0) { + currmclef[track].x = i; + currmclef[track].y = j; + continue; + } + if (infile.token(i, j)->compare(0, 6, "*oclef") == 0) { + curroclef[track].x = i; + curroclef[track].y = j; + continue; + } if (hre.search(infile.token(i, j), R"(^\*k\[.*\])")) { currkeysig[track].x = i; currkeysig[track].y = j; @@ -2378,6 +2528,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me if ((currmeasure >= 0) && (currmeasure < (int)inmap.size()) && (inmap[currmeasure] >= 0)) { measurein[inmap[currmeasure]].eclef = currclef; + measurein[inmap[currmeasure]].emclef = currmclef; + measurein[inmap[currmeasure]].eoclef = curroclef; measurein[inmap[currmeasure]].ekeysig = currkeysig; measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; @@ -2392,18 +2544,50 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[i].sclef.resize(tracks+1); fill(measurein[i].sclef.begin(), measurein[i].sclef.end(), undefMyCoord); } + if (measurein[i].smclef.size() == 0) { + measurein[i].smclef.resize(tracks+1); + fill(measurein[i].smclef.begin(), measurein[i].smclef.end(), undefMyCoord); + } + if (measurein[i].soclef.size() == 0) { + measurein[i].soclef.resize(tracks+1); + fill(measurein[i].soclef.begin(), measurein[i].soclef.end(), undefMyCoord); + } if (measurein[i].eclef.size() == 0) { measurein[i].eclef.resize(tracks+1); fill(measurein[i].eclef.begin(), measurein[i].eclef.end(), undefMyCoord); } + if (measurein[i].emclef.size() == 0) { + measurein[i].emclef.resize(tracks+1); + fill(measurein[i].emclef.begin(), measurein[i].emclef.end(), undefMyCoord); + } + if (measurein[i].eoclef.size() == 0) { + measurein[i].eoclef.resize(tracks+1); + fill(measurein[i].eoclef.begin(), measurein[i].eoclef.end(), undefMyCoord); + } if (measurein[i+1].sclef.size() == 0) { measurein[i+1].sclef.resize(tracks+1); fill(measurein[i+1].sclef.begin(), measurein[i+1].sclef.end(), undefMyCoord); } + if (measurein[i+1].smclef.size() == 0) { + measurein[i+1].smclef.resize(tracks+1); + fill(measurein[i+1].smclef.begin(), measurein[i+1].smclef.end(), undefMyCoord); + } + if (measurein[i+1].soclef.size() == 0) { + measurein[i+1].soclef.resize(tracks+1); + fill(measurein[i+1].soclef.begin(), measurein[i+1].soclef.end(), undefMyCoord); + } if (measurein[i+1].eclef.size() == 0) { measurein[i+1].eclef.resize(tracks+1); fill(measurein[i+1].eclef.begin(), measurein[i+1].eclef.end(), undefMyCoord); } + if (measurein[i+1].emclef.size() == 0) { + measurein[i+1].emclef.resize(tracks+1); + fill(measurein[i+1].emclef.begin(), measurein[i+1].emclef.end(), undefMyCoord); + } + if (measurein[i+1].eoclef.size() == 0) { + measurein[i+1].eoclef.resize(tracks+1); + fill(measurein[i+1].eoclef.begin(), measurein[i+1].eoclef.end(), undefMyCoord); + } for (j=1; j<(int)measurein[i].sclef.size(); j++) { if (!measurein[i].eclef[j].isValid()) { if (measurein[i].sclef[j].isValid()) { @@ -2416,6 +2600,30 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me } } } + for (j=1; j<(int)measurein[i].smclef.size(); j++) { + if (!measurein[i].emclef[j].isValid()) { + if (measurein[i].smclef[j].isValid()) { + measurein[i].emclef[j] = measurein[i].smclef[j]; + } + } + if (!measurein[i+1].smclef[j].isValid()) { + if (measurein[i].emclef[j].isValid()) { + measurein[i+1].smclef[j] = measurein[i].emclef[j]; + } + } + } + for (j=1; j<(int)measurein[i].soclef.size(); j++) { + if (!measurein[i].eoclef[j].isValid()) { + if (measurein[i].soclef[j].isValid()) { + measurein[i].eoclef[j] = measurein[i].soclef[j]; + } + } + if (!measurein[i+1].soclef[j].isValid()) { + if (measurein[i].eoclef[j].isValid()) { + measurein[i+1].soclef[j] = measurein[i].eoclef[j]; + } + } + } if (measurein[i].skeysig.size() == 0) { measurein[i].skeysig.resize(tracks+1); @@ -2632,6 +2840,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stop = inmeasures[inmap[i]].stop; current.sclef = inmeasures[inmap[i]].sclef; + current.smclef = inmeasures[inmap[i]].smclef; + current.soclef = inmeasures[inmap[i]].soclef; current.skeysig = inmeasures[inmap[i]].skeysig; current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; @@ -2639,6 +2849,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; + current.emclef = inmeasures[inmap[i]].emclef; + current.eoclef = inmeasures[inmap[i]].eoclef; current.ekeysig = inmeasures[inmap[i]].ekeysig; current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; @@ -2659,6 +2871,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stop = inmeasures[inmap[i]].stop; current.sclef = inmeasures[inmap[i]].sclef; + current.smclef = inmeasures[inmap[i]].smclef; + current.soclef = inmeasures[inmap[i]].soclef; current.skeysig = inmeasures[inmap[i]].skeysig; current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; @@ -2666,6 +2880,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; + current.emclef = inmeasures[inmap[i]].emclef; + current.eoclef = inmeasures[inmap[i]].eoclef; current.ekeysig = inmeasures[inmap[i]].ekeysig; current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; @@ -2695,6 +2911,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stop = inmeasures[inmap[value]].stop; current.sclef = inmeasures[inmap[value]].sclef; + current.smclef = inmeasures[inmap[value]].smclef; + current.soclef = inmeasures[inmap[value]].soclef; current.skeysig = inmeasures[inmap[value]].skeysig; current.skey = inmeasures[inmap[value]].skey; current.stimesig = inmeasures[inmap[value]].stimesig; @@ -2702,6 +2920,8 @@ void Tool_myank::processFieldEntry(vector& field, current.stempo = inmeasures[inmap[value]].stempo; current.eclef = inmeasures[inmap[value]].eclef; + current.emclef = inmeasures[inmap[value]].emclef; + current.eoclef = inmeasures[inmap[value]].eoclef; current.ekeysig = inmeasures[inmap[value]].ekeysig; current.ekey = inmeasures[inmap[value]].ekey; current.etimesig = inmeasures[inmap[value]].etimesig; From bb927c7da3efb420dbab641a227420b0055787ee Mon Sep 17 00:00:00 2001 From: Wolfgang Drescher Date: Mon, 12 Feb 2024 14:12:46 +0100 Subject: [PATCH 2/2] Keep *mmet and *omet interpretations in myank --- include/tool-myank.h | 26 ++++- min/humlib.cpp | 248 +++++++++++++++++++++++++++++++++++++++++-- min/humlib.h | 28 +++-- src/tool-myank.cpp | 246 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 526 insertions(+), 22 deletions(-) diff --git a/include/tool-myank.h b/include/tool-myank.h index ae671c8d..be8c0751 100644 --- a/include/tool-myank.h +++ b/include/tool-myank.h @@ -34,11 +34,11 @@ class MeasureInfo { MeasureInfo(void) { clear(); } void clear(void) { num = seg = start = stop = -1; sclef.resize(0); smclef.resize(0); soclef.resize(0); - skeysig.resize(0); skey.resize(0); - stimesig.resize(0); smet.resize(0); stempo.resize(0); + smet.resize(0); smmet.resize(0); somet.resize(0); + skeysig.resize(0); skey.resize(0); stimesig.resize(0); stempo.resize(0); eclef.resize(0); emclef.resize(0); eoclef.resize(0); - ekeysig.resize(0); ekey.resize(0); - etimesig.resize(0); emet.resize(0); etempo.resize(0); + emet.resize(0); emmet.resize(0); eomet.resize(0); + ekeysig.resize(0); ekey.resize(0); etimesig.resize(0); etempo.resize(0); file = NULL; } void setTrackCount(int tcount) { @@ -49,6 +49,8 @@ class MeasureInfo { skey.resize(tcount+1); stimesig.resize(tcount+1); smet.resize(tcount+1); + smmet.resize(tcount+1); + somet.resize(tcount+1); stempo.resize(tcount+1); eclef.resize(tcount+1); emclef.resize(tcount+1); @@ -57,6 +59,8 @@ class MeasureInfo { ekey.resize(tcount+1); etimesig.resize(tcount+1); emet.resize(tcount+1); + emmet.resize(tcount+1); + eomet.resize(tcount+1); etempo.resize(tcount+1); int i; for (i=0; i skey; // starting key of segment vector stimesig; // starting timesig of segment vector smet; // starting met of segment + vector smmet; // starting mmet of segment + vector somet; // starting omet of segment vector stempo; // starting tempo of segment // musical settings at start of measure @@ -106,6 +116,8 @@ class MeasureInfo { vector ekey; // ending key of segment vector etimesig; // ending timesig of segment vector emet; // ending met of segment + vector emmet; // ending mmet of segment + vector eomet; // ending omet of segment vector etempo; // ending tempo of segment }; @@ -158,8 +170,10 @@ class Tool_myank : public HumTool { void insertZerothMeasure (vector& measurelist, HumdrumFile& infile); void getMetStates (vector >& metstates, + vector >& mmetstates, + vector >& ometstates, HumdrumFile& infile); - MyCoord getLocalMetInfo (HumdrumFile& infile, int row, int track); + MyCoord getLocalMetInfo (HumdrumFile& infile, int row, int track, string prefix = ""); int atEndOfFile (HumdrumFile& infile, int line); void processFile (HumdrumFile& infile); int getSectionCount (HumdrumFile& infile); @@ -194,6 +208,8 @@ class Tool_myank : public HumTool { vector m_measureOutList; // used with -m option vector m_measureInList; // used with -m option vector > m_metstates; + vector > m_mmetstates; + vector > m_ometstates; string m_lineRange; // used with -l option vector m_barNumbersPerLine; // used with -l option diff --git a/min/humlib.cpp b/min/humlib.cpp index bc6f3478..9e2541c0 100644 --- a/min/humlib.cpp +++ b/min/humlib.cpp @@ -1,7 +1,7 @@ // // Programmer: Craig Stuart Sapp // Creation Date: Sat Aug 8 12:24:49 PDT 2015 -// Last Modified: Mo 12 Feb 2024 13:00:50 CET +// Last Modified: Mo 12 Feb 2024 14:12:06 CET // Filename: min/humlib.cpp // URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.cpp // Syntax: C++11 @@ -104497,7 +104497,7 @@ void Tool_myank::processFile(HumdrumFile& infile) { return; } - getMetStates(m_metstates, infile); + getMetStates(m_metstates, m_mmetstates, m_ometstates, infile); getMeasureStartStop(m_measureInList, infile); string measurestring = getString("measures"); @@ -104668,11 +104668,17 @@ string Tool_myank::expandMultipliers(const string& inputstring) { // in the score, keeping track of meter without metric symbols. // -void Tool_myank::getMetStates(vector >& metstates, - HumdrumFile& infile) { +void Tool_myank::getMetStates(vector >& metstates, vector >& mmetstates, + vector >& ometstates, HumdrumFile& infile) { vector current; + vector mcurrent; + vector ocurrent; current.resize(infile.getMaxTrack()+1); + mcurrent.resize(infile.getMaxTrack()+1); + ocurrent.resize(infile.getMaxTrack()+1); metstates.resize(infile.getLineCount()); + mmetstates.resize(infile.getLineCount()); + ometstates.resize(infile.getLineCount()); HumRegex hre; int track; @@ -104683,8 +104689,16 @@ void Tool_myank::getMetStates(vector >& metstates, if (hre.search(infile.token(i, j), R"(^\*met\([^\)]+\))")) { current[track].x = i; current[track].y = j; + } else if (hre.search(infile.token(i, j), R"(^\*mmet\([^\)]+\))")) { + mcurrent[track].x = i; + mcurrent[track].y = j; + } else if (hre.search(infile.token(i, j), R"(^\*omet\([^\)]+\))")) { + ocurrent[track].x = i; + ocurrent[track].y = j; } else if (hre.search(infile.token(i, j), R"(^\*M\d+\d+)")) { current[track] = getLocalMetInfo(infile, i, track); + mcurrent[track] = getLocalMetInfo(infile, i, track, "m"); + ocurrent[track] = getLocalMetInfo(infile, i, track, "o"); } } } @@ -104695,8 +104709,12 @@ void Tool_myank::getMetStates(vector >& metstates, // metstates[i][j] = current[track]; // } metstates[i].resize(infile.getMaxTrack()+1); + mmetstates[i].resize(infile.getMaxTrack()+1); + ometstates[i].resize(infile.getMaxTrack()+1); for (int j=1; j<=infile.getMaxTrack(); j++) { metstates[i][j] = current[j]; + mmetstates[i][j] = mcurrent[j]; + ometstates[i][j] = ocurrent[j]; } } @@ -104725,7 +104743,7 @@ void Tool_myank::getMetStates(vector >& metstates, // value if none found. // -MyCoord Tool_myank::getLocalMetInfo(HumdrumFile& infile, int row, int track) { +MyCoord Tool_myank::getLocalMetInfo(HumdrumFile& infile, int row, int track, string prefix) { MyCoord output; int startline = -1; int stopline = -1; @@ -104764,7 +104782,7 @@ MyCoord Tool_myank::getLocalMetInfo(HumdrumFile& infile, int row, int track) { if (track != xtrac) { continue; } - if (hre.search(infile.token(i, j), R"(^\*met\([^\)]+\))")) { + if (hre.search(infile.token(i, j), R"(^\*)" + prefix + R"(met\([^\)]+\))")) { output.x = i; output.x = j; } @@ -105143,6 +105161,8 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, int keyQ = 0; int timesigQ = 0; int metQ = 0; + int mmetQ = 0; + int ometQ = 0; int tempoQ = 0; int x, y; @@ -105245,6 +105265,30 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, } } + if (!mmetQ && (outmeasures[index].smmet.size() > 0)) { + x = outmeasures[index].smmet[i].x; + y = outmeasures[index].smmet[i].y; + xo = outmeasures[index-1].emmet[i].x; + yo = outmeasures[index-1].emmet[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + mmetQ = 1; + } + } + } + + if (!ometQ && (outmeasures[index].somet.size() > 0)) { + x = outmeasures[index].somet[i].x; + y = outmeasures[index].somet[i].y; + xo = outmeasures[index-1].eomet[i].x; + yo = outmeasures[index-1].eomet[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + ometQ = 1; + } + } + } + if (!tempoQ && (outmeasures[index].stempo.size() > 0)) { x = outmeasures[index].stempo[i].x; y = outmeasures[index].stempo[i].y; @@ -105421,6 +105465,52 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mmetQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].smmet[track].x; + y = outmeasures[index].smmet[track].y; + xo = outmeasures[index-1].emmet[track].x; + yo = outmeasures[index-1].emmet[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (ometQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].somet[track].x; + y = outmeasures[index].somet[track].y; + xo = outmeasures[index-1].eomet[track].x; + yo = outmeasures[index-1].eomet[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (tempoQ) { for (int i=0; igetTrack(); @@ -105469,6 +105559,8 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, int keyQ = 0; int timesigQ = 0; int metQ = 0; + int mmetQ = 0; + int ometQ = 0; int tempoQ = 0; int x, y; @@ -105543,6 +105635,22 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, } } + if (!mmetQ) { + x = outmeasures[index].smmet[i].x; + y = outmeasures[index].smmet[i].y; + if ((x>=0)&&(y>=0)) { + mmetQ = 1; + } + } + + if (!ometQ) { + x = outmeasures[index].somet[i].x; + y = outmeasures[index].somet[i].y; + if ((x>=0)&&(y>=0)) { + ometQ = 1; + } + } + if (!tempoQ) { x = outmeasures[index].stempo[i].x; y = outmeasures[index].stempo[i].y; @@ -105672,6 +105780,40 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mmetQ) { + for (i=0; igetTrack(); + x = outmeasures[index].smmet[ptrack].x; + y = outmeasures[index].smmet[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (ometQ) { + for (i=0; igetTrack(); + x = outmeasures[index].somet[ptrack].x; + y = outmeasures[index].somet[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (tempoQ) { for (i=0; igetTrack(); @@ -106617,6 +106759,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me vector currkey(tracks+1); vector currtimesig(tracks+1); vector currmet(tracks+1); + vector currmmet(tracks+1); + vector curromet(tracks+1); vector currtempo(tracks+1); MyCoord undefMyCoord; @@ -106629,6 +106773,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me fill(currkey.begin(), currkey.end(), undefMyCoord); fill(currtimesig.begin(), currtimesig.end(), undefMyCoord); fill(currmet.begin(), currmet.end(), undefMyCoord); + fill(currmmet.begin(), currmmet.end(), undefMyCoord); + fill(curromet.begin(), curromet.end(), undefMyCoord); fill(currtempo.begin(), currtempo.end(), undefMyCoord); int currmeasure = -1; @@ -106656,6 +106802,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; measurein[inmap[currmeasure]].emet = currmet; + measurein[inmap[currmeasure]].emmet = currmmet; + measurein[inmap[currmeasure]].eomet = curromet; measurein[inmap[currmeasure]].etempo = currtempo; } @@ -106683,6 +106831,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[inmap[currmeasure]].stimesig = currtimesig; // measurein[inmap[currmeasure]].smet = metstates[i]; measurein[inmap[currmeasure]].smet = currmet; + measurein[inmap[currmeasure]].smmet = currmmet; + measurein[inmap[currmeasure]].somet = curromet; measurein[inmap[currmeasure]].stempo = currtempo; } @@ -106718,6 +106868,12 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me } else if (hre.search(infile.token(i, j), R"(^\*met\(.*\))")) { measurein[inmap[currmeasure]].smet[track].x = -1; measurein[inmap[currmeasure]].smet[track].y = -1; + } else if (hre.search(infile.token(i, j), R"(^\*mmet\(.*\))")) { + measurein[inmap[currmeasure]].smmet[track].x = -1; + measurein[inmap[currmeasure]].smmet[track].y = -1; + } else if (hre.search(infile.token(i, j), R"(^\*omet\(.*\))")) { + measurein[inmap[currmeasure]].somet[track].x = -1; + measurein[inmap[currmeasure]].somet[track].y = -1; } else if (hre.search(infile.token(i, j), "^\\*MM\\d+", "i")) { measurein[inmap[currmeasure]].stempo[track].x = -1; measurein[inmap[currmeasure]].stempo[track].y = -1; @@ -106759,6 +106915,16 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me currmet[track].y = j; continue; } + if (hre.search(infile.token(i, j), R"(^\*mmet\(.*\))")) { + currmmet[track].x = i; + currmmet[track].y = j; + continue; + } + if (hre.search(infile.token(i, j), R"(^\*omet\(.*\))")) { + curromet[track].x = i; + curromet[track].y = j; + continue; + } if (hre.search(infile.token(i, j), R"(^\*MM[\d.]+)")) { currtempo[track].x = i; currtempo[track].y = j; @@ -106782,6 +106948,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; measurein[inmap[currmeasure]].emet = currmet; + measurein[inmap[currmeasure]].emmet = currmmet; + measurein[inmap[currmeasure]].eomet = curromet; measurein[inmap[currmeasure]].etempo = currtempo; } @@ -106964,18 +107132,50 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[i].smet.resize(tracks+1); fill(measurein[i].smet.begin(), measurein[i].smet.end(), undefMyCoord); } + if (measurein[i].smmet.size() == 0) { + measurein[i].smmet.resize(tracks+1); + fill(measurein[i].smmet.begin(), measurein[i].smmet.end(), undefMyCoord); + } + if (measurein[i].somet.size() == 0) { + measurein[i].somet.resize(tracks+1); + fill(measurein[i].somet.begin(), measurein[i].somet.end(), undefMyCoord); + } if (measurein[i].emet.size() == 0) { measurein[i].emet.resize(tracks+1); fill(measurein[i].emet.begin(), measurein[i].emet.end(), undefMyCoord); } + if (measurein[i].emmet.size() == 0) { + measurein[i].emmet.resize(tracks+1); + fill(measurein[i].emmet.begin(), measurein[i].emmet.end(), undefMyCoord); + } + if (measurein[i].eomet.size() == 0) { + measurein[i].eomet.resize(tracks+1); + fill(measurein[i].eomet.begin(), measurein[i].eomet.end(), undefMyCoord); + } if (measurein[i+1].smet.size() == 0) { measurein[i+1].smet.resize(tracks+1); fill(measurein[i+1].smet.begin(), measurein[i+1].smet.end(), undefMyCoord); } + if (measurein[i+1].smmet.size() == 0) { + measurein[i+1].smmet.resize(tracks+1); + fill(measurein[i+1].smmet.begin(), measurein[i+1].smmet.end(), undefMyCoord); + } + if (measurein[i+1].somet.size() == 0) { + measurein[i+1].somet.resize(tracks+1); + fill(measurein[i+1].somet.begin(), measurein[i+1].somet.end(), undefMyCoord); + } if (measurein[i+1].emet.size() == 0) { measurein[i+1].emet.resize(tracks+1); fill(measurein[i+1].emet.begin(), measurein[i+1].emet.end(), undefMyCoord); } + if (measurein[i+1].emmet.size() == 0) { + measurein[i+1].emmet.resize(tracks+1); + fill(measurein[i+1].emmet.begin(), measurein[i+1].emmet.end(), undefMyCoord); + } + if (measurein[i+1].eomet.size() == 0) { + measurein[i+1].eomet.resize(tracks+1); + fill(measurein[i+1].eomet.begin(), measurein[i+1].eomet.end(), undefMyCoord); + } for (j=1; j<(int)measurein[i].smet.size(); j++) { if (!measurein[i].emet[j].isValid()) { if (measurein[i].smet[j].isValid()) { @@ -106988,6 +107188,30 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me } } } + for (j=1; j<(int)measurein[i].smmet.size(); j++) { + if (!measurein[i].emmet[j].isValid()) { + if (measurein[i].smmet[j].isValid()) { + measurein[i].emmet[j] = measurein[i].smmet[j]; + } + } + if (!measurein[i+1].smmet[j].isValid()) { + if (measurein[i].emmet[j].isValid()) { + measurein[i+1].smmet[j] = measurein[i].emmet[j]; + } + } + } + for (j=1; j<(int)measurein[i].somet.size(); j++) { + if (!measurein[i].eomet[j].isValid()) { + if (measurein[i].somet[j].isValid()) { + measurein[i].eomet[j] = measurein[i].somet[j]; + } + } + if (!measurein[i+1].somet[j].isValid()) { + if (measurein[i].eomet[j].isValid()) { + measurein[i+1].somet[j] = measurein[i].eomet[j]; + } + } + } if (measurein[i].stempo.size() == 0) { measurein[i].stempo.resize(tracks+1); @@ -107094,6 +107318,8 @@ void Tool_myank::processFieldEntry(vector& field, current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; current.smet = inmeasures[inmap[i]].smet; + current.smmet = inmeasures[inmap[i]].smmet; + current.somet = inmeasures[inmap[i]].somet; current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; @@ -107103,6 +107329,8 @@ void Tool_myank::processFieldEntry(vector& field, current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; current.emet = inmeasures[inmap[i]].emet; + current.emmet = inmeasures[inmap[i]].emmet; + current.eomet = inmeasures[inmap[i]].eomet; current.etempo = inmeasures[inmap[i]].etempo; field.push_back(current); @@ -107125,6 +107353,8 @@ void Tool_myank::processFieldEntry(vector& field, current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; current.smet = inmeasures[inmap[i]].smet; + current.smmet = inmeasures[inmap[i]].smmet; + current.somet = inmeasures[inmap[i]].somet; current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; @@ -107134,6 +107364,8 @@ void Tool_myank::processFieldEntry(vector& field, current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; current.emet = inmeasures[inmap[i]].emet; + current.emmet = inmeasures[inmap[i]].emmet; + current.eomet = inmeasures[inmap[i]].eomet; current.etempo = inmeasures[inmap[i]].etempo; field.push_back(current); @@ -107165,6 +107397,8 @@ void Tool_myank::processFieldEntry(vector& field, current.skey = inmeasures[inmap[value]].skey; current.stimesig = inmeasures[inmap[value]].stimesig; current.smet = inmeasures[inmap[value]].smet; + current.smmet = inmeasures[inmap[value]].smmet; + current.somet = inmeasures[inmap[value]].somet; current.stempo = inmeasures[inmap[value]].stempo; current.eclef = inmeasures[inmap[value]].eclef; @@ -107174,6 +107408,8 @@ void Tool_myank::processFieldEntry(vector& field, current.ekey = inmeasures[inmap[value]].ekey; current.etimesig = inmeasures[inmap[value]].etimesig; current.emet = inmeasures[inmap[value]].emet; + current.emmet = inmeasures[inmap[value]].emmet; + current.eomet = inmeasures[inmap[value]].eomet; current.etempo = inmeasures[inmap[value]].etempo; field.push_back(current); diff --git a/min/humlib.h b/min/humlib.h index 97be51d0..2667c0b8 100644 --- a/min/humlib.h +++ b/min/humlib.h @@ -1,7 +1,7 @@ // // Programmer: Craig Stuart Sapp // Creation Date: Sat Aug 8 12:24:49 PDT 2015 -// Last Modified: Mo 12 Feb 2024 13:00:50 CET +// Last Modified: Mo 12 Feb 2024 14:12:06 CET // Filename: min/humlib.h // URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.h // Syntax: C++11 @@ -9240,11 +9240,11 @@ class MeasureInfo { MeasureInfo(void) { clear(); } void clear(void) { num = seg = start = stop = -1; sclef.resize(0); smclef.resize(0); soclef.resize(0); - skeysig.resize(0); skey.resize(0); - stimesig.resize(0); smet.resize(0); stempo.resize(0); + smet.resize(0); smmet.resize(0); somet.resize(0); + skeysig.resize(0); skey.resize(0); stimesig.resize(0); stempo.resize(0); eclef.resize(0); emclef.resize(0); eoclef.resize(0); - ekeysig.resize(0); ekey.resize(0); - etimesig.resize(0); emet.resize(0); etempo.resize(0); + emet.resize(0); emmet.resize(0); eomet.resize(0); + ekeysig.resize(0); ekey.resize(0); etimesig.resize(0); etempo.resize(0); file = NULL; } void setTrackCount(int tcount) { @@ -9255,6 +9255,8 @@ class MeasureInfo { skey.resize(tcount+1); stimesig.resize(tcount+1); smet.resize(tcount+1); + smmet.resize(tcount+1); + somet.resize(tcount+1); stempo.resize(tcount+1); eclef.resize(tcount+1); emclef.resize(tcount+1); @@ -9263,6 +9265,8 @@ class MeasureInfo { ekey.resize(tcount+1); etimesig.resize(tcount+1); emet.resize(tcount+1); + emmet.resize(tcount+1); + eomet.resize(tcount+1); etempo.resize(tcount+1); int i; for (i=0; i skey; // starting key of segment vector stimesig; // starting timesig of segment vector smet; // starting met of segment + vector smmet; // starting mmet of segment + vector somet; // starting omet of segment vector stempo; // starting tempo of segment // musical settings at start of measure @@ -9312,6 +9322,8 @@ class MeasureInfo { vector ekey; // ending key of segment vector etimesig; // ending timesig of segment vector emet; // ending met of segment + vector emmet; // ending mmet of segment + vector eomet; // ending omet of segment vector etempo; // ending tempo of segment }; @@ -9364,8 +9376,10 @@ class Tool_myank : public HumTool { void insertZerothMeasure (vector& measurelist, HumdrumFile& infile); void getMetStates (vector >& metstates, + vector >& mmetstates, + vector >& ometstates, HumdrumFile& infile); - MyCoord getLocalMetInfo (HumdrumFile& infile, int row, int track); + MyCoord getLocalMetInfo (HumdrumFile& infile, int row, int track, string prefix = ""); int atEndOfFile (HumdrumFile& infile, int line); void processFile (HumdrumFile& infile); int getSectionCount (HumdrumFile& infile); @@ -9400,6 +9414,8 @@ class Tool_myank : public HumTool { vector m_measureOutList; // used with -m option vector m_measureInList; // used with -m option vector > m_metstates; + vector > m_mmetstates; + vector > m_ometstates; string m_lineRange; // used with -l option vector m_barNumbersPerLine; // used with -l option diff --git a/src/tool-myank.cpp b/src/tool-myank.cpp index 17daf42b..8dd9ed85 100644 --- a/src/tool-myank.cpp +++ b/src/tool-myank.cpp @@ -249,7 +249,7 @@ void Tool_myank::processFile(HumdrumFile& infile) { return; } - getMetStates(m_metstates, infile); + getMetStates(m_metstates, m_mmetstates, m_ometstates, infile); getMeasureStartStop(m_measureInList, infile); string measurestring = getString("measures"); @@ -420,11 +420,17 @@ string Tool_myank::expandMultipliers(const string& inputstring) { // in the score, keeping track of meter without metric symbols. // -void Tool_myank::getMetStates(vector >& metstates, - HumdrumFile& infile) { +void Tool_myank::getMetStates(vector >& metstates, vector >& mmetstates, + vector >& ometstates, HumdrumFile& infile) { vector current; + vector mcurrent; + vector ocurrent; current.resize(infile.getMaxTrack()+1); + mcurrent.resize(infile.getMaxTrack()+1); + ocurrent.resize(infile.getMaxTrack()+1); metstates.resize(infile.getLineCount()); + mmetstates.resize(infile.getLineCount()); + ometstates.resize(infile.getLineCount()); HumRegex hre; int track; @@ -435,8 +441,16 @@ void Tool_myank::getMetStates(vector >& metstates, if (hre.search(infile.token(i, j), R"(^\*met\([^\)]+\))")) { current[track].x = i; current[track].y = j; + } else if (hre.search(infile.token(i, j), R"(^\*mmet\([^\)]+\))")) { + mcurrent[track].x = i; + mcurrent[track].y = j; + } else if (hre.search(infile.token(i, j), R"(^\*omet\([^\)]+\))")) { + ocurrent[track].x = i; + ocurrent[track].y = j; } else if (hre.search(infile.token(i, j), R"(^\*M\d+\d+)")) { current[track] = getLocalMetInfo(infile, i, track); + mcurrent[track] = getLocalMetInfo(infile, i, track, "m"); + ocurrent[track] = getLocalMetInfo(infile, i, track, "o"); } } } @@ -447,8 +461,12 @@ void Tool_myank::getMetStates(vector >& metstates, // metstates[i][j] = current[track]; // } metstates[i].resize(infile.getMaxTrack()+1); + mmetstates[i].resize(infile.getMaxTrack()+1); + ometstates[i].resize(infile.getMaxTrack()+1); for (int j=1; j<=infile.getMaxTrack(); j++) { metstates[i][j] = current[j]; + mmetstates[i][j] = mcurrent[j]; + ometstates[i][j] = ocurrent[j]; } } @@ -477,7 +495,7 @@ void Tool_myank::getMetStates(vector >& metstates, // value if none found. // -MyCoord Tool_myank::getLocalMetInfo(HumdrumFile& infile, int row, int track) { +MyCoord Tool_myank::getLocalMetInfo(HumdrumFile& infile, int row, int track, string prefix) { MyCoord output; int startline = -1; int stopline = -1; @@ -516,7 +534,7 @@ MyCoord Tool_myank::getLocalMetInfo(HumdrumFile& infile, int row, int track) { if (track != xtrac) { continue; } - if (hre.search(infile.token(i, j), R"(^\*met\([^\)]+\))")) { + if (hre.search(infile.token(i, j), R"(^\*)" + prefix + R"(met\([^\)]+\))")) { output.x = i; output.x = j; } @@ -895,6 +913,8 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, int keyQ = 0; int timesigQ = 0; int metQ = 0; + int mmetQ = 0; + int ometQ = 0; int tempoQ = 0; int x, y; @@ -997,6 +1017,30 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, } } + if (!mmetQ && (outmeasures[index].smmet.size() > 0)) { + x = outmeasures[index].smmet[i].x; + y = outmeasures[index].smmet[i].y; + xo = outmeasures[index-1].emmet[i].x; + yo = outmeasures[index-1].emmet[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + mmetQ = 1; + } + } + } + + if (!ometQ && (outmeasures[index].somet.size() > 0)) { + x = outmeasures[index].somet[i].x; + y = outmeasures[index].somet[i].y; + xo = outmeasures[index-1].eomet[i].x; + yo = outmeasures[index-1].eomet[i].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + ometQ = 1; + } + } + } + if (!tempoQ && (outmeasures[index].stempo.size() > 0)) { x = outmeasures[index].stempo[i].x; y = outmeasures[index].stempo[i].y; @@ -1173,6 +1217,52 @@ void Tool_myank::adjustGlobalInterpretations(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mmetQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].smmet[track].x; + y = outmeasures[index].smmet[track].y; + xo = outmeasures[index-1].emmet[track].x; + yo = outmeasures[index-1].emmet[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (ometQ) { + for (int i=0; igetTrack(); + x = outmeasures[index].somet[track].x; + y = outmeasures[index].somet[track].y; + xo = outmeasures[index-1].eomet[track].x; + yo = outmeasures[index-1].eomet[track].y; + if ((x>=0)&&(y>=0)&&(xo>=0)&&(yo>=0)) { + if (*infile.token(x, y) != *infile.token(xo, yo)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (tempoQ) { for (int i=0; igetTrack(); @@ -1221,6 +1311,8 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, int keyQ = 0; int timesigQ = 0; int metQ = 0; + int mmetQ = 0; + int ometQ = 0; int tempoQ = 0; int x, y; @@ -1295,6 +1387,22 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, } } + if (!mmetQ) { + x = outmeasures[index].smmet[i].x; + y = outmeasures[index].smmet[i].y; + if ((x>=0)&&(y>=0)) { + mmetQ = 1; + } + } + + if (!ometQ) { + x = outmeasures[index].somet[i].x; + y = outmeasures[index].somet[i].y; + if ((x>=0)&&(y>=0)) { + ometQ = 1; + } + } + if (!tempoQ) { x = outmeasures[index].stempo[i].x; y = outmeasures[index].stempo[i].y; @@ -1424,6 +1532,40 @@ void Tool_myank::adjustGlobalInterpretationsStart(HumdrumFile& infile, int ii, m_humdrum_text << "\n"; } + if (mmetQ) { + for (i=0; igetTrack(); + x = outmeasures[index].smmet[ptrack].x; + y = outmeasures[index].smmet[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + + if (ometQ) { + for (i=0; igetTrack(); + x = outmeasures[index].somet[ptrack].x; + y = outmeasures[index].somet[ptrack].y; + if ((x>=0)&&(y>=0)) { + m_humdrum_text << infile.token(x, y); + } else { + m_humdrum_text << "*"; + } + if (i < infile[ii].getFieldCount()-1) { + m_humdrum_text << "\t"; + } + } + m_humdrum_text << "\n"; + } + if (tempoQ) { for (i=0; igetTrack(); @@ -2369,6 +2511,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me vector currkey(tracks+1); vector currtimesig(tracks+1); vector currmet(tracks+1); + vector currmmet(tracks+1); + vector curromet(tracks+1); vector currtempo(tracks+1); MyCoord undefMyCoord; @@ -2381,6 +2525,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me fill(currkey.begin(), currkey.end(), undefMyCoord); fill(currtimesig.begin(), currtimesig.end(), undefMyCoord); fill(currmet.begin(), currmet.end(), undefMyCoord); + fill(currmmet.begin(), currmmet.end(), undefMyCoord); + fill(curromet.begin(), curromet.end(), undefMyCoord); fill(currtempo.begin(), currtempo.end(), undefMyCoord); int currmeasure = -1; @@ -2408,6 +2554,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; measurein[inmap[currmeasure]].emet = currmet; + measurein[inmap[currmeasure]].emmet = currmmet; + measurein[inmap[currmeasure]].eomet = curromet; measurein[inmap[currmeasure]].etempo = currtempo; } @@ -2435,6 +2583,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[inmap[currmeasure]].stimesig = currtimesig; // measurein[inmap[currmeasure]].smet = metstates[i]; measurein[inmap[currmeasure]].smet = currmet; + measurein[inmap[currmeasure]].smmet = currmmet; + measurein[inmap[currmeasure]].somet = curromet; measurein[inmap[currmeasure]].stempo = currtempo; } @@ -2470,6 +2620,12 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me } else if (hre.search(infile.token(i, j), R"(^\*met\(.*\))")) { measurein[inmap[currmeasure]].smet[track].x = -1; measurein[inmap[currmeasure]].smet[track].y = -1; + } else if (hre.search(infile.token(i, j), R"(^\*mmet\(.*\))")) { + measurein[inmap[currmeasure]].smmet[track].x = -1; + measurein[inmap[currmeasure]].smmet[track].y = -1; + } else if (hre.search(infile.token(i, j), R"(^\*omet\(.*\))")) { + measurein[inmap[currmeasure]].somet[track].x = -1; + measurein[inmap[currmeasure]].somet[track].y = -1; } else if (hre.search(infile.token(i, j), "^\\*MM\\d+", "i")) { measurein[inmap[currmeasure]].stempo[track].x = -1; measurein[inmap[currmeasure]].stempo[track].y = -1; @@ -2511,6 +2667,16 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me currmet[track].y = j; continue; } + if (hre.search(infile.token(i, j), R"(^\*mmet\(.*\))")) { + currmmet[track].x = i; + currmmet[track].y = j; + continue; + } + if (hre.search(infile.token(i, j), R"(^\*omet\(.*\))")) { + curromet[track].x = i; + curromet[track].y = j; + continue; + } if (hre.search(infile.token(i, j), R"(^\*MM[\d.]+)")) { currtempo[track].x = i; currtempo[track].y = j; @@ -2534,6 +2700,8 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[inmap[currmeasure]].ekey = currkey; measurein[inmap[currmeasure]].etimesig = currtimesig; measurein[inmap[currmeasure]].emet = currmet; + measurein[inmap[currmeasure]].emmet = currmmet; + measurein[inmap[currmeasure]].eomet = curromet; measurein[inmap[currmeasure]].etempo = currtempo; } @@ -2716,18 +2884,50 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me measurein[i].smet.resize(tracks+1); fill(measurein[i].smet.begin(), measurein[i].smet.end(), undefMyCoord); } + if (measurein[i].smmet.size() == 0) { + measurein[i].smmet.resize(tracks+1); + fill(measurein[i].smmet.begin(), measurein[i].smmet.end(), undefMyCoord); + } + if (measurein[i].somet.size() == 0) { + measurein[i].somet.resize(tracks+1); + fill(measurein[i].somet.begin(), measurein[i].somet.end(), undefMyCoord); + } if (measurein[i].emet.size() == 0) { measurein[i].emet.resize(tracks+1); fill(measurein[i].emet.begin(), measurein[i].emet.end(), undefMyCoord); } + if (measurein[i].emmet.size() == 0) { + measurein[i].emmet.resize(tracks+1); + fill(measurein[i].emmet.begin(), measurein[i].emmet.end(), undefMyCoord); + } + if (measurein[i].eomet.size() == 0) { + measurein[i].eomet.resize(tracks+1); + fill(measurein[i].eomet.begin(), measurein[i].eomet.end(), undefMyCoord); + } if (measurein[i+1].smet.size() == 0) { measurein[i+1].smet.resize(tracks+1); fill(measurein[i+1].smet.begin(), measurein[i+1].smet.end(), undefMyCoord); } + if (measurein[i+1].smmet.size() == 0) { + measurein[i+1].smmet.resize(tracks+1); + fill(measurein[i+1].smmet.begin(), measurein[i+1].smmet.end(), undefMyCoord); + } + if (measurein[i+1].somet.size() == 0) { + measurein[i+1].somet.resize(tracks+1); + fill(measurein[i+1].somet.begin(), measurein[i+1].somet.end(), undefMyCoord); + } if (measurein[i+1].emet.size() == 0) { measurein[i+1].emet.resize(tracks+1); fill(measurein[i+1].emet.begin(), measurein[i+1].emet.end(), undefMyCoord); } + if (measurein[i+1].emmet.size() == 0) { + measurein[i+1].emmet.resize(tracks+1); + fill(measurein[i+1].emmet.begin(), measurein[i+1].emmet.end(), undefMyCoord); + } + if (measurein[i+1].eomet.size() == 0) { + measurein[i+1].eomet.resize(tracks+1); + fill(measurein[i+1].eomet.begin(), measurein[i+1].eomet.end(), undefMyCoord); + } for (j=1; j<(int)measurein[i].smet.size(); j++) { if (!measurein[i].emet[j].isValid()) { if (measurein[i].smet[j].isValid()) { @@ -2740,6 +2940,30 @@ void Tool_myank::fillGlobalDefaults(HumdrumFile& infile, vector& me } } } + for (j=1; j<(int)measurein[i].smmet.size(); j++) { + if (!measurein[i].emmet[j].isValid()) { + if (measurein[i].smmet[j].isValid()) { + measurein[i].emmet[j] = measurein[i].smmet[j]; + } + } + if (!measurein[i+1].smmet[j].isValid()) { + if (measurein[i].emmet[j].isValid()) { + measurein[i+1].smmet[j] = measurein[i].emmet[j]; + } + } + } + for (j=1; j<(int)measurein[i].somet.size(); j++) { + if (!measurein[i].eomet[j].isValid()) { + if (measurein[i].somet[j].isValid()) { + measurein[i].eomet[j] = measurein[i].somet[j]; + } + } + if (!measurein[i+1].somet[j].isValid()) { + if (measurein[i].eomet[j].isValid()) { + measurein[i+1].somet[j] = measurein[i].eomet[j]; + } + } + } if (measurein[i].stempo.size() == 0) { measurein[i].stempo.resize(tracks+1); @@ -2846,6 +3070,8 @@ void Tool_myank::processFieldEntry(vector& field, current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; current.smet = inmeasures[inmap[i]].smet; + current.smmet = inmeasures[inmap[i]].smmet; + current.somet = inmeasures[inmap[i]].somet; current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; @@ -2855,6 +3081,8 @@ void Tool_myank::processFieldEntry(vector& field, current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; current.emet = inmeasures[inmap[i]].emet; + current.emmet = inmeasures[inmap[i]].emmet; + current.eomet = inmeasures[inmap[i]].eomet; current.etempo = inmeasures[inmap[i]].etempo; field.push_back(current); @@ -2877,6 +3105,8 @@ void Tool_myank::processFieldEntry(vector& field, current.skey = inmeasures[inmap[i]].skey; current.stimesig = inmeasures[inmap[i]].stimesig; current.smet = inmeasures[inmap[i]].smet; + current.smmet = inmeasures[inmap[i]].smmet; + current.somet = inmeasures[inmap[i]].somet; current.stempo = inmeasures[inmap[i]].stempo; current.eclef = inmeasures[inmap[i]].eclef; @@ -2886,6 +3116,8 @@ void Tool_myank::processFieldEntry(vector& field, current.ekey = inmeasures[inmap[i]].ekey; current.etimesig = inmeasures[inmap[i]].etimesig; current.emet = inmeasures[inmap[i]].emet; + current.emmet = inmeasures[inmap[i]].emmet; + current.eomet = inmeasures[inmap[i]].eomet; current.etempo = inmeasures[inmap[i]].etempo; field.push_back(current); @@ -2917,6 +3149,8 @@ void Tool_myank::processFieldEntry(vector& field, current.skey = inmeasures[inmap[value]].skey; current.stimesig = inmeasures[inmap[value]].stimesig; current.smet = inmeasures[inmap[value]].smet; + current.smmet = inmeasures[inmap[value]].smmet; + current.somet = inmeasures[inmap[value]].somet; current.stempo = inmeasures[inmap[value]].stempo; current.eclef = inmeasures[inmap[value]].eclef; @@ -2926,6 +3160,8 @@ void Tool_myank::processFieldEntry(vector& field, current.ekey = inmeasures[inmap[value]].ekey; current.etimesig = inmeasures[inmap[value]].etimesig; current.emet = inmeasures[inmap[value]].emet; + current.emmet = inmeasures[inmap[value]].emmet; + current.eomet = inmeasures[inmap[value]].eomet; current.etempo = inmeasures[inmap[value]].etempo; field.push_back(current);