Skip to content

Commit

Permalink
Merge branch 'develop-mensural' into develop-cmme
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/alignfunctor.cpp
#	src/durationinterface.cpp
#	src/horizontalaligner.cpp
#	src/layerelement.cpp
  • Loading branch information
lpugin committed Oct 7, 2024
2 parents d58072e + 8a846f2 commit 1911f3d
Show file tree
Hide file tree
Showing 8 changed files with 2,156 additions and 37,374 deletions.
405 changes: 85 additions & 320 deletions data/Gootville.xml

Large diffs are not rendered by default.

39,076 changes: 2,038 additions & 37,038 deletions fonts/Gootville/gootville_metadata.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion include/vrv/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ enum option_SMUFLTEXTFONT { SMUFLTEXTFONT_embedded = 0, SMUFLTEXTFONT_linked, SM
// Option
//----------------------------------------------------------------------------

enum class OptionsCategory { None, Base, General, Layout, Mensural, Margins, Midi, Selectors, Full };
enum class OptionsCategory { None, Base, General, Json, Layout, Mensural, Margins, Midi, Selectors, Full };

/**
* This class is a base class of each styling parameter
Expand Down Expand Up @@ -842,6 +842,13 @@ class Options {
OptionBool m_ligatureAsBracket;
OptionBool m_mensuralToMeasure;

/**
* Additional options for passing method JSON options to the command-line
*/
OptionGrp m_jsonCmdLineOptions;

OptionString m_timemapOptions;

/**
* Deprecated options
*/
Expand Down
6 changes: 3 additions & 3 deletions src/horizontalaligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Fraction::Fraction(int num, int denom) : m_numerator(num), m_denominator(denom)

Fraction::Fraction(data_DURATION duration)
{
duration = vrv::DurationMin(duration, DURATION_1024);
duration = vrv::DurationMax(duration, DURATION_NONE);
duration = vrv::DurationMin(duration, DURATION_2048);
duration = vrv::DurationMax(duration, DURATION_maxima);
int den = pow(2, (duration + 1));
m_numerator = 8;
m_denominator = den;
Expand Down Expand Up @@ -91,7 +91,7 @@ Fraction Fraction::operator/(const Fraction &other) const

bool Fraction::operator==(const Fraction &other) const
{
return (m_numerator == other.m_numerator) && (m_denominator == other.m_denominator);
return m_numerator * other.m_denominator == other.m_numerator * m_denominator;
}

bool Fraction::operator<(const Fraction &other) const
Expand Down
6 changes: 3 additions & 3 deletions src/layerelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,9 @@ Fraction LayerElement::GetAlignmentDuration(
if (objects.size() > 0) {
num = tuplet->GetNum();
numbase = tuplet->GetNumbase();
// 0 is not valid in MEI anyway - just correct it silently
if (num == 0) num = 1;
if (numbase == 0) numbase = 1;
// Adjust VRV_UNSET and 0 - which is not valid in MEI anyway
num = std::max(1, num);
numbase = std::max(1, numbase);
}
}
const DurationInterface *duration = this->GetDurationInterface();
Expand Down
14 changes: 12 additions & 2 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ Options::Options()
m_topMarginPgFooter.Init(2.0, 0.0, 24.0);
this->Register(&m_topMarginPgFooter, "topMarginPgFooter", &m_elementMargins);

/********* midi *********/
/********* MIDI *********/

m_midi.SetLabel("Midi options", "5-midi");
m_midi.SetCategory(OptionsCategory::Midi);
Expand All @@ -1813,7 +1813,7 @@ Options::Options()
m_midiTempoAdjustment.Init(1.0, 0.2, 4.0);
this->Register(&m_midiTempoAdjustment, "midiTempoAdjustment", &m_midi);

/********* General *********/
/********* Mensural *********/

m_mensural.SetLabel("Mensural notation options", "6-mensural");
m_mensural.SetCategory(OptionsCategory::Mensural);
Expand All @@ -1827,6 +1827,16 @@ Options::Options()
m_mensuralToMeasure.Init(false);
this->Register(&m_mensuralToMeasure, "mensuralToMeasure", &m_mensural);

/********* Method JSON options to the command-line *********/

m_jsonCmdLineOptions.SetLabel("Method JSON options for the command-line", "7-methodJson");
m_jsonCmdLineOptions.SetCategory(OptionsCategory::Json);
m_grps.push_back(&m_jsonCmdLineOptions);

m_timemapOptions.SetInfo("Timemap options", "The JSON options to be passed when producing the timemap");
m_timemapOptions.Init("{}");
this->Register(&m_timemapOptions, "timemapOptions", &m_jsonCmdLineOptions);

/********* Deprecated options *********/

/*
Expand Down
10 changes: 5 additions & 5 deletions src/toolkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,11 +1313,11 @@ void Toolkit::PrintOptionUsageOutput(const vrv::Option *option, std::ostream &ou
void Toolkit::PrintOptionUsage(const std::string &category, std::ostream &output) const
{
// map of all categories and expected string arguments for them
const std::map<vrv::OptionsCategory, std::string> categories
= { { vrv::OptionsCategory::Base, "base" }, { vrv::OptionsCategory::General, "general" },
{ vrv::OptionsCategory::Layout, "layout" }, { vrv::OptionsCategory::Margins, "margins" },
{ vrv::OptionsCategory::Mensural, "mensural" }, { vrv::OptionsCategory::Midi, "midi" },
{ vrv::OptionsCategory::Selectors, "selectors" }, { vrv::OptionsCategory::Full, "full" } };
const std::map<vrv::OptionsCategory, std::string> categories = { { vrv::OptionsCategory::Base, "base" },
{ vrv::OptionsCategory::General, "general" }, { vrv::OptionsCategory::Json, "json" },
{ vrv::OptionsCategory::Layout, "layout" }, { vrv::OptionsCategory::Margins, "margins" },
{ vrv::OptionsCategory::Mensural, "mensural" }, { vrv::OptionsCategory::Midi, "midi" },
{ vrv::OptionsCategory::Selectors, "selectors" }, { vrv::OptionsCategory::Full, "full" } };

output.precision(2);
// display_version();
Expand Down
4 changes: 2 additions & 2 deletions tools/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ int main(int argc, char **argv)
outfile += ".json";
if (std_output) {
std::string output;
std::cout << toolkit.RenderToTimemap();
std::cout << toolkit.RenderToTimemap(options->m_timemapOptions.GetValue());
}
else if (!toolkit.RenderToTimemapFile(outfile)) {
else if (!toolkit.RenderToTimemapFile(outfile, options->m_timemapOptions.GetValue())) {
std::cerr << "Unable to write timemap to " << outfile << "." << std::endl;
exit(1);
}
Expand Down

0 comments on commit 1911f3d

Please sign in to comment.