hide ui and remove audio effects/monitoring

This commit is contained in:
jrkb 2023-10-10 16:45:16 +02:00
parent 64af8d49d1
commit 6aba91b6ca
4 changed files with 39 additions and 15 deletions

View file

@ -290,6 +290,7 @@
<!--<div class="move">move</div>-->
<!--</div>-->
<button id="midi_open">midi</button>
<button id="hide_ui">hide ui</button>
<button id="exporter_open">export</button>
<button id="save_project" onclick="window.tp.downloadProject()">save project</button>
<button id="open_project" onclick="window.tp.uploadProject(true)">open project</button>

View file

@ -621,12 +621,12 @@ const Audio = function(tp, record) {
analyser.smoothingTimeConstant = 0.85;
window.analyser = analyser;
const distortion = audioCtx.createWaveShaper();
const gainNode = audioCtx.createGain();
const biquadFilter = audioCtx.createBiquadFilter();
const convolver = audioCtx.createConvolver();
//const distortion = audioCtx.createWaveShaper();
//const gainNode = audioCtx.createGain();
//const biquadFilter = audioCtx.createBiquadFilter();
//const convolver = audioCtx.createConvolver();
const echoDelay = createEchoDelayEffect(audioCtx);
//const echoDelay = createEchoDelayEffect(audioCtx);
// Distortion curve for the waveshaper, thanks to Kevin Ennis
// http://stackoverflow.com/questions/22312841/waveshaper-node-in-webaudio-how-to-emulate-distortion
@ -663,7 +663,6 @@ const Audio = function(tp, record) {
audioData,
function(buffer) {
soundSource = audioCtx.createBufferSource();
convolver.buffer = buffer;
},
function(e) {
console.log("Audio::audioCtx.decodeAudioData", "Error with decoding audio data" + e.err);
@ -692,12 +691,7 @@ const Audio = function(tp, record) {
.getUserMedia(constraints)
.then(function(stream) {
source = audioCtx.createMediaStreamSource(stream);
source.connect(distortion);
distortion.connect(biquadFilter);
biquadFilter.connect(gainNode);
convolver.connect(gainNode);
echoDelay.placeBetween(gainNode, analyser);
analyser.connect(audioCtx.destination);
source.connect(analyser);
visualize();
voiceChange();

View file

@ -151,6 +151,11 @@ const findInjectPanel = () => {
bottomButtonsContainer.classList.add("bottomButtonsContainer");
panel.append(bottomButtonsContainer);
}
const hideuiButton = document.querySelector('#hide_ui');
if (hideuiButton !== null) {
bottomButtonsContainer.append(hideuiButton);
hideuiButton.classList.add("main_panel_button");
}
const exportButton = document.querySelector('#exporter_open');
if (exportButton !== null) {
bottomButtonsContainer.append(exportButton);
@ -531,6 +536,30 @@ window.renderFrames = exporter.renderFrames;
const layer_panel = document.querySelector('#layer_panel');
const initPanels = () => {
//makeDraggable(layer_panel);
const ui = (show) => {
if (show && tp.studio.ui.isHidden) {
tp.studio.ui.restore();
} else if (!show && !tp.studio.ui.isHidden) {
tp.studio.ui.hide();
}
};
const handleUiKeypress = (e) => {
if (e.key.toLowerCase() === 'q') {
document.removeEventListener('keypress', handleUiKeypress);
ui(true);
}
};
const initPanels = () => {
let hideuiButton = document.querySelector('#hide_ui');
if (hideuiButton === null) {
hideuiButton = tp.getPanel().querySelector('#hide_ui');
}
if (hideuiButton !== null) {
hideuiButton.addEventListener('click', () => {
ui(false);
document.addEventListener('keypress', handleUiKeypress);
});
}
};

View file

@ -97,7 +97,7 @@ const TheatrePlay = function(autoInit = false) {
if (typeof value === 'undefined') {
return false;
}
};
}
return this.sheet.sequence.__experimental_getKeyframes(prop);
};
// wtf, this function was being written in one go