Skip to content

Instantly share code, notes, and snippets.

@weepy
Created June 22, 2017 11:37
Show Gist options
  • Save weepy/6caedb688ef4e18999efb4614e743e35 to your computer and use it in GitHub Desktop.
Save weepy/6caedb688ef4e18999efb4614e743e35 to your computer and use it in GitHub Desktop.
class UTransformHarmonize : public UTransformBase {
public:
list<int> intervals;
bool calcPlayingNotes(CLOCK clock) {
bool changed = upstreamTransform->calcPlayingNotes(clock);
if(shouldUpdate || changed) {
playingNotes.clear();
NoteList input = upstreamTransform->playingNotes;
for(auto it = input.begin(); it != input.end(); it++) {
for(auto interval: intervals) {
Note n = *it;
n.key += interval;
n.options["key"] = n.key;
playingNotes.push_back(n);
}
}
playingNotes.markAsNew();
shouldUpdate = false;
return true;
}
else {
return false;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment