Skip to content

Commit

Permalink
Merge pull request #508 from vcync/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
TimPietrusky authored Dec 16, 2020
2 parents ff9c562 + ed4c971 commit d62f4c4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
21 changes: 20 additions & 1 deletion src/application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import windowHandler from "./window-handler";
import use from "./use";

import PromiseWorker from "promise-worker-transferable";

import Vue from "vue";
import { ipcRenderer, remote } from "electron";

let imageBitmap;
Expand All @@ -25,6 +25,20 @@ export default class ModV {
use = use;
debug = false;
ready = false;
features = Vue.observable({
energy: 0,
rms: 0,
zcr: 0,
spectralCentroid: 0,
spectralFlatness: 0,
spectralSlope: 0,
spectralRolloff: 0,
spectralSpread: 0,
spectralSkewness: 0,
spectralKurtosis: 0,
perceptualSpread: 0,
perceptualSharpness: 0
});

_store = store;
store = {
Expand Down Expand Up @@ -227,6 +241,11 @@ export default class ModV {
const features = this.meyda.get(featuresToGet);
this.updateBeatDetektor(delta, features);
this.$worker.postMessage({ type: "meyda", payload: features });

for (let i = 0; i < featuresToGet.length; i += 1) {
const feature = featuresToGet[i];
this.features[feature] = features[feature];
}
}

setSize({ width, height }) {
Expand Down
16 changes: 15 additions & 1 deletion src/application/worker/store/modules/meyda.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ import {
import uuidv4 from "uuid/v4";

const state = {
features: ["complexSpectrum"],
features: [
"complexSpectrum",
"rms",
"zcr",
"energy",
"spectralCentroid",
"spectralFlatness",
"spectralSlope",
"spectralRolloff",
"spectralSpread",
"spectralSkewness",
"spectralKurtosis",
"perceptualSpread",
"perceptualSharpness"
],
smoothingIds: [],
MAX_SMOOTHING,
SMOOTHING_STEP
Expand Down
8 changes: 5 additions & 3 deletions src/components/Control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ export default {
},
methods: {
queueLoop() {
this.dirty = false;
async queueLoop() {
const { id, prop, queued } = this;
this.$modV.store.dispatch("modules/updateProp", {
await this.$modV.store.dispatch("modules/updateProp", {
moduleId: id,
prop,
data: queued
});
this.queued = null;
this.dirty = false;
},
focusInput() {
Expand Down
6 changes: 4 additions & 2 deletions src/components/InputLinkComponents/AudioFeatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<c span="1">
Audio Feature
</c>
<c span="3">
<c span="2">
<Select v-model="feature" class="light" @input="checkFeature">
<option
v-for="featureValue in features"
Expand All @@ -15,6 +15,9 @@
>
</Select>
</c>
<c span="1">
({{ $modV.features[feature] && $modV.features[feature].toFixed(2) }})
</c>
</grid>
</c>

Expand Down Expand Up @@ -70,7 +73,6 @@ export default {
"spectralSpread",
"spectralSkewness",
"spectralKurtosis",
"loudness",
"perceptualSpread",
"perceptualSharpness"
],
Expand Down
2 changes: 1 addition & 1 deletion src/components/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
return;
}
this.resize();
this.resize(entries);
});
}).observe(container);
Expand Down

0 comments on commit d62f4c4

Please sign in to comment.