webpd
Version:
WebPd is a compiler for audio programming language Pure Data allowing to run .pd patches on web pages.
35 lines (34 loc) • 1.85 kB
TypeScript
import { NodeBuilders } from './types';
import { AbstractionLoader, AbstractionsLoadingErrors, AbstractionsLoadingWarnings } from './instantiate-abstractions';
import { DspGraph } from '@webpd/compiler';
import { PdJson } from '@webpd/pd-parser';
type PatchPath = Array<PdJson.Patch>;
export type Compilation = {
readonly pd: PdJson.Pd;
readonly graph: DspGraph.Graph;
readonly nodeBuilders: NodeBuilders;
};
export interface CompilationSuccess {
readonly status: 0;
readonly graph: DspGraph.Graph;
readonly arrays: DspGraph.Arrays;
/** PdJson.Pd with all abstractions resolved. */
readonly pd: PdJson.Pd;
readonly abstractionsLoadingWarnings?: AbstractionsLoadingWarnings;
}
export interface CompilationFailure {
readonly status: 1;
readonly abstractionsLoadingErrors: AbstractionsLoadingErrors;
readonly abstractionsLoadingWarnings?: AbstractionsLoadingWarnings;
}
type CompilationResult = CompilationSuccess | CompilationFailure;
export declare const buildGraphNodeId: (patchId: PdJson.GlobalId, nodeLocalId: PdJson.LocalId) => DspGraph.NodeId;
export declare const buildGraphPortletId: (pdPortletId: PdJson.PortletId) => string;
declare const _default: (pd: PdJson.Pd, nodeBuilders: NodeBuilders, abstractionLoader?: AbstractionLoader) => Promise<CompilationResult>;
export default _default;
export declare const _buildNodes: (compilation: Compilation, patchPath: PatchPath) => void;
export declare const _buildConnections: (compilation: Compilation, rootPatchPath: PatchPath) => void;
export declare const _traversePatches: (compilation: Compilation, patchPath: PatchPath, func: (compilation: Compilation, patchPath: PatchPath) => void) => void;
export declare const _FOR_TESTING: {
_buildImplicitGraphNodeId: (sink: DspGraph.ConnectionEndpoint, nodeType: DspGraph.NodeType) => DspGraph.NodeId;
};