various little audio fixes
This commit is contained in:
parent
dc6e668d0c
commit
e4ca41c2f0
3 changed files with 41 additions and 15 deletions
|
@ -292,10 +292,19 @@ const Audio = function(tp, record) {
|
|||
source_mic.value = 'microphone';
|
||||
source_mic.innerHTML = 'microphone';
|
||||
source_Dom.append(source_mic);
|
||||
let selectedSource = 'microphone';
|
||||
if (typeof audio.getSavedMapping()[layer.id()] === 'object') {
|
||||
if (typeof audio.getSavedMapping()[layer.id()][propTitle] === 'object') {
|
||||
selectedSource = audio.getSavedMapping()[layer.id()][propTitle].source;
|
||||
}
|
||||
}
|
||||
FS.readdir(config.fs.idbfsAudioDir)
|
||||
.forEach((file) => {
|
||||
if (file[0] !== '.') {
|
||||
const source_file = document.createElement('option');
|
||||
if (file === selectedSource) {
|
||||
source_file.setAttribute('selected','true');
|
||||
}
|
||||
source_file.value = file;
|
||||
if (file.length > config.audio.maxFilenameLength) {
|
||||
source_file.innerHTML = file.substr(0,6) + '..' + file.substr(file.length - 6, 6);
|
||||
|
@ -331,7 +340,9 @@ const Audio = function(tp, record) {
|
|||
min_inputDom.type = 'number';
|
||||
min_inputDom.name = toCssClass(`audio_min${propTitle}`);
|
||||
min_inputDom.id = toCssClass(`audio_min${propTitle}`);
|
||||
min_inputDom.title = `default: ${defaultRange[0]}`;
|
||||
if (Array.isArray(defaultRange) && defaultRange.length >= 2) {
|
||||
min_inputDom.title = `default: ${defaultRange[0]}`;
|
||||
}
|
||||
min_inputDom.value = `${mappingOptions.min_out}`;
|
||||
const max_Cont = document.createElement('div');
|
||||
max_Cont.classList.add('audio_max_Cont');
|
||||
|
@ -342,7 +353,9 @@ const Audio = function(tp, record) {
|
|||
max_inputDom.type = 'number';
|
||||
max_inputDom.name = toCssClass(`audio_max${propTitle}`);
|
||||
max_inputDom.id = toCssClass(`audio_max${propTitle}`);
|
||||
max_inputDom.title = `default: ${defaultRange[1]}`;
|
||||
if (Array.isArray(defaultRange) && defaultRange.length >= 2) {
|
||||
max_inputDom.title = `default: ${defaultRange[1]}`;
|
||||
}
|
||||
max_inputDom.value = `${mappingOptions.max_out}`;
|
||||
const smoothing_inputDom_label = document.createElement('label');
|
||||
smoothing_inputDom_label.for = 'audio_smoothing';
|
||||
|
@ -652,7 +665,6 @@ const Audio = function(tp, record) {
|
|||
const layerType = layer.id().split('-')[0];
|
||||
const props = Object.keys(flatValues);
|
||||
props.forEach((propTitle) => {
|
||||
console.log('injecting prop', propTitle);
|
||||
if (config.audio.ignoreProps[layerType].indexOf(propTitle) < 0) {
|
||||
let isActive = false;
|
||||
if (mapping.hasOwnProperty(layer.id())) {
|
||||
|
|
|
@ -101,7 +101,7 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
|
|||
let axes = fontsAndAxes[selectedFontIndex].axes;
|
||||
if (axes.length > 0) {
|
||||
let variationAxes = {};
|
||||
let doThese = [];
|
||||
//let doThese = [];
|
||||
for (let a = 0; a < axes.length; a++) {
|
||||
const sanity_minMax = axes[a].minValue < axes[a].maxValue;
|
||||
const sanity_minDefault = axes[a].minValue <= axes[a].defaultValue;
|
||||
|
@ -118,23 +118,23 @@ const Layer = function(tp, layerID, fontsAndAxes, autoInit = true) {
|
|||
typeof audio.getMapping()[this.id()] === 'object' &&
|
||||
typeof audio.getMapping()[this.id()][`fontVariationAxes.${axes[a].name}`] === 'object' &&
|
||||
tp.getPanel() !== null) {
|
||||
doThese.push(() => {
|
||||
audio.removeAudioOptions(this, `fontVariationAxes.${axes[a].name}`);
|
||||
audio.removeAudioMapping(this, `fontVariationAxes.${axes[a].name}`);
|
||||
audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`].min_out = axes[a].minValue;
|
||||
audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`].max_out = axes[a].maxValue;
|
||||
audio.addAudioMapping(this, `fontVariationAxes.${axes[a].name}`);
|
||||
audio.addAudioOptions(this, `fontVariationAxes.${axes[a].name}`);
|
||||
});
|
||||
//doThese.push(() => {
|
||||
//audio.removeAudioOptions(this, `fontVariationAxes.${axes[a].name}`);
|
||||
//audio.removeAudioMapping(this, `fontVariationAxes.${axes[a].name}`);
|
||||
//audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`].min_out = axes[a].minValue;
|
||||
//audio.getSavedMapping()[this.id()][`fontVariationAxes.${axes[a].name}`].max_out = axes[a].maxValue;
|
||||
//audio.addAudioMapping(this, `fontVariationAxes.${axes[a].name}`);
|
||||
//audio.addAudioOptions(this, `fontVariationAxes.${axes[a].name}`);
|
||||
//});
|
||||
}
|
||||
} else {
|
||||
console.log('js::layer::selectFont', 'this axis is insane, abort', axes[a]);
|
||||
}
|
||||
}
|
||||
props.fontVariationAxes = tp.core.types.compound(variationAxes);
|
||||
doThese.forEach((d) => {
|
||||
d();
|
||||
});
|
||||
//doThese.forEach((d) => {
|
||||
//d();
|
||||
//});
|
||||
} else {
|
||||
delete props.fontVariationAxes;
|
||||
}
|
||||
|
|
|
@ -508,6 +508,20 @@ const deleteLayer = (id, saveProject = true) => {
|
|||
index = i;
|
||||
}
|
||||
}
|
||||
// delete from audio
|
||||
if (typeof audio.getMapping() === 'object' && typeof audio.getMapping()[id] === 'object') {
|
||||
delete audio.getMapping()[id];
|
||||
}
|
||||
if (typeof audio.getSavedMapping() === 'object' && typeof audio.getSavedMapping()[id] === 'object') {
|
||||
delete audio.getSavedMapping()[id];
|
||||
}
|
||||
if (typeof audio.canvasCombos === 'object') {
|
||||
Object.keys(audio.canvasCombos).forEach((propTitle) => {
|
||||
if (audio.canvasCombos[propTitle][2] === id) {
|
||||
delete audio.canvasCombos[propTitle];
|
||||
}
|
||||
});
|
||||
}
|
||||
layers[index].prepareForDepartureFromThisBeautifulExperience();
|
||||
layers.splice(index, 1);
|
||||
delete layersById[id];
|
||||
|
|
Loading…
Reference in a new issue