diff --git a/bin/em/variabletime/web/js/audio.js b/bin/em/variabletime/web/js/audio.js index 0f82c7c..fe186a6 100644 --- a/bin/em/variabletime/web/js/audio.js +++ b/bin/em/variabletime/web/js/audio.js @@ -1630,5 +1630,6 @@ const Audio = function(tp, record) { }; export { - Audio + Audio, + AudioLayer } diff --git a/bin/em/variabletime/web/js/main.js b/bin/em/variabletime/web/js/main.js index 4c31f84..68bc313 100644 --- a/bin/em/variabletime/web/js/main.js +++ b/bin/em/variabletime/web/js/main.js @@ -52,31 +52,34 @@ import { Config } from './config.js'; -window.uploadFile = uploadFile; -window.downloadFile = downloadFile; -window.isInitialized = false; -window.hashFromString = hashFromString; const config = new Config(); -window.config = config; const tp = new TheatrePlay(); -window.tp = tp; const layers = []; const layersById = {}; const layerOrder = new LayerOrder(); -window.layerOrder = layerOrder; const fontsAndAxes = []; let artboard; const exporter = new Exporter(); const interactor = new Interactor(); const moduleFS = new ModuleFS(); -window.moduleFS = moduleFS; const record = new Record(tp); -window.record = record; const audio = new Audio(tp, record); -window.audio = audio; +// globally reachables +// classes +window.config = config; +window.tp = tp; +window.layerOrder = layerOrder; +window.moduleFS = moduleFS; +window.record = record; +window.audio = audio; +// utilities +window.uploadFile = uploadFile; +window.downloadFile = downloadFile; +window.isInitialized = false; window.panelFinderTimeout = false; + const sequenceEventBuffer = {}; //const midiController = new MidiController(); @@ -247,7 +250,7 @@ window.onload = () => { } tp.studio.onSelectionChange((newSelection) => { if (newSelection.length > 0) { - [getArtboard(), getLayers()].flat().forEach((e) => { + [getArtboard(), getLayers(), getAudioLayer()].flat().forEach((e) => { if (e.id() === newSelection[0].address.objectKey) { if (e.id().indexOf('layer-') === 0) { e.findInjectPanel(); @@ -257,6 +260,8 @@ window.onload = () => { }, 60); } else if (e.id() === 'artboard') { e.findInjectPanel(); + } else if (e.id().indexOf('audio') === 0) { + e.findInjectPanel(); } } }); @@ -454,7 +459,8 @@ window.getLayer = (layerID = tp.studio.selection[0].address.objectKey) => { if (layerID === 'artboard') { return artboard; } else { - return layers.find((layer) => layer.id() === layerID); + //return layers.find((layer) => layer.id() === layerID); + return layersById[layerID]; } }; diff --git a/bin/em/variabletime/web/js/theatre-play.js b/bin/em/variabletime/web/js/theatre-play.js index fbfbd67..7e2dacc 100644 --- a/bin/em/variabletime/web/js/theatre-play.js +++ b/bin/em/variabletime/web/js/theatre-play.js @@ -724,6 +724,13 @@ const TheatrePlay = function(autoInit = false) { window.project_fontsHashMap = project.fontsHashMap; layerPromises.push(window.addExistingLayer(layerId, objects[layerId])); }); + Object.keys(objects) + .filter((e) => e.indexOf('audio-') === 0) + .forEach((layerId) => { + window.setLoadingTask(`setting up the sounds of ${layerId} to come`, 90); + window.project_fontsHashMap = project.fontsHashMap; + layerPromises.push(window.addExistingLayer(layerId, objects[layerId])); + }); Promise.all(layerPromises).then(() => { window.layerOrder.set(project.layerOrder); this.duration = this.core.val(this.sheet.sequence.pointer.length);