UNPKG

spessasynth_lib

Version:

MIDI and SoundFont2/DLS library with no compromises

27 lines (24 loc) 823 B
import { WorkletProcessorChannel } from "../worklet_utilities/worklet_processor_channel.js"; import { DEFAULT_PERCUSSION } from "../../synth_constants.js"; /** * @param sendEvent {boolean} * @this {SpessaSynthProcessor} */ export function createWorkletChannel(sendEvent = false) { /** * @type {WorkletProcessorChannel} */ const channel = new WorkletProcessorChannel(this, this.defaultPreset, this.workletProcessorChannels.length); this.workletProcessorChannels.push(channel); channel.resetControllers(); channel.sendChannelProperty(); if (sendEvent) { this.callEvent("newchannel", undefined); } if (channel.channelNumber % 16 === DEFAULT_PERCUSSION) { this.workletProcessorChannels[this.workletProcessorChannels.length - 1].setDrums(true); } }