From 09897d71785bd82aa93eefc6a63985e54f07ea48 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sun, 7 Apr 2024 14:30:22 +0200 Subject: [PATCH] inbetween stuff dependencies hashes: openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501 ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3 ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239 ofxVariableLab 0b5f9bdebc1e5550621957e73c040c258ec6317b ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8 theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18 --- bin/em/variabletime/web/js/audio.js | 3 ++- bin/em/variabletime/web/js/main.js | 30 +++++++++++++--------- bin/em/variabletime/web/js/theatre-play.js | 7 +++++ 3 files changed, 27 insertions(+), 13 deletions(-) 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);