|
|
|
@@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<div id="app-area"> |
|
|
|
<Menu /> |
|
|
|
<Menu v-on:permalink="permalink" /> |
|
|
|
<div id="first-input" v-if="needsInput"> |
|
|
|
<button class="soundscapes" v-on:click="resumeContext">Start</button> |
|
|
|
</div> |
|
|
|
@@ -21,7 +21,9 @@ import { clearCache, setup, Soundscape } from "./audio"; |
|
|
|
import SoundscapeComp from "./components/SoundscapeComp.vue"; |
|
|
|
import Menu from "./components/Menu.vue"; |
|
|
|
import { DemoScene } from "./data/presets"; |
|
|
|
import { deserializeSoundscape } from "./serialize"; |
|
|
|
import { deserializeSoundscape, serializeSoundscape } from "./serialize"; |
|
|
|
import { Base64 } from "js-base64"; |
|
|
|
|
|
|
|
@Options({ |
|
|
|
components: { |
|
|
|
SoundscapeComp, |
|
|
|
@@ -42,6 +44,11 @@ export default class Dissolve extends Vue { |
|
|
|
|
|
|
|
this.soundscapes.push(scape); |
|
|
|
} |
|
|
|
|
|
|
|
permalink(): void { |
|
|
|
const data = this.soundscapes.map((scape) => serializeSoundscape(scape)); |
|
|
|
window.location.hash = Base64.encodeURI(JSON.stringify(data)); |
|
|
|
} |
|
|
|
mounted(): void { |
|
|
|
this.context = setup(); |
|
|
|
console.log(this.context); |
|
|
|
@@ -53,6 +60,15 @@ export default class Dissolve extends Vue { |
|
|
|
if (this.context.state == "suspended") { |
|
|
|
this.needsInput = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (window.location.hash) { |
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
|
|
const data: Array<any> = JSON.parse(Base64.decode(window.location.hash)); |
|
|
|
|
|
|
|
data.forEach((entry) => { |
|
|
|
this.addSoundscape(deserializeSoundscape(entry)); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
resumeContext(): void { |
|
|
|
|