This commit is contained in:
André Michelle
2026-03-19 21:32:11 +01:00
parent a69559157f
commit e5360a3c8c
2 changed files with 16 additions and 10 deletions
@@ -74,7 +74,7 @@ export class WerkstattDeviceProcessor extends AudioProcessor implements AudioEff
this.#silenced = true
this.#userProcessor = Option.None
this.#output.clear()
this.#tryLoad()
this.#tryLoad(newUpdate)
}
}),
box.parameters.pointerHub.catchupAndSubscribe({
@@ -96,10 +96,10 @@ export class WerkstattDeviceProcessor extends AudioProcessor implements AudioEff
this.readAllParameters()
}
#tryLoad(): void {
#tryLoad(expectedUpdate: int): void {
const registry = (globalThis as any).openDAW?.werkstattProcessors?.[this.#uuid]
if (isDefined(registry)) {
this.#swapProcessor(registry.create, registry.update)
if (isDefined(registry) && registry.update === expectedUpdate) {
this.#swapProcessor(registry.create, expectedUpdate)
}
}
@@ -167,7 +167,10 @@ export class WerkstattDeviceProcessor extends AudioProcessor implements AudioEff
processAudio(block: Block): void {
if (this.#silenced) {
this.#tryLoad()
const expectedUpdate = parseUpdate(this.#adapter.box.code.getValue())
if (expectedUpdate > 0 && expectedUpdate !== this.#currentUpdate) {
this.#tryLoad(expectedUpdate)
}
if (this.#silenced) {return}
}
if (this.#source.isEmpty() || this.#userProcessor.isEmpty()) {return}
@@ -113,7 +113,7 @@ export class SpielwerkDeviceProcessor extends EventProcessor implements MidiEffe
if (newUpdate > 0 && newUpdate !== this.#currentUpdate) {
this.#silenced = true
this.#userProcessor = Option.None
this.#tryLoad()
this.#tryLoad(newUpdate)
}
}),
box.parameters.pointerHub.catchupAndSubscribe({
@@ -165,7 +165,10 @@ export class SpielwerkDeviceProcessor extends EventProcessor implements MidiEffe
}
this.#wasPlaying = playing
if (this.#silenced) {
this.#tryLoad()
const expectedUpdate = parseUpdate(this.#adapter.box.code.getValue())
if (expectedUpdate > 0 && expectedUpdate !== this.#currentUpdate) {
this.#tryLoad(expectedUpdate)
}
}
if (this.#source.nonEmpty() && this.#userProcessor.nonEmpty() && !this.#silenced) {
const source = this.#source.unwrap()
@@ -287,10 +290,10 @@ export class SpielwerkDeviceProcessor extends EventProcessor implements MidiEffe
index(): number {return this.#adapter.indexField.getValue()}
adapter(): SpielwerkDeviceBoxAdapter {return this.#adapter}
#tryLoad(): void {
#tryLoad(expectedUpdate: int): void {
const registry = (globalThis as any).openDAW?.spielwerkProcessors?.[this.#uuid]
if (isDefined(registry)) {
this.#swapProcessor(registry.create, registry.update)
if (isDefined(registry) && registry.update === expectedUpdate) {
this.#swapProcessor(registry.create, expectedUpdate)
}
}