@blibliki/engine
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -15,3 +15,7 @@ import { InputNode } from "tone"; | ||
VirtualMidi = "virtualMidi", | ||
Volume = "monoVolume" | ||
Volume = "monoVolume", | ||
Reverb = "reverb", | ||
Delay = "delay", | ||
Distortion = "distortion", | ||
BitCrusher = "bitCrusher" | ||
} | ||
@@ -18,0 +22,0 @@ export interface Connectable { |
@@ -16,2 +16,6 @@ import { v4 as uuidv4 } from "uuid"; | ||
ModuleType["Volume"] = "monoVolume"; | ||
ModuleType["Reverb"] = "reverb"; | ||
ModuleType["Delay"] = "delay"; | ||
ModuleType["Distortion"] = "distortion"; | ||
ModuleType["BitCrusher"] = "bitCrusher"; | ||
})(ModuleType || (ModuleType = {})); | ||
@@ -18,0 +22,0 @@ export class DummnyInternalModule { |
@@ -13,2 +13,6 @@ import Module, { Connectable } from "./Base"; | ||
import VirtualMidi from "./VirtualMidi"; | ||
import Reverb from "./Reverb"; | ||
import Delay from "./Delay"; | ||
import Distortion from "./Distortion"; | ||
import BitCrusher from "./BitCrusher"; | ||
export { default, ModuleType } from "./Base"; | ||
@@ -22,2 +26,2 @@ export { default as PolyModule, PolyModuleType } from "./PolyModule"; | ||
export declare function createModule(name: string, type: string, props: any): AudioModule; | ||
export declare function moduleClassFromType(type: string): typeof Oscillator | typeof PolyOscillator | typeof Envelope | typeof PolyEnvelope | typeof AmpEnvelope | typeof PolyAmpEnvelope | typeof Filter | typeof PolyFilter | typeof Master | typeof VoiceScheduler | typeof Voice | typeof MidiSelector | typeof Volume | typeof PolyVolume | typeof VirtualMidi; | ||
export declare function moduleClassFromType(type: string): typeof Reverb | typeof Delay | typeof Distortion | typeof BitCrusher | typeof Oscillator | typeof Envelope | typeof AmpEnvelope | typeof Filter | typeof Volume | typeof PolyOscillator | typeof PolyEnvelope | typeof PolyAmpEnvelope | typeof PolyFilter | typeof PolyVolume | typeof Master | typeof Voice | typeof VoiceScheduler | typeof MidiSelector | typeof VirtualMidi; |
@@ -14,2 +14,6 @@ import { ModuleType } from "./Base"; | ||
import VirtualMidi from "./VirtualMidi"; | ||
import Reverb from "./Reverb"; | ||
import Delay from "./Delay"; | ||
import Distortion from "./Distortion"; | ||
import BitCrusher from "./BitCrusher"; | ||
export { default, ModuleType } from "./Base"; | ||
@@ -60,2 +64,10 @@ export { default as PolyModule, PolyModuleType } from "./PolyModule"; | ||
return VirtualMidi; | ||
case ModuleType.Reverb: | ||
return Reverb; | ||
case ModuleType.Delay: | ||
return Delay; | ||
case ModuleType.Distortion: | ||
return Distortion; | ||
case ModuleType.BitCrusher: | ||
return BitCrusher; | ||
default: | ||
@@ -62,0 +74,0 @@ throw Error("Unknown module type"); |
@@ -9,3 +9,11 @@ import { v4 as uuidv4 } from "uuid"; | ||
Object.values(Engine.modules).forEach((m) => m.unplugAll()); | ||
const succesedConnections = routes.map((route) => { | ||
const succesedConnections = routes | ||
.sort((r1, r2) => { | ||
if (r1.outputName === "number of voices") | ||
return -1; | ||
if (r2.outputName === "number of voices") | ||
return 1; | ||
return 0; | ||
}) | ||
.map((route) => { | ||
const { sourceId, outputName, destinationId, inputName } = route; | ||
@@ -12,0 +20,0 @@ const source = Engine.findById(sourceId); |
{ | ||
"name": "@blibliki/engine", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"main": "build/index.js", | ||
@@ -5,0 +5,0 @@ "types": "build/index.d.ts", |
@@ -19,2 +19,6 @@ import { v4 as uuidv4 } from "uuid"; | ||
Volume = "monoVolume", | ||
Reverb = "reverb", | ||
Delay = "delay", | ||
Distortion = "distortion", | ||
BitCrusher = "bitCrusher", | ||
} | ||
@@ -21,0 +25,0 @@ |
@@ -14,2 +14,6 @@ import Module, { Connectable, ModuleType } from "./Base"; | ||
import VirtualMidi from "./VirtualMidi"; | ||
import Reverb from "./Reverb"; | ||
import Delay from "./Delay"; | ||
import Distortion from "./Distortion"; | ||
import BitCrusher from "./BitCrusher"; | ||
@@ -79,2 +83,10 @@ export { default, ModuleType } from "./Base"; | ||
return VirtualMidi; | ||
case ModuleType.Reverb: | ||
return Reverb; | ||
case ModuleType.Delay: | ||
return Delay; | ||
case ModuleType.Distortion: | ||
return Distortion; | ||
case ModuleType.BitCrusher: | ||
return BitCrusher; | ||
default: | ||
@@ -81,0 +93,0 @@ throw Error("Unknown module type"); |
@@ -25,13 +25,20 @@ import { v4 as uuidv4 } from "uuid"; | ||
const succesedConnections = routes.map((route) => { | ||
const { sourceId, outputName, destinationId, inputName } = route; | ||
const succesedConnections = routes | ||
.sort((r1, r2) => { | ||
if (r1.outputName === "number of voices") return -1; | ||
if (r2.outputName === "number of voices") return 1; | ||
const source = Engine.findById(sourceId); | ||
const destination = Engine.findById(destinationId); | ||
return 0; | ||
}) | ||
.map((route) => { | ||
const { sourceId, outputName, destinationId, inputName } = route; | ||
source.plug(destination, outputName, inputName); | ||
const source = Engine.findById(sourceId); | ||
const destination = Engine.findById(destinationId); | ||
return true; | ||
}); | ||
source.plug(destination, outputName, inputName); | ||
return true; | ||
}); | ||
if (succesedConnections.every((v) => v)) { | ||
@@ -38,0 +45,0 @@ console.log("######## Routes succesfully applied"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
184767
115
4340