Last active
December 28, 2015 06:29
-
-
Save mohayonao/7457629 to your computer and use it in GitHub Desktop.
Web CassetteをiOSで鳴らすためのパッチ
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
CassetteSound.prototype.start = function() { | |
this.on = true; | |
var self = this; | |
if (!this.connected) { | |
this.connected = true; | |
// iOSはユーザー発のイベントから Web Audio API をスタートさせないと動かないので | |
// コンストラクタの connect を start に移動させる | |
if (this.dummy.noteOn) { // Firefox対策 (なぜか noteOn メソッドがない) | |
this.dummy.noteOn(0); | |
} | |
this.dummy.connect(this.generator); | |
this.generator.connect(this.lpf); | |
this.lpf.connect(this.gain); | |
this.gain.connect(this.context.destination); | |
} | |
setTimeout(function() { self.polling(); }, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment