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

Finding groups of score elements should be generalized at the level of a Score #12

Open
GoogleCodeExporter opened this issue Nov 3, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

beamgroup.getNoteGroup should moved to the Score, and should be generalized
to handle note groups and phrase groups. To enable this feature, the
current implementation of beamgroup.getNoteGroup should be moved to
score.getGroup and changed so it no longer checks for score element
type/category, but simply iterates through score elements until the
applicable group pseudo element is found. 
Starting with a group tag where 'endSection == true' 
Untested sample code may be similar to the following:

    Score.prototype.getGroup = function(elem) {
      var mel;
      var nested = 0;
      var grp = [];
      var pos = score.find(mel);

      if (!pos) {
        return;
      }

      while (--pos >= 0) {
        mel = score.get(pos);
        if (mel.type === elem.type) {
          if (mel.sectionStart && nested == 0)
            break;
          if (mel.sectionEnd) {
            nested++;
            continue;
          } else if (mel.sectionStart) {
            nested--;
            continue;
          }
        } else {
          if (nested == 0)
            grp.push(mel);
        }
      }
      grp.reverse();
      return grp;
    }

Original issue reported on code.google.com by [email protected] on 30 Apr 2010 at 6:34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant