Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Last active December 28, 2015 06:29
Show Gist options
  • Save mohayonao/7457629 to your computer and use it in GitHub Desktop.
Save mohayonao/7457629 to your computer and use it in GitHub Desktop.
Web CassetteをiOSで鳴らすためのパッチ
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