web-> res/src
This commit is contained in:
parent
394b7ac1d7
commit
fb8a80f3e5
@ -89,10 +89,10 @@ build/web/$(BUNDLE_NAME).wasm: $(C_OBJS) $(CXX_OBJS) | build/web
|
|||||||
$(CXX) $^ -o $@ $(CFLAGS_ALL) $(CXXFLAGS_ALL) $(LDFLAGS_ALL)
|
$(CXX) $^ -o $@ $(CFLAGS_ALL) $(CXXFLAGS_ALL) $(LDFLAGS_ALL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build/web/$(BUNDLE_NAME)_processor.js: $(DATA_DIR)/src/processor.js | build/web
|
build/web/$(BUNDLE_NAME)_processor.js: $(DATA_DIR)/res/processor.js | build/web
|
||||||
cp $^ $@
|
cp $^ $@
|
||||||
|
|
||||||
build/web/$(BUNDLE_NAME).js: $(DATA_DIR)/src/module.js | build/web
|
build/web/$(BUNDLE_NAME).js: $(DATA_DIR)/res/module.js | build/web
|
||||||
cp $^ $@
|
cp $^ $@
|
||||||
|
|
||||||
build/web build/obj:
|
build/web build/obj:
|
||||||
|
@ -30,6 +30,8 @@ var nChansOut = busesOut.reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0
|
|||||||
var cpu_meter = 0.0;
|
var cpu_meter = 0.0;
|
||||||
var sampleRate = 1.0;
|
var sampleRate = 1.0;
|
||||||
|
|
||||||
|
const now = globalThis.performance ? performance.now : Date.now;
|
||||||
|
|
||||||
class Processor extends AudioWorkletProcessor {
|
class Processor extends AudioWorkletProcessor {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super();
|
super();
|
||||||
@ -74,7 +76,7 @@ class Processor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, params) {
|
process(inputs, outputs, params) {
|
||||||
const processTimeStart = performance.now();
|
const processTimeStart = now();
|
||||||
|
|
||||||
for (var i = 0; i < this.parametersIn.length; i++) {
|
for (var i = 0; i < this.parametersIn.length; i++) {
|
||||||
var index = this.parametersIn[i].index;
|
var index = this.parametersIn[i].index;
|
||||||
@ -158,7 +160,7 @@ class Processor extends AudioWorkletProcessor {
|
|||||||
this.parametersOut[i].value = value;
|
this.parametersOut[i].value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const processTimeEnd = performance.now();
|
const processTimeEnd = now();
|
||||||
const processTimeMs = processTimeEnd - processTimeStart;
|
const processTimeMs = processTimeEnd - processTimeStart;
|
||||||
const processTimeS = processTimeMs * 0.001;
|
const processTimeS = processTimeMs * 0.001;
|
||||||
cpu_meter = cpu_meter * 0.9 + (processTimeS * sampleRate) * 0.1;
|
cpu_meter = cpu_meter * 0.9 + (processTimeS * sampleRate) * 0.1;
|
||||||
|
@ -29,6 +29,6 @@ module.exports = function (data, api) {
|
|||||||
api.copyFile(`src${sep}new.cpp`, `src${sep}new.cpp`);
|
api.copyFile(`src${sep}new.cpp`, `src${sep}new.cpp`);
|
||||||
api.copyFile(`src${sep}processor.c`, `src${sep}processor.c`);
|
api.copyFile(`src${sep}processor.c`, `src${sep}processor.c`);
|
||||||
api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data);
|
api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data);
|
||||||
api.generateFileFromTemplateFile(`src${sep}processor.js`, `src${sep}processor.js`, data);
|
api.generateFileFromTemplateFile(`src${sep}processor.js`, `res${sep}processor.js`, data);
|
||||||
api.generateFileFromTemplateFile(`src${sep}module.js`, `src${sep}module.js`, data);
|
api.generateFileFromTemplateFile(`src${sep}module.js`, `res${sep}module.js`, data);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user