Last active
March 5, 2018 21:26
-
-
Save lvm/ee9939c359a1255fecbd16724331efff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Psoftclip : FilterPattern { | |
var <>lo, <>hi; | |
*new { arg pattern,lo,hi; | |
^super.new(pattern).lo_(lo).hi_(hi) | |
} | |
storeArgs { ^[pattern,lo,hi] } | |
embedInStream { arg event; | |
var next; | |
var stream = pattern.asStream; | |
var loStr = lo.asStream; | |
var hiStr = hi.asStream; | |
var loVal, hiVal; | |
while({ | |
loVal = loStr.next(event); | |
hiVal = hiStr.next(event); | |
next = stream.next(event); | |
next.notNil and: { loVal.notNil } and: { hiVal.notNil } | |
},{ | |
event = next.softclip(loVal, hiVal).yield | |
}); | |
^event; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment