Commit 05a1f4f5 authored by Florent Jacquemard's avatar Florent Jacquemard
Browse files

gullet in engraving model: correction update _completed

comments
parent a6b36b6f
......@@ -110,13 +110,13 @@ public:
/// (terminal symbol)
/// @warning must not label the first sibling.
MULT,
/// symbol for addition of grace notes on left (binary symbol).
/// binary symbol for ornament with grace notes + event.
/// left child = grace notes (duration 0), right child = event.s.
GRACE,
/// bar constructor (binary or constant symbol).
/// division of multi-bar time interval into first bar and the rest.
BAR,
/// symbol for concurrency (binary symbol).
/// binary symbol for concurrency
/// time interval duplication = voice split.
FORK,
/// space or fail or dummy symbol (undef)
......
......@@ -83,9 +83,12 @@ bool Tuplet::add(Node* t)
bool Tuplet::replace(size_t i, Node* n)
{
assert(n);
if (i >= size())
return false;
if (i >= size()) return false;
assert(_children[i]);
assert(_children[i]->multiplicity() <= _completed);
_completed -= _children[i]->multiplicity();
_children[i] = n;
_completed += n->multiplicity();
return true;
}
......@@ -102,15 +105,16 @@ size_t Tuplet::size() const
size_t Tuplet::completed() const
{
size_t res = 0;
for (Node* c : _children)
{
assert(c);
//assert(c->complete());
res += c->multiplicity();
}
return res;
return _completed;
// size_t res = 0;
// for (Node* c : _children)
// {
// assert(c);
// //assert(c->complete());
// res += c->multiplicity();
// }
//
// return res;
}
......
......@@ -172,6 +172,8 @@ private:
/// tuplet label
TupletLabel _label;
/// Current number of edges from this node = number of children
/// that have been added times their respective multiplicities.
size_t _completed;
mtu_t init_start(Node* parent)
......
......@@ -149,11 +149,16 @@ private:
size_t m,
int v);
/// add one tree of the current Sequence.
/// add one tree in the current Sequence.
/// @param env scoring environement, contains an input segment and
/// a voicing (description of the organization of the part into voices).
/// @param tab associated parse table containing engraving info.
/// @param k target state or run r
/// @param r a run (body of transition rule of the augmented automaton)
/// @param mult multiplicity of the top node of the tree.
/// @todo TBC parent, prev useless?
/// @param len total duration (in MTU) of the tree.
/// @return the next position to read in input segment.
/// @todo TBC parent, prev useless?
template<class K>
size_t readTree(ScoringEnv& env,
Parsing::TableA<K>& tab,
......@@ -163,11 +168,17 @@ private:
size_t b,
int voiceNb,
mtu_t len);
/// add one Node in the tree of the current Sequence
/// add one Node in the tree in the current Sequence.
/// @param env scoring environement, contains an input segment and
/// a voicing (description of the organization of the part into voices).
/// @param a label of the node.
/// @param arity arity of the node.
/// @param multiplicity multiplicity of the node.
/// @param b position of first point to read in input segment.
/// @param n number of points to read in input segment for the symbol.
/// @param voiceNb current voice nb.
/// @param len duration (in MTU) of the node.
/// @return the next position to read in input segment.
size_t readSymbol(ScoringEnv& env,
label_t a,
......
......@@ -99,7 +99,7 @@ size_t TableMonoImporter::readRun(ScoringEnv& env,
size_t j = b;
//size_t ar = r->arity();
label_t a = r->label();
assert(! SymbLabel::inside(a)); // not in a measure
assert(! SymbLabel::inside(a)); // not in a measure boundary
// single bar mark; parse 1 measure and the rest of the run (tail recusion)
if (SymbLabel::bar(a) && (SymbLabel::arity(a) == 2))
......@@ -295,7 +295,7 @@ size_t TableMonoImporter::readTree(ScoringEnv& env,
/// the nb of input points may be > symbol size
/// e.g. symbol size = 1 for note but 2 points = 1 grace-rest (OFF) + 1 note (ON)
/// we need to formalize this
size_t n = k.size(); // SymbLabel::nbEvents(a);
size_t n = k.size(); // SymbLabel::nbEvents(a);
// if (SymbLabel::terminal(a))
// n = k.pointsTerminalLabel(a, env);
......@@ -372,7 +372,8 @@ size_t TableMonoImporter::readTree(ScoringEnv& env,
return j;
}
}
// INFO("Tree completed:{}, Tree.arity:{}", tree->completed(), tree->arity());
INFO("Tree completed:{}, Tree.arity:{}, Run.size:{}",
tree->completed(), tree->arity(), r->size());
assert(tree->complete());
return j;
}
......@@ -387,7 +388,7 @@ size_t TableMonoImporter::readSymbol(ScoringEnv& env,
int voiceNb,
mtu_t len)
{
TRACE("TableImporter[{}]: read symbol: {}",
INFO("TableImporter[{}]: read symbol: {}",
loc(b, n), SymbLabel::to_string(a));
/// @todo TBC only 1 staff for mono case?
......@@ -583,7 +584,9 @@ TableMonoImporter::readNote(ScoringEnv& env,
if (evt == nullptr)
{
ERROR("TableImporter[{}]: failed to read note", loc(b, n));
return std::make_pair(b+n, (LeafNote*) NULL);
// INFO("segment : {} events", env.segment->size());
// env.segment->print(std::cout);
return std::make_pair(b+n, (LeafNote*) nullptr);
}
assert(evt->isNote());
Pitch& p = evt->pitch(); // pitch is copied
......
......@@ -115,6 +115,8 @@ void MusPoint::set_voice(int v)
void MusPoint::print(std::ostream& o) const
{
MusEvent* evt = event();
//INFO(":<15", _rdate); // left justify, width=15
o << std::setw(8) << std::setiosflags(std::ios::left);
o << _rdate << " ";
......@@ -150,6 +152,16 @@ void MusPoint::print(std::ostream& o) const
_mduration.printint(o);
//o << " bars";
}
if (evt != nullptr)
{
o << " event=<";
o << *evt;
o << ">";
}
else
{
o << " event=NULL";
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment