Last active
October 22, 2017 23:39
-
-
Save beefchimi/d19dac9ca6e55ef28b22171f5c1e0068 to your computer and use it in GitHub Desktop.
Web Audio common method patch
This file contains 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
const methodPatch = { | |
start(source) { | |
return (source.start) ? source.start : (startTime = 0) => source.noteOn(startTime); | |
}, | |
stop(source) { | |
return (source.stop) ? source.stop : (stopTime = 0) => source.noteOff(stopTime); | |
}, | |
}; | |
export default methodPatch; | |
// later on... we alias our methods | |
this.source.start = methodPatch.start(this.source); | |
this.source.stop = methodPatch.stop(this.source); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment