Logo Search packages:      
Sourcecode: csound version File versions

ublas::matrix< double > csound::Node::traverse ( const ublas::matrix< double > &  globalCoordinates,
Score score 
) [virtual, inherited]

The default implementation postconcatenates its own local coordinate system with the global coordinates, then passes the score and the product of coordinate systems to each child, thus performing a depth-first traversal of the music graph.

Reimplemented in csound::Hocket, and csound::Sequence.

Definition at line 45 of file Node.cpp.

References csound::Node::children, csound::Node::getLocalCoordinates(), and csound::Node::produceOrTransform().

Referenced by csound::MusicModel::generate(), and csound::Hocket::traverse().

    // Obtain the composite transformation of coordinate system
    // by post-concatenating the local transformation of coordinate system
    // with the global, or enclosing, transformation of coordinate system.
    ublas::matrix<double> compositeCoordinates = ublas::prod(getLocalCoordinates(), globalCoordinates);
    // Make a bookmark for the current end of the score.
    size_t beginAt = score.size();
    // Descend into each of the child nodes.
    for(std::vector<Node*>::iterator i = children.begin(); i != children.end(); ++i)
        (*i)->traverse(compositeCoordinates, score);
    // Make a bookmark for the new end of the score,
    // thus enclosing all Events that may have been produced or transformed
    // by all the child nodes.
    size_t endAt = score.size();
    // Take the score and optionally transform Events between the bookmarks,
    // or append new Events.
    produceOrTransform(score, beginAt, endAt, compositeCoordinates);
    size_t finalEndAt = score.size();
    // Apply the global transformation of coordinate system to all child events,
    // including events produced by this node.
    for (size_t i = beginAt; i < finalEndAt; i++) {
      score[i] = ublas::prod(compositeCoordinates, score[i]);
    // Return the composite transformation of coordinate system.
    return compositeCoordinates;

Generated by  Doxygen 1.6.0   Back to index