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

Improve option names #64

Merged
merged 4 commits into from
Jan 23, 2023
Merged
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
6 changes: 3 additions & 3 deletions include/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: Sa 21 Jan 2023 09:48:51 CET
// Last Modified: Mo 23 Jan 2023 17:20:50 CET
// Filename: humlib.h
// URL: https://github.com/craigsapp/humlib/blob/master/include/humlib.h
// Syntax: C++11
Expand Down Expand Up @@ -7302,13 +7302,13 @@ class Tool_fb : public HumTool {
bool m_sortQ = false;
bool m_lowestQ = false;
bool m_normalizeQ = false;
bool m_abbrQ = false;
bool m_abbreviateQ = false;
bool m_attackQ = false;
bool m_figuredbassQ = false;
bool m_hideThreeQ = false;
bool m_showNegativeQ = false;
bool m_aboveQ = false;
string m_recipQ = "";
string m_rateQ = "";

string m_spineTracks = ""; // used with -s option
string m_kernTracks = ""; // used with -k option
Expand Down
4 changes: 2 additions & 2 deletions include/tool-fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ class Tool_fb : public HumTool {
bool m_sortQ = false;
bool m_lowestQ = false;
bool m_normalizeQ = false;
bool m_abbrQ = false;
bool m_abbreviateQ = false;
bool m_attackQ = false;
bool m_figuredbassQ = false;
bool m_hideThreeQ = false;
bool m_showNegativeQ = false;
bool m_aboveQ = false;
string m_recipQ = "";
string m_rateQ = "";

string m_spineTracks = ""; // used with -s option
string m_kernTracks = ""; // used with -k option
Expand Down
30 changes: 15 additions & 15 deletions src/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: Sa 21 Jan 2023 09:48:51 CET
// Last Modified: Mo 23 Jan 2023 17:20:50 CET
// Filename: /include/humlib.cpp
// URL: https://github.com/craigsapp/humlib/blob/master/src/humlib.cpp
// Syntax: C++11
Expand Down Expand Up @@ -78038,13 +78038,13 @@ Tool_fb::Tool_fb(void) {
define("o|sort|order=b", "sort figured bass numbers by interval size and not by voice index");
define("l|lowest=b", "use lowest note as base note; -b flag will be ignored");
define("n|normalize=b", "remove octave and doubled intervals; adds: --compound --sort");
define("r|abbr=b", "use abbreviated figures; adds: --normalize --compound --sort");
define("r|abbreviate=b", "use abbreviated figures; adds: --normalize --compound --sort");
define("t|ties=b", "hide repeated numbers for sustained notes when base does not change");
define("f|figuredbass=b", "shortcut for -c -a -o -n -r -3");
define("3|hide-three=b", "hide number 3 if it has an accidental (e.g.: #3 => #)");
define("m|negative=b", "show negative numbers");
define("above=b", "place figured bass numbers above staff (**fba)");
define("frequency|recip=s:", "frequency to display the numbers (set a **recip value, e.g. 2, 4, 8, 4.)");
define("rate=s:", "rate to display the numbers (set a **recip value, e.g. 2, 4, 8, 4.)");
define("k|kern-tracks=s", "Process only the specified kern spines");
define("s|spine-tracks|spine|spines|track|tracks=s", "Process only the specified spines");
}
Expand Down Expand Up @@ -78106,13 +78106,13 @@ void Tool_fb::initialize(void) {
m_sortQ = getBoolean("sort");
m_lowestQ = getBoolean("lowest");
m_normalizeQ = getBoolean("normalize");
m_abbrQ = getBoolean("abbr");
m_abbreviateQ = getBoolean("abbreviate");
m_attackQ = getBoolean("ties");
m_figuredbassQ = getBoolean("figuredbass");
m_hideThreeQ = getBoolean("hide-three");
m_showNegativeQ = getBoolean("negative");
m_aboveQ = getBoolean("above");
m_recipQ = getString("frequency");
m_rateQ = getString("rate");

if (getBoolean("spine-tracks")) {
m_spineTracks = getString("spine-tracks");
Expand All @@ -78125,14 +78125,14 @@ void Tool_fb::initialize(void) {
m_sortQ = true;
}

if (m_abbrQ) {
if (m_abbreviateQ) {
m_normalizeQ = true;
m_compoundQ = true;
m_sortQ = true;
}

if (m_figuredbassQ) {
m_abbrQ = true;
m_abbreviateQ = true;
m_normalizeQ = true;
m_compoundQ = true;
m_sortQ = true;
Expand Down Expand Up @@ -78236,8 +78236,8 @@ void Tool_fb::processFile(HumdrumFile& infile) {

string keySignature = getKeySignature(infile, baseCell->getLineIndex());

// Hide numbers if they do not match rhythmic position of --recip
if (!m_recipQ.empty()) {
// Hide numbers if they do not match rhythmic position of --rate
if (!m_rateQ.empty()) {
// Get time signatures
vector<pair<int, HumNum>> timeSigs;
infile.getTimeSigs(timeSigs, baseCell->getToken()->getTrack());
Expand Down Expand Up @@ -78380,9 +78380,9 @@ void Tool_fb::processFile(HumdrumFile& infile) {
//

bool Tool_fb::hideNumbersForTokenLine(HTp token, pair<int, HumNum> timeSig) {
// Get note duration from --recip option
HumNum recip = Convert::recipToDuration(m_recipQ);
if (recip.toFloat() != 0) {
// Get note duration from --rate option
HumNum rateDuration = Convert::recipToDuration(m_rateQ);
if (rateDuration.toFloat() != 0) {
float timeSigBarDuration = timeSig.first * Convert::recipToDuration(to_string(timeSig.second.getInteger())).toFloat();
float durationFromBarline = token->getDurationFromBarline().toFloat();
// Handle upbeats
Expand All @@ -78391,8 +78391,8 @@ bool Tool_fb::hideNumbersForTokenLine(HTp token, pair<int, HumNum> timeSig) {
// the bar duration of the time signature
durationFromBarline = timeSigBarDuration - token->getDurationToBarline().toFloat();
}
// Checks if rhythmic position is divisible by recip duration
return fmod(durationFromBarline, recip.toFloat()) != 0;
// Checks if rhythmic position is divisible by rateDuration
return fmod(durationFromBarline, rateDuration.toFloat()) != 0;
}
return false;
}
Expand Down Expand Up @@ -78634,7 +78634,7 @@ string Tool_fb::formatFiguredBassNumbers(const vector<FiguredBassNumber*>& numbe
});
}

if (m_abbrQ) {
if (m_abbreviateQ) {
// Overwrite formattedNumbers with abbreviated numbers
formattedNumbers = getAbbreviatedNumbers(formattedNumbers);
}
Expand Down
28 changes: 14 additions & 14 deletions src/tool-fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Tool_fb::Tool_fb(void) {
define("o|sort|order=b", "sort figured bass numbers by interval size and not by voice index");
define("l|lowest=b", "use lowest note as base note; -b flag will be ignored");
define("n|normalize=b", "remove octave and doubled intervals; adds: --compound --sort");
define("r|abbr=b", "use abbreviated figures; adds: --normalize --compound --sort");
define("r|abbreviate=b", "use abbreviated figures; adds: --normalize --compound --sort");
define("t|ties=b", "hide repeated numbers for sustained notes when base does not change");
define("f|figuredbass=b", "shortcut for -c -a -o -n -r -3");
define("3|hide-three=b", "hide number 3 if it has an accidental (e.g.: #3 => #)");
define("m|negative=b", "show negative numbers");
define("above=b", "place figured bass numbers above staff (**fba)");
define("frequency|recip=s:", "frequency to display the numbers (set a **recip value, e.g. 2, 4, 8, 4.)");
define("rate=s:", "rate to display the numbers (set a **recip value, e.g. 2, 4, 8, 4.)");
define("k|kern-tracks=s", "Process only the specified kern spines");
define("s|spine-tracks|spine|spines|track|tracks=s", "Process only the specified spines");
}
Expand Down Expand Up @@ -102,13 +102,13 @@ void Tool_fb::initialize(void) {
m_sortQ = getBoolean("sort");
m_lowestQ = getBoolean("lowest");
m_normalizeQ = getBoolean("normalize");
m_abbrQ = getBoolean("abbr");
m_abbreviateQ = getBoolean("abbreviate");
m_attackQ = getBoolean("ties");
m_figuredbassQ = getBoolean("figuredbass");
m_hideThreeQ = getBoolean("hide-three");
m_showNegativeQ = getBoolean("negative");
m_aboveQ = getBoolean("above");
m_recipQ = getString("frequency");
m_rateQ = getString("rate");

if (getBoolean("spine-tracks")) {
m_spineTracks = getString("spine-tracks");
Expand All @@ -121,14 +121,14 @@ void Tool_fb::initialize(void) {
m_sortQ = true;
}

if (m_abbrQ) {
if (m_abbreviateQ) {
m_normalizeQ = true;
m_compoundQ = true;
m_sortQ = true;
}

if (m_figuredbassQ) {
m_abbrQ = true;
m_abbreviateQ = true;
m_normalizeQ = true;
m_compoundQ = true;
m_sortQ = true;
Expand Down Expand Up @@ -232,8 +232,8 @@ void Tool_fb::processFile(HumdrumFile& infile) {

string keySignature = getKeySignature(infile, baseCell->getLineIndex());

// Hide numbers if they do not match rhythmic position of --recip
if (!m_recipQ.empty()) {
// Hide numbers if they do not match rhythmic position of --rate
if (!m_rateQ.empty()) {
// Get time signatures
vector<pair<int, HumNum>> timeSigs;
infile.getTimeSigs(timeSigs, baseCell->getToken()->getTrack());
Expand Down Expand Up @@ -376,9 +376,9 @@ void Tool_fb::processFile(HumdrumFile& infile) {
//

bool Tool_fb::hideNumbersForTokenLine(HTp token, pair<int, HumNum> timeSig) {
// Get note duration from --recip option
HumNum recip = Convert::recipToDuration(m_recipQ);
if (recip.toFloat() != 0) {
// Get note duration from --rate option
HumNum rateDuration = Convert::recipToDuration(m_rateQ);
if (rateDuration.toFloat() != 0) {
float timeSigBarDuration = timeSig.first * Convert::recipToDuration(to_string(timeSig.second.getInteger())).toFloat();
float durationFromBarline = token->getDurationFromBarline().toFloat();
// Handle upbeats
Expand All @@ -387,8 +387,8 @@ bool Tool_fb::hideNumbersForTokenLine(HTp token, pair<int, HumNum> timeSig) {
// the bar duration of the time signature
durationFromBarline = timeSigBarDuration - token->getDurationToBarline().toFloat();
}
// Checks if rhythmic position is divisible by recip duration
return fmod(durationFromBarline, recip.toFloat()) != 0;
// Checks if rhythmic position is divisible by rateDuration
return fmod(durationFromBarline, rateDuration.toFloat()) != 0;
}
return false;
}
Expand Down Expand Up @@ -630,7 +630,7 @@ string Tool_fb::formatFiguredBassNumbers(const vector<FiguredBassNumber*>& numbe
});
}

if (m_abbrQ) {
if (m_abbreviateQ) {
// Overwrite formattedNumbers with abbreviated numbers
formattedNumbers = getAbbreviatedNumbers(formattedNumbers);
}
Expand Down