Skip to content

Commit

Permalink
Safari being Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwellito committed Nov 11, 2019
1 parent 59c0418 commit 0ed032f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion index.html
Expand Up @@ -71,5 +71,12 @@
</body>

<!-- Main -->
<script async src="./dist/bundle.js"></script>
<!-- <script async src="./dist/bundle.js"></script> -->
<script>
setTimeout(() => {
var bundleTag = document.createElement('script');
bundleTag.src = './dist/bundle.js';
document.body.appendChild(bundleTag);
}, 1);
</script>
</html>
3 changes: 2 additions & 1 deletion src/models/Track.ts
Expand Up @@ -26,7 +26,8 @@ export default class Track {
filterFrequency = 1;
filterQuality = 0;

audioCtx = new AudioContext();
audioCtx: AudioContext = new ((window as any).AudioContext ||
(window as any).webkitAudioContext)();
gainNode = this.audioCtx.createGain();
filterNode = this.audioCtx.createBiquadFilter();

Expand Down
8 changes: 7 additions & 1 deletion src/services/MpkController.ts
Expand Up @@ -119,7 +119,13 @@ class MpkController {
this.runIntroAnimBinded = this.runIntroAnim.bind(this);

// Check if the user already granted access
(<any>navigator).permissions.query({ name: 'midi', sysex: true }).then(
const permissions = (<any>navigator).permissions;
if (!permissions || !permissions.query) {
this.setStatus(MpkStatus.incompatible);
return;
}

permissions.query({ name: 'midi', sysex: true }).then(
(status: any /* PermissionStatus */) => {
if (status.state === 'granted') {
this.accessDevice();
Expand Down

0 comments on commit 0ed032f

Please sign in to comment.