diff --git a/include/vrv/alignfunctor.h b/include/vrv/alignfunctor.h index 78d4f841e4f..cd4dabf1757 100644 --- a/include/vrv/alignfunctor.h +++ b/include/vrv/alignfunctor.h @@ -12,6 +12,20 @@ namespace vrv { +class Mensur; +class MeterSig; + +//---------------------------------------------------------------------------- +// AlignmentParams +//---------------------------------------------------------------------------- +/** + * Regroup pointers to meterSig, mensur and proport objects + */ +struct AlignMeterParams { + const MeterSig *meterSig; + const Mensur *mensur; +}; + //---------------------------------------------------------------------------- // AlignHorizontallyFunctor //---------------------------------------------------------------------------- @@ -62,10 +76,8 @@ class AlignHorizontallyFunctor : public DocFunctor { MeasureAligner *m_measureAligner; // The time double m_time; - // The current Mensur - Mensur *m_currentMensur; - // The current MeterSig - MeterSig *m_currentMeterSig; + // The current MeterSig, Mensur and Proport + AlignMeterParams m_currentParams; // The current notation type data_NOTATIONTYPE m_notationType; // Indicates the state in processing the caution scoreDef diff --git a/include/vrv/findlayerelementsfunctor.h b/include/vrv/findlayerelementsfunctor.h index 50e6bde99fb..8d1ec87b1a1 100644 --- a/include/vrv/findlayerelementsfunctor.h +++ b/include/vrv/findlayerelementsfunctor.h @@ -10,6 +10,10 @@ #include "functor.h" +//---------------------------------------------------------------------------- + +#include "alignfunctor.h" + namespace vrv { //---------------------------------------------------------------------------- @@ -66,10 +70,8 @@ class LayersInTimeSpanFunctor : public ConstFunctor { double m_duration; // The layers (layerN) found std::set m_layers; - // The current meter signature - const MeterSig *m_meterSig; - // The current mensur - const Mensur *m_mensur; + // The current time alignment parameters + AlignMeterParams m_meterParams; }; //---------------------------------------------------------------------------- @@ -129,10 +131,8 @@ class LayerElementsInTimeSpanFunctor : public ConstFunctor { double m_duration; // The list of layer elements found ListOfConstObjects m_elements; - // The current meter signature - const MeterSig *m_meterSig; - // The current mensur - const Mensur *m_mensur; + // The current time alignment parameters + AlignMeterParams m_meterParams; // The layer to consider const Layer *m_layer; // ... or to ignore diff --git a/include/vrv/layerelement.h b/include/vrv/layerelement.h index 08fea261efe..80d8b26c541 100644 --- a/include/vrv/layerelement.h +++ b/include/vrv/layerelement.h @@ -20,6 +20,7 @@ namespace vrv { class Alignment; +class AlignMeterParams; class Beam; class BeamElementCoord; class FTrem; @@ -258,19 +259,28 @@ class LayerElement : public Object, ///@} /** - * Returns the duration if the element has a DurationInterface + * Return the duration if the element has a DurationInterface. */ - double GetAlignmentDuration(const Mensur *mensur = NULL, const MeterSig *meterSig = NULL, bool notGraceOnly = true, + double GetAlignmentDuration(const AlignMeterParams ¶ms, bool notGraceOnly = true, data_NOTATIONTYPE notationType = NOTATIONTYPE_cmn) const; /** - * Returns the duration if the content of the layer element with a @sameas attribute. + * Return the duration if the element has a DurationInterface. + * Shortcut assigning default values for AlignParameter. + */ + double GetAlignmentDuration(bool notGraceOnly = true, data_NOTATIONTYPE notationType = NOTATIONTYPE_cmn) const; + + /** + * Return the duration if the content of the layer element with a @sameas attribute. * Used only on beam, tuplet or ftrem have. */ - double GetSameAsContentAlignmentDuration(const Mensur *mensur = NULL, const MeterSig *meterSig = NULL, - bool notGraceOnly = true, data_NOTATIONTYPE notationType = NOTATIONTYPE_cmn) const; + double GetSameAsContentAlignmentDuration(const AlignMeterParams ¶ms, bool notGraceOnly = true, + data_NOTATIONTYPE notationType = NOTATIONTYPE_cmn) const; + + double GetContentAlignmentDuration(const AlignMeterParams ¶ms, bool notGraceOnly = true, + data_NOTATIONTYPE notationType = NOTATIONTYPE_cmn) const; - double GetContentAlignmentDuration(const Mensur *mensur = NULL, const MeterSig *meterSig = NULL, + double GetContentAlignmentDuration( bool notGraceOnly = true, data_NOTATIONTYPE notationType = NOTATIONTYPE_cmn) const; /** diff --git a/include/vrv/midifunctor.h b/include/vrv/midifunctor.h index 2e7ade355fa..8d7600bdf10 100644 --- a/include/vrv/midifunctor.h +++ b/include/vrv/midifunctor.h @@ -10,6 +10,10 @@ #include "functor.h" +//---------------------------------------------------------------------------- + +#include "alignfunctor.h" + namespace smf { class MidiFile; } @@ -64,10 +68,8 @@ class InitOnsetOffsetFunctor : public Functor { double m_currentScoreTime; // The current real time in seconds in the measure (incremented by each element) double m_currentRealTimeSeconds; - // The current Mensur - Mensur *m_currentMensur; - // The current MeterSig - MeterSig *m_currentMeterSig; + // The current time alignment parameters + AlignMeterParams m_meterParams; // The current notation type data_NOTATIONTYPE m_notationType; // The current tempo diff --git a/src/alignfunctor.cpp b/src/alignfunctor.cpp index c3877c156ee..779518f07de 100644 --- a/src/alignfunctor.cpp +++ b/src/alignfunctor.cpp @@ -41,8 +41,8 @@ AlignHorizontallyFunctor::AlignHorizontallyFunctor(Doc *doc) : DocFunctor(doc) { m_measureAligner = NULL; m_time = 0.0; - m_currentMensur = NULL; - m_currentMeterSig = NULL; + m_currentParams.mensur = NULL; + m_currentParams.meterSig = NULL; m_notationType = NOTATIONTYPE_cmn; m_scoreDefRole = SCOREDEF_NONE; m_isFirstMeasure = false; @@ -51,8 +51,8 @@ AlignHorizontallyFunctor::AlignHorizontallyFunctor(Doc *doc) : DocFunctor(doc) FunctorCode AlignHorizontallyFunctor::VisitLayer(Layer *layer) { - m_currentMensur = layer->GetCurrentMensur(); - m_currentMeterSig = layer->GetCurrentMeterSig(); + m_currentParams.mensur = layer->GetCurrentMensur(); + m_currentParams.meterSig = layer->GetCurrentMeterSig(); // We are starting a new layer, reset the time; // We set it to -1.0 for the scoreDef attributes since they have to be aligned before any timestamp event (-1.0) @@ -169,16 +169,14 @@ FunctorCode AlignHorizontallyFunctor::VisitLayerElement(LayerElement *layerEleme Alignment *alignment = firstNote->GetAlignment(); layerElement->SetAlignment(alignment); alignment->AddLayerElementRef(layerElement); - double duration - = layerElement->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + double duration = layerElement->GetAlignmentDuration(m_currentParams, true, m_notationType); m_time += duration; return FUNCTOR_CONTINUE; } } // We do not align these (container). Any other? else if (layerElement->Is({ BEAM, LIGATURE, FTREM, TUPLET })) { - double duration - = layerElement->GetSameAsContentAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + double duration = layerElement->GetSameAsContentAlignmentDuration(m_currentParams, true, m_notationType); m_time += duration; return FUNCTOR_CONTINUE; } @@ -213,8 +211,8 @@ FunctorCode AlignHorizontallyFunctor::VisitLayerElement(LayerElement *layerEleme type = ALIGNMENT_SCOREDEF_CAUTION_MENSUR; else { // replace the current mensur - m_currentMensur = vrv_cast(layerElement); - assert(m_currentMensur); + m_currentParams.mensur = vrv_cast(layerElement); + assert(m_currentParams.mensur); type = ALIGNMENT_MENSUR; } } @@ -228,8 +226,8 @@ FunctorCode AlignHorizontallyFunctor::VisitLayerElement(LayerElement *layerEleme type = ALIGNMENT_SCOREDEF_METERSIG; else { // replace the current meter signature - m_currentMeterSig = vrv_cast(layerElement); - assert(m_currentMeterSig); + m_currentParams.meterSig = vrv_cast(layerElement); + assert(m_currentParams.meterSig); // type = ALIGNMENT_METERSIG // We force this because they should appear only at the beginning of a measure and should be non-justifiable // We also need it because the PAE importer creates meterSig (and not staffDef @meter) @@ -310,7 +308,7 @@ FunctorCode AlignHorizontallyFunctor::VisitLayerElement(LayerElement *layerEleme // We have already an alignment with grace note children - skip this if (!layerElement->GetAlignment()) { // get the duration of the event - duration = layerElement->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + duration = layerElement->GetAlignmentDuration(m_currentParams, true, m_notationType); // For timestamp, what we get from GetAlignmentDuration is actually the position of the timestamp // So use it as current time - we can do this because the timestamp loop is redirected from the measure @@ -378,7 +376,7 @@ FunctorCode AlignHorizontallyFunctor::VisitMeasure(Measure *measure) FunctorCode AlignHorizontallyFunctor::VisitMeasureEnd(Measure *measure) { - int meterUnit = m_currentMeterSig ? m_currentMeterSig->GetUnit() : 4; + int meterUnit = m_currentParams.meterSig ? m_currentParams.meterSig->GetUnit() : 4; measure->m_measureAligner.SetInitialTstamp(meterUnit); // We also need to align the timestamps - we do it at the end since we need the *meterSig to be initialized by a diff --git a/src/findlayerelementsfunctor.cpp b/src/findlayerelementsfunctor.cpp index 8ffc22c4609..8c5b53fe942 100644 --- a/src/findlayerelementsfunctor.cpp +++ b/src/findlayerelementsfunctor.cpp @@ -9,6 +9,7 @@ //---------------------------------------------------------------------------- +#include "alignfunctor.h" #include "layer.h" #include "layerelement.h" #include "staff.h" @@ -23,8 +24,8 @@ LayersInTimeSpanFunctor::LayersInTimeSpanFunctor(const MeterSig *meterSig, const { m_time = 0.0; m_duration = 0.0; - m_meterSig = meterSig; - m_mensur = mensur; + m_meterParams.meterSig = meterSig; + m_meterParams.mensur = mensur; } void LayersInTimeSpanFunctor::SetEvent(double time, double duration) @@ -50,7 +51,7 @@ FunctorCode LayersInTimeSpanFunctor::VisitLayerElement(const LayerElement *layer return FUNCTOR_CONTINUE; if (layerElement->Is(NOTE) && layerElement->GetParent()->Is(CHORD)) return FUNCTOR_CONTINUE; - double duration = layerElement->GetAlignmentDuration(m_mensur, m_meterSig); + double duration = layerElement->GetAlignmentDuration(m_meterParams); double time = layerElement->GetAlignment()->GetTime(); // The event is starting after the end of the element @@ -71,14 +72,14 @@ FunctorCode LayersInTimeSpanFunctor::VisitLayerElement(const LayerElement *layer FunctorCode LayersInTimeSpanFunctor::VisitMensur(const Mensur *mensur) { - m_mensur = mensur; + m_meterParams.mensur = mensur; return FUNCTOR_CONTINUE; } FunctorCode LayersInTimeSpanFunctor::VisitMeterSig(const MeterSig *meterSig) { - m_meterSig = meterSig; + m_meterParams.meterSig = meterSig; return FUNCTOR_CONTINUE; } @@ -93,8 +94,8 @@ LayerElementsInTimeSpanFunctor::LayerElementsInTimeSpanFunctor( { m_time = 0.0; m_duration = 0.0; - m_meterSig = meterSig; - m_mensur = mensur; + m_meterParams.meterSig = meterSig; + m_meterParams.mensur = mensur; m_layer = layer; m_allLayersButCurrent = false; } @@ -124,8 +125,8 @@ FunctorCode LayerElementsInTimeSpanFunctor::VisitLayerElement(const LayerElement if (!layerElement->GetDurationInterface() || layerElement->Is({ MSPACE, SPACE })) return FUNCTOR_CONTINUE; const double duration = !layerElement->GetFirstAncestor(CHORD) - ? layerElement->GetAlignmentDuration(m_mensur, m_meterSig) - : vrv_cast(layerElement->GetFirstAncestor(CHORD))->GetAlignmentDuration(m_mensur, m_meterSig); + ? layerElement->GetAlignmentDuration(m_meterParams) + : vrv_cast(layerElement->GetFirstAncestor(CHORD))->GetAlignmentDuration(m_meterParams); const double time = layerElement->GetAlignment()->GetTime(); diff --git a/src/horizontalaligner.cpp b/src/horizontalaligner.cpp index 676eb8ef54b..f827ed30177 100644 --- a/src/horizontalaligner.cpp +++ b/src/horizontalaligner.cpp @@ -397,7 +397,7 @@ void GraceAligner::AlignStack() LayerElement *element = vrv_cast(m_graceStack.at(i - 1)); assert(element); // get the duration of the event - double duration = element->GetAlignmentDuration(NULL, NULL, false); + double duration = element->GetAlignmentDuration(false); // Time goes backward with grace notes time -= duration; Alignment *alignment = this->GetAlignmentAtTime(time, ALIGNMENT_DEFAULT); diff --git a/src/iopae.cpp b/src/iopae.cpp index e332f6db032..7f7cf315322 100644 --- a/src/iopae.cpp +++ b/src/iopae.cpp @@ -521,7 +521,7 @@ void PAEOutput::WriteTuplet(Tuplet *tuplet) Staff *staff = tuplet->GetAncestorStaff(); - double content = tuplet->GetContentAlignmentDuration(NULL, NULL, true, staff->m_drawingNotationType); + double content = tuplet->GetContentAlignmentDuration(true, staff->m_drawingNotationType); // content = DUR_MAX / 2^(dur - 2) int tupletDur = (content != 0.0) ? log2(DUR_MAX / content) + 2 : 4; // We should be looking for dotted values diff --git a/src/layerelement.cpp b/src/layerelement.cpp index 78cae4a13e8..454c91fd311 100644 --- a/src/layerelement.cpp +++ b/src/layerelement.cpp @@ -19,6 +19,7 @@ //---------------------------------------------------------------------------- #include "accid.h" +#include "alignfunctor.h" #include "barline.h" #include "beam.h" #include "beamspan.h" @@ -671,7 +672,7 @@ int LayerElement::GetDrawingRadius(const Doc *doc, bool isInLigature) const } double LayerElement::GetAlignmentDuration( - const Mensur *mensur, const MeterSig *meterSig, bool notGraceOnly, data_NOTATIONTYPE notationType) const + const AlignMeterParams ¶ms, bool notGraceOnly, data_NOTATIONTYPE notationType) const { if (this->IsGraceNote() && notGraceOnly) { return 0.0; @@ -680,7 +681,7 @@ double LayerElement::GetAlignmentDuration( // Only resolve simple sameas links to avoid infinite recursion const LayerElement *sameas = dynamic_cast(this->GetSameasLink()); if (sameas && !sameas->HasSameasLink()) { - return sameas->GetAlignmentDuration(mensur, meterSig, notGraceOnly, notationType); + return sameas->GetAlignmentDuration(params, notGraceOnly, notationType); } if (this->HasInterface(INTERFACE_DURATION)) { @@ -702,7 +703,7 @@ double LayerElement::GetAlignmentDuration( const DurationInterface *duration = this->GetDurationInterface(); assert(duration); if (duration->IsMensuralDur() && (notationType != NOTATIONTYPE_cmn)) { - return duration->GetInterfaceAlignmentMensuralDuration(num, numbase, mensur); + return duration->GetInterfaceAlignmentMensuralDuration(num, numbase, params.mensur); } if (this->Is(NC)) { // This is called only with --neume-as-note @@ -730,22 +731,22 @@ double LayerElement::GetAlignmentDuration( const BeatRpt *beatRpt = vrv_cast(this); assert(beatRpt); int meterUnit = 4; - if (meterSig && meterSig->HasUnit()) meterUnit = meterSig->GetUnit(); + if (params.meterSig && params.meterSig->HasUnit()) meterUnit = params.meterSig->GetUnit(); return beatRpt->GetBeatRptAlignmentDuration(meterUnit); } else if (this->Is(TIMESTAMP_ATTR)) { const TimestampAttr *timestampAttr = vrv_cast(this); assert(timestampAttr); int meterUnit = 4; - if (meterSig && meterSig->HasUnit()) meterUnit = meterSig->GetUnit(); + if (params.meterSig && params.meterSig->HasUnit()) meterUnit = params.meterSig->GetUnit(); return timestampAttr->GetTimestampAttrAlignmentDuration(meterUnit); } // We align all full measure element to the current time signature, even the ones that last longer than one measure else if (this->Is({ HALFMRPT, MREST, MULTIREST, MRPT, MRPT2, MULTIRPT })) { int meterUnit = 4; int meterCount = 4; - if (meterSig && meterSig->HasUnit()) meterUnit = meterSig->GetUnit(); - if (meterSig && meterSig->HasCount()) meterCount = meterSig->GetTotalCount(); + if (params.meterSig && params.meterSig->HasUnit()) meterUnit = params.meterSig->GetUnit(); + if (params.meterSig && params.meterSig->HasCount()) meterCount = params.meterSig->GetTotalCount(); if (this->Is(HALFMRPT)) { return (DUR_MAX / meterUnit * meterCount) / 2; @@ -766,8 +767,16 @@ double LayerElement::GetAlignmentDuration( } } +double LayerElement::GetAlignmentDuration(bool notGraceOnly, data_NOTATIONTYPE notationType) const +{ + AlignMeterParams params; + params.meterSig = NULL; + params.mensur = NULL; + return this->GetAlignmentDuration(params, notGraceOnly, notationType); +} + double LayerElement::GetSameAsContentAlignmentDuration( - const Mensur *mensur, const MeterSig *meterSig, bool notGraceOnly, data_NOTATIONTYPE notationType) const + const AlignMeterParams ¶ms, bool notGraceOnly, data_NOTATIONTYPE notationType) const { if (!this->HasSameasLink() || !this->GetSameasLink()->Is({ BEAM, FTREM, TUPLET })) { return 0.0; @@ -776,11 +785,11 @@ double LayerElement::GetSameAsContentAlignmentDuration( const LayerElement *sameas = vrv_cast(this->GetSameasLink()); assert(sameas); - return sameas->GetContentAlignmentDuration(mensur, meterSig, notGraceOnly, notationType); + return sameas->GetContentAlignmentDuration(params, notGraceOnly, notationType); } double LayerElement::GetContentAlignmentDuration( - const Mensur *mensur, const MeterSig *meterSig, bool notGraceOnly, data_NOTATIONTYPE notationType) const + const AlignMeterParams ¶ms, bool notGraceOnly, data_NOTATIONTYPE notationType) const { if (!this->Is({ BEAM, FTREM, TUPLET })) { return 0.0; @@ -795,12 +804,20 @@ double LayerElement::GetContentAlignmentDuration( } const LayerElement *element = vrv_cast(child); assert(element); - duration += element->GetAlignmentDuration(mensur, meterSig, notGraceOnly, notationType); + duration += element->GetAlignmentDuration(params, notGraceOnly, notationType); } return duration; } +double LayerElement::GetContentAlignmentDuration(bool notGraceOnly, data_NOTATIONTYPE notationType) const +{ + AlignMeterParams params; + params.meterSig = NULL; + params.mensur = NULL; + return this->GetContentAlignmentDuration(params, notGraceOnly, notationType); +} + bool LayerElement::GenerateZoneBounds(int *ulx, int *uly, int *lrx, int *lry) const { // Set integers to extremes diff --git a/src/midifunctor.cpp b/src/midifunctor.cpp index f9c705c6204..05f91a550da 100644 --- a/src/midifunctor.cpp +++ b/src/midifunctor.cpp @@ -44,8 +44,8 @@ InitOnsetOffsetFunctor::InitOnsetOffsetFunctor() : Functor() { m_currentScoreTime = 0.0; m_currentRealTimeSeconds = 0.0; - m_currentMensur = NULL; - m_currentMeterSig = NULL; + m_meterParams.mensur = NULL; + m_meterParams.meterSig = NULL; m_notationType = NOTATIONTYPE_cmn; m_currentTempo = MIDI_TEMPO; } @@ -54,7 +54,7 @@ FunctorCode InitOnsetOffsetFunctor::VisitChordEnd(Chord *chord) { LayerElement *element = chord->ThisOrSameasLink(); - double incrementScoreTime = element->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + double incrementScoreTime = element->GetAlignmentDuration(m_meterParams, true, m_notationType); incrementScoreTime = incrementScoreTime / (DUR_MAX / DURATION_4); double realTimeIncrementSeconds = incrementScoreTime * 60.0 / m_currentTempo; @@ -69,8 +69,8 @@ FunctorCode InitOnsetOffsetFunctor::VisitLayer(Layer *layer) m_currentScoreTime = 0.0; m_currentRealTimeSeconds = 0.0; - m_currentMensur = layer->GetCurrentMensur(); - m_currentMeterSig = layer->GetCurrentMeterSig(); + m_meterParams.mensur = layer->GetCurrentMensur(); + m_meterParams.meterSig = layer->GetCurrentMeterSig(); return FUNCTOR_CONTINUE; } @@ -84,7 +84,7 @@ FunctorCode InitOnsetOffsetFunctor::VisitLayerElement(LayerElement *layerElement double incrementScoreTime; if (element->Is(REST) || element->Is(SPACE)) { - incrementScoreTime = element->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + incrementScoreTime = element->GetAlignmentDuration(m_meterParams, true, m_notationType); incrementScoreTime = incrementScoreTime / (DUR_MAX / DURATION_4); // For rests to be possibly added to the timemap if (element->Is(REST)) { @@ -111,13 +111,13 @@ FunctorCode InitOnsetOffsetFunctor::VisitLayerElement(LayerElement *layerElement // If the note has a @dur or a @dur.ges, take it into account // This means that overwriting only @dots or @dots.ges will not be taken into account if (chord && !note->HasDur() && !note->HasDurGes()) { - incrementScoreTime = chord->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + incrementScoreTime = chord->GetAlignmentDuration(m_meterParams, true, m_notationType); } else if (tabGrp && !note->HasDur() && !note->HasDurGes()) { - incrementScoreTime = tabGrp->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + incrementScoreTime = tabGrp->GetAlignmentDuration(m_meterParams, true, m_notationType); } else { - incrementScoreTime = note->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + incrementScoreTime = note->GetAlignmentDuration(m_meterParams, true, m_notationType); } incrementScoreTime = incrementScoreTime / (DUR_MAX / DURATION_4); double realTimeIncrementSeconds = incrementScoreTime * 60.0 / m_currentTempo; @@ -145,24 +145,23 @@ FunctorCode InitOnsetOffsetFunctor::VisitLayerElement(LayerElement *layerElement BeatRpt *rpt = vrv_cast(element); assert(rpt); - incrementScoreTime = rpt->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + incrementScoreTime = rpt->GetAlignmentDuration(m_meterParams, true, m_notationType); incrementScoreTime = incrementScoreTime / (DUR_MAX / DURATION_4); rpt->SetScoreTimeOnset(m_currentScoreTime); m_currentScoreTime += incrementScoreTime; m_currentRealTimeSeconds += incrementScoreTime * 60.0 / m_currentTempo; } else if (layerElement->Is({ BEAM, LIGATURE, FTREM, TUPLET }) && layerElement->HasSameasLink()) { - incrementScoreTime - = layerElement->GetSameAsContentAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + incrementScoreTime = layerElement->GetSameAsContentAlignmentDuration(m_meterParams, true, m_notationType); incrementScoreTime = incrementScoreTime / (DUR_MAX / DURATION_4); m_currentScoreTime += incrementScoreTime; m_currentRealTimeSeconds += incrementScoreTime * 60.0 / m_currentTempo; } else if (layerElement->Is(MENSUR)) { - this->m_currentMensur = vrv_cast(layerElement); + this->m_meterParams.mensur = vrv_cast(layerElement); } else if (layerElement->Is(METERSIG)) { - this->m_currentMeterSig = vrv_cast(layerElement); + this->m_meterParams.meterSig = vrv_cast(layerElement); } return FUNCTOR_CONTINUE; @@ -189,7 +188,7 @@ FunctorCode InitOnsetOffsetFunctor::VisitTabGrpEnd(TabGrp *tabGrp) { LayerElement *element = tabGrp->ThisOrSameasLink(); - double incrementScoreTime = element->GetAlignmentDuration(m_currentMensur, m_currentMeterSig, true, m_notationType); + double incrementScoreTime = element->GetAlignmentDuration(m_meterParams, true, m_notationType); incrementScoreTime = incrementScoreTime / (DUR_MAX / DURATION_4); double realTimeIncrementSeconds = incrementScoreTime * 60.0 / m_currentTempo; @@ -362,7 +361,8 @@ GenerateMIDIFunctor::GenerateMIDIFunctor(smf::MidiFile *midiFile) : ConstFunctor FunctorCode GenerateMIDIFunctor::VisitBeatRpt(const BeatRpt *beatRpt) { // Sameas not taken into account for now - double beatLength = beatRpt->GetAlignmentDuration() / (DUR_MAX / DURATION_4); + AlignMeterParams params; + double beatLength = beatRpt->GetAlignmentDuration(params) / (DUR_MAX / DURATION_4); double startTime = m_totalTime + beatRpt->GetScoreTimeOnset(); int tpq = m_midiFile->getTPQ();