mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-15 07:38:33 +00:00
Fix show() to show sign, fix off()
This commit is contained in:
parent
ef877a40ca
commit
37a240ee2d
@ -73,7 +73,7 @@ Fraction.prototype.min = function(other) {
|
||||
}
|
||||
|
||||
Fraction.prototype.show = function () {
|
||||
return this.n + "/" + this.d
|
||||
return (this.s * this.n) + "/" + this.d
|
||||
}
|
||||
|
||||
Fraction.prototype.or = function(other) {
|
||||
@ -574,7 +574,7 @@ class Pattern {
|
||||
}
|
||||
|
||||
off(time_pat, func) {
|
||||
return stack([this, func(this._early(time_pat))])
|
||||
return stack(this, func(this.late(time_pat)))
|
||||
}
|
||||
|
||||
every(n, func) {
|
||||
|
||||
@ -355,4 +355,26 @@ describe('Pattern', function() {
|
||||
)
|
||||
})
|
||||
})
|
||||
describe("early", () => {
|
||||
it("Can shift an event earlier", () => {
|
||||
assert.deepStrictEqual(
|
||||
pure(30)._late(0.25).query(ts(1,2)),
|
||||
[hap(ts(1/4,5/4), ts(1,5/4), 30), hap(ts(5/4,9/4), ts(5/4,2), 30)]
|
||||
)
|
||||
})
|
||||
it("Can shift an event earlier, into negative time", () => {
|
||||
assert.deepStrictEqual(
|
||||
pure(30)._late(0.25).query(ts(0,1)),
|
||||
[hap(ts(-3/4,1/4), ts(0,1/4), 30), hap(ts(1/4,5/4), ts(1/4,1), 30)]
|
||||
)
|
||||
})
|
||||
})
|
||||
describe("off", () => {
|
||||
it("Can offset a transformed pattern from the original", () => {
|
||||
assert.deepStrictEqual(
|
||||
pure(30).off(0.25, add(2)).firstCycle,
|
||||
stack(pure(30), pure(30).early(0.25).add(2)).firstCycle
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user