Functions for scheduling multiple upcoming changes to a voice in one shot. #1049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds two user-facing functions (and a number of coder-facing helper functions):
(1)
sched
is likejumpIn
. WhereasjumpIn
schedule one cycle to take over at some point in the future,sched
schedules multiple things (and accepts fractional times).Here's an example:
In the above, voice
d1
will audibly count numbers as soon as it's evaluated.d2
will wait two cycles, then start playing "lt5" for two cycles, then "ht4" for two cycles, and then "hc*3" from then on.(2)
schod
stands forschedule modulo
. It is likejumpMod
, except it lets you specify multiple changes (and accepts fractional times). The user specifies a divisor (probably a multile of 4 if you use straight time), and times scheduled are relative to the start of the most recent cycle that was divisible by the divisor.Here's an example:
Here the voice being scheduled is
d2
and the divisor is 8. Suppose the current cycle is 11. In that case, since 11 is equal to 3 mod 8, and 2 < 3, voice 2 will immediately start playing "lt5". At cycle 12 (since 12 = 4 mod 8), it will switch to "ht4". At cycle 14 it plays "hc*3". At cycle 16 it plays "~ sn:1". At cycle 20 it plays "~ ~ sn:1". Etc.Notice that the times being scheduled can be greater than the divisor. The divisor is only used to specify the start time.