Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for meter program #106

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions min/humlib.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Sat Aug 8 12:24:49 PDT 2015
// Last Modified: Fri Nov 22 09:29:17 AM PST 2024
// Last Modified: Fr 13 Dez 2024 22:27:49 CET
// Filename: min/humlib.cpp
// URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.cpp
// Syntax: C++11
Expand Down Expand Up @@ -102498,7 +102498,7 @@ void Tool_meter::processFile(HumdrumFile& infile) {

void Tool_meter::analyzePickupMeasures(HumdrumFile& infile) {
vector<HTp> sstarts;
infile.getKernSpineStartList(sstarts);
infile.getKernLikeSpineStartList(sstarts);
for (int i=0; i<(int)sstarts.size(); i++) {
analyzePickupMeasures(sstarts[i]);
}
Expand Down Expand Up @@ -102571,6 +102571,14 @@ void Tool_meter::analyzePickupMeasures(HTp sstart) {
continue;
}
}
if (bardur.at(i) < tsigdur.at(i)) {
HumRegex hre;
HTp barlineToken = barandtime.at(i).at(0);
if (barlineToken->isBarline() && hre.search(barlineToken, "\\|\\||:?\\|?!\\|?:?")) {
pickup.at(i) = true;
continue;
}
}
}

// check for first-measure pickup
Expand Down Expand Up @@ -102717,7 +102725,7 @@ void Tool_meter::printLabelLine(HumdrumLine& line) {
bool printLabels = true;
for (int i=0; i<line.getFieldCount(); i++) {
HTp token = line.token(i);
if (token->isKern()) {
if (token->isKernLike()) {
i = printKernAndAnalysisSpine(line, i, printLabels, forceInterpretation);
} else {
m_humdrum_text << "*";
Expand All @@ -102740,7 +102748,7 @@ void Tool_meter::printHumdrumLine(HumdrumLine& line, bool printLabels) {

for (int i=0; i<line.getFieldCount(); i++) {
HTp token = line.token(i);
if (token->isKern()) {
if (token->isKernLike()) {
i = printKernAndAnalysisSpine(line, i, printLabels);
} else {
m_humdrum_text << token;
Expand Down Expand Up @@ -102914,6 +102922,9 @@ int Tool_meter::printKernAndAnalysisSpine(HumdrumLine& line, int index, bool pri
meter = "*-";
} else if (token->isTimeSignature()) {
analysis = *token;
numerator = *token;
denominator = *token;
meter = *token;
} else {
analysis = "*";
numerator = "*";
Expand Down Expand Up @@ -103046,7 +103057,7 @@ void Tool_meter::processLine(HumdrumLine& line, vector<HumNum>& curNum,
if (line.isBarline()) {
for (int i=0; i<fieldCount; i++) {
HTp token = line.token(i);
if (!token->isKern()) {
if (!token->isKernLike()) {
continue;
}
if (hre.search(token, "-")) {
Expand All @@ -103064,7 +103075,7 @@ void Tool_meter::processLine(HumdrumLine& line, vector<HumNum>& curNum,
// check for time signatures
for (int i=0; i<fieldCount; i++) {
HTp token = line.token(i);
if (!token->isKern()) {
if (!token->isKernLike()) {
continue;
}
if (hre.search(token, "^\\*M(\\d+)/(\\d+)")) {
Expand All @@ -103087,7 +103098,7 @@ void Tool_meter::processLine(HumdrumLine& line, vector<HumNum>& curNum,
// check for time signatures
for (int i=0; i<fieldCount; i++) {
HTp token = line.token(i);
if (!token->isKern()) {
if (!token->isKernLike()) {
continue;
}
if (token->isNull()) {
Expand Down
2 changes: 1 addition & 1 deletion min/humlib.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Sat Aug 8 12:24:49 PDT 2015
// Last Modified: Fri Nov 22 09:29:17 AM PST 2024
// Last Modified: Fr 13 Dez 2024 22:27:49 CET
// Filename: min/humlib.h
// URL: https://github.com/craigsapp/humlib/blob/master/min/humlib.h
// Syntax: C++11
Expand Down
23 changes: 17 additions & 6 deletions src/tool-meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void Tool_meter::processFile(HumdrumFile& infile) {

void Tool_meter::analyzePickupMeasures(HumdrumFile& infile) {
vector<HTp> sstarts;
infile.getKernSpineStartList(sstarts);
infile.getKernLikeSpineStartList(sstarts);
for (int i=0; i<(int)sstarts.size(); i++) {
analyzePickupMeasures(sstarts[i]);
}
Expand Down Expand Up @@ -268,6 +268,14 @@ void Tool_meter::analyzePickupMeasures(HTp sstart) {
continue;
}
}
if (bardur.at(i) < tsigdur.at(i)) {
HumRegex hre;
HTp barlineToken = barandtime.at(i).at(0);
if (barlineToken->isBarline() && hre.search(barlineToken, "\\|\\||:?\\|?!\\|?:?")) {
pickup.at(i) = true;
continue;
}
}
}

// check for first-measure pickup
Expand Down Expand Up @@ -414,7 +422,7 @@ void Tool_meter::printLabelLine(HumdrumLine& line) {
bool printLabels = true;
for (int i=0; i<line.getFieldCount(); i++) {
HTp token = line.token(i);
if (token->isKern()) {
if (token->isKernLike()) {
i = printKernAndAnalysisSpine(line, i, printLabels, forceInterpretation);
} else {
m_humdrum_text << "*";
Expand All @@ -437,7 +445,7 @@ void Tool_meter::printHumdrumLine(HumdrumLine& line, bool printLabels) {

for (int i=0; i<line.getFieldCount(); i++) {
HTp token = line.token(i);
if (token->isKern()) {
if (token->isKernLike()) {
i = printKernAndAnalysisSpine(line, i, printLabels);
} else {
m_humdrum_text << token;
Expand Down Expand Up @@ -611,6 +619,9 @@ int Tool_meter::printKernAndAnalysisSpine(HumdrumLine& line, int index, bool pri
meter = "*-";
} else if (token->isTimeSignature()) {
analysis = *token;
numerator = *token;
denominator = *token;
meter = *token;
} else {
analysis = "*";
numerator = "*";
Expand Down Expand Up @@ -743,7 +754,7 @@ void Tool_meter::processLine(HumdrumLine& line, vector<HumNum>& curNum,
if (line.isBarline()) {
for (int i=0; i<fieldCount; i++) {
HTp token = line.token(i);
if (!token->isKern()) {
if (!token->isKernLike()) {
continue;
}
if (hre.search(token, "-")) {
Expand All @@ -761,7 +772,7 @@ void Tool_meter::processLine(HumdrumLine& line, vector<HumNum>& curNum,
// check for time signatures
for (int i=0; i<fieldCount; i++) {
HTp token = line.token(i);
if (!token->isKern()) {
if (!token->isKernLike()) {
continue;
}
if (hre.search(token, "^\\*M(\\d+)/(\\d+)")) {
Expand All @@ -784,7 +795,7 @@ void Tool_meter::processLine(HumdrumLine& line, vector<HumNum>& curNum,
// check for time signatures
for (int i=0; i<fieldCount; i++) {
HTp token = line.token(i);
if (!token->isKern()) {
if (!token->isKernLike()) {
continue;
}
if (token->isNull()) {
Expand Down