@webmusic/kernel 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -21
- package/NOTICE +2 -0
- package/README.md +103 -64
- package/dist/audio-context.cjs.map +1 -1
- package/dist/build-receipt.json +3 -3
- package/dist/chunk-27LH6QLZ.cjs +277 -0
- package/dist/chunk-27LH6QLZ.cjs.map +1 -0
- package/dist/chunk-3INDOVUC.cjs.map +1 -1
- package/dist/chunk-3RR2VIKA.js +393 -0
- package/dist/chunk-3RR2VIKA.js.map +1 -0
- package/dist/chunk-3YTKIKKX.cjs +378 -0
- package/dist/chunk-3YTKIKKX.cjs.map +1 -0
- package/dist/chunk-4RG4WQKC.js +360 -0
- package/dist/chunk-4RG4WQKC.js.map +1 -0
- package/dist/chunk-5AHVQXTF.cjs +620 -0
- package/dist/chunk-5AHVQXTF.cjs.map +1 -0
- package/dist/chunk-624KWJWZ.js +170 -0
- package/dist/chunk-624KWJWZ.js.map +1 -0
- package/dist/chunk-6HGFEKD3.cjs +851 -0
- package/dist/chunk-6HGFEKD3.cjs.map +1 -0
- package/dist/chunk-7ZTZZ5PN.cjs.map +1 -1
- package/dist/chunk-ALWV4P7D.js +726 -0
- package/dist/chunk-ALWV4P7D.js.map +1 -0
- package/dist/chunk-BADJJ6DV.cjs +143 -0
- package/dist/chunk-BADJJ6DV.cjs.map +1 -0
- package/dist/chunk-C3LMS36L.cjs +393 -0
- package/dist/chunk-C3LMS36L.cjs.map +1 -0
- package/dist/chunk-C3YWUZW3.cjs.map +1 -1
- package/dist/chunk-CR6OUWBJ.cjs +726 -0
- package/dist/chunk-CR6OUWBJ.cjs.map +1 -0
- package/dist/chunk-CYWDZLWC.js +2141 -0
- package/dist/chunk-CYWDZLWC.js.map +1 -0
- package/dist/chunk-DDOGX2D5.js +378 -0
- package/dist/chunk-DDOGX2D5.js.map +1 -0
- package/dist/chunk-DVN6E5U3.js +620 -0
- package/dist/chunk-DVN6E5U3.js.map +1 -0
- package/dist/chunk-EURMRU2S.js +208 -0
- package/dist/chunk-EURMRU2S.js.map +1 -0
- package/dist/chunk-EXDCK2VL.cjs +20 -0
- package/dist/chunk-EXDCK2VL.cjs.map +1 -0
- package/dist/chunk-G5EIUP52.js +114 -0
- package/dist/chunk-G5EIUP52.js.map +1 -0
- package/dist/chunk-GB4DGKLZ.js +143 -0
- package/dist/chunk-GB4DGKLZ.js.map +1 -0
- package/dist/chunk-GPOEAYOW.js +2147 -0
- package/dist/chunk-GPOEAYOW.js.map +1 -0
- package/dist/chunk-I4YMA5VM.cjs +120 -0
- package/dist/chunk-I4YMA5VM.cjs.map +1 -0
- package/dist/chunk-IVWHMDCB.cjs +4383 -0
- package/dist/chunk-IVWHMDCB.cjs.map +1 -0
- package/dist/chunk-JFCBJMA7.cjs +2147 -0
- package/dist/chunk-JFCBJMA7.cjs.map +1 -0
- package/dist/chunk-JLVSAZ3K.cjs +813 -0
- package/dist/chunk-JLVSAZ3K.cjs.map +1 -0
- package/dist/chunk-K7FYH6UG.cjs +208 -0
- package/dist/chunk-K7FYH6UG.cjs.map +1 -0
- package/dist/chunk-L4MYCETM.cjs +970 -0
- package/dist/chunk-L4MYCETM.cjs.map +1 -0
- package/dist/chunk-MNCMYNYL.js +970 -0
- package/dist/chunk-MNCMYNYL.js.map +1 -0
- package/dist/chunk-NT2BZ3QM.js +120 -0
- package/dist/chunk-NT2BZ3QM.js.map +1 -0
- package/dist/chunk-O7SA5GLC.js +277 -0
- package/dist/chunk-O7SA5GLC.js.map +1 -0
- package/dist/chunk-OCKAHITL.cjs +548 -0
- package/dist/chunk-OCKAHITL.cjs.map +1 -0
- package/dist/chunk-OTXYWCLA.js +206 -0
- package/dist/chunk-OTXYWCLA.js.map +1 -0
- package/dist/chunk-P6ZA63J7.js +548 -0
- package/dist/chunk-P6ZA63J7.js.map +1 -0
- package/dist/chunk-QLF3BOST.js +20 -0
- package/dist/chunk-QLF3BOST.js.map +1 -0
- package/dist/chunk-RCWFRZDR.js +4383 -0
- package/dist/chunk-RCWFRZDR.js.map +1 -0
- package/dist/chunk-RZBLPM3L.cjs +206 -0
- package/dist/chunk-RZBLPM3L.cjs.map +1 -0
- package/dist/chunk-TA3TNJZU.cjs +360 -0
- package/dist/chunk-TA3TNJZU.cjs.map +1 -0
- package/dist/chunk-TZSRPTQL.cjs +2141 -0
- package/dist/chunk-TZSRPTQL.cjs.map +1 -0
- package/dist/chunk-UMTPJ76S.cjs.map +1 -1
- package/dist/chunk-UY77FXDW.js +813 -0
- package/dist/chunk-UY77FXDW.js.map +1 -0
- package/dist/chunk-VFU3S7OC.js +851 -0
- package/dist/chunk-VFU3S7OC.js.map +1 -0
- package/dist/chunk-VY6WWZSW.cjs.map +1 -1
- package/dist/chunk-WN5DZOVT.cjs +170 -0
- package/dist/chunk-WN5DZOVT.cjs.map +1 -0
- package/dist/chunk-WOPW6WLR.cjs.map +1 -1
- package/dist/chunk-XBSIYUHM.cjs +114 -0
- package/dist/chunk-XBSIYUHM.cjs.map +1 -0
- package/dist/chunk-ZMU72HJS.cjs.map +1 -1
- package/dist/context-DSa0ymyN.d.cts +664 -0
- package/dist/context-DaxfAg3b.d.ts +664 -0
- package/dist/effect-chain-Cu03O5Y0.d.ts +91 -0
- package/dist/effect-chain-Do75T7uK.d.cts +91 -0
- package/dist/effect.cjs +16 -1
- package/dist/effect.cjs.map +1 -1
- package/dist/effect.d.cts +56 -14
- package/dist/effect.d.ts +56 -14
- package/dist/effect.js +16 -1
- package/dist/elements.cjs +37 -2
- package/dist/elements.cjs.map +1 -1
- package/dist/elements.d.cts +197 -8
- package/dist/elements.d.ts +197 -8
- package/dist/elements.js +36 -1
- package/dist/events.cjs.map +1 -1
- package/dist/index.cjs +555 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +566 -19
- package/dist/message.cjs +104 -0
- package/dist/message.cjs.map +1 -0
- package/dist/message.d.cts +738 -0
- package/dist/message.d.ts +738 -0
- package/dist/message.js +104 -0
- package/dist/meter.cjs.map +1 -1
- package/dist/module-control-C25BMtH7.d.ts +61 -0
- package/dist/module-control-yH6nTJM9.d.cts +61 -0
- package/dist/module-plugin-BnPmq1VP.d.ts +198 -0
- package/dist/module-plugin-CHb-5W0Y.d.cts +198 -0
- package/dist/module.cjs +263 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +1112 -0
- package/dist/module.d.ts +1112 -0
- package/dist/module.js +263 -0
- package/dist/parameter-DwQzFmBR.d.cts +172 -0
- package/dist/parameter-DwQzFmBR.d.ts +172 -0
- package/dist/player.cjs.map +1 -1
- package/dist/processor-worklet.cjs +18 -0
- package/dist/processor-worklet.cjs.map +1 -0
- package/dist/processor-worklet.d.cts +166 -0
- package/dist/processor-worklet.d.ts +166 -0
- package/dist/processor-worklet.js +18 -0
- package/dist/processor-worklet.js.map +1 -0
- package/dist/processor.cjs +51 -0
- package/dist/processor.cjs.map +1 -0
- package/dist/processor.d.cts +397 -0
- package/dist/processor.d.ts +397 -0
- package/dist/processor.js +51 -0
- package/dist/processor.js.map +1 -0
- package/dist/project-types-BU4awMnL.d.ts +323 -0
- package/dist/project-types-DufCV8Ma.d.cts +323 -0
- package/dist/ring-C-i9N90a.d.cts +139 -0
- package/dist/ring-DkcMt2Eg.d.ts +139 -0
- package/dist/sequence.cjs +68 -0
- package/dist/sequence.cjs.map +1 -0
- package/dist/sequence.d.cts +303 -0
- package/dist/sequence.d.ts +303 -0
- package/dist/sequence.js +68 -0
- package/dist/sequence.js.map +1 -0
- package/dist/session.cjs +16 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +407 -0
- package/dist/session.d.ts +407 -0
- package/dist/session.js +16 -0
- package/dist/session.js.map +1 -0
- package/dist/tick.cjs.map +1 -1
- package/dist/transport.cjs +50 -2
- package/dist/transport.cjs.map +1 -1
- package/dist/transport.d.cts +145 -1
- package/dist/transport.d.ts +145 -1
- package/dist/transport.js +51 -3
- package/dist/worker.cjs.map +1 -1
- package/package.json +61 -10
- package/dist/chunk-53YD73OY.js +0 -162
- package/dist/chunk-53YD73OY.js.map +0 -1
- package/dist/chunk-54JYWB5X.cjs +0 -1051
- package/dist/chunk-54JYWB5X.cjs.map +0 -1
- package/dist/chunk-BR63OD53.cjs +0 -1
- package/dist/chunk-BR63OD53.cjs.map +0 -1
- package/dist/chunk-ON64FRCF.js +0 -1051
- package/dist/chunk-ON64FRCF.js.map +0 -1
- package/dist/chunk-SM5YPDDI.cjs +0 -162
- package/dist/chunk-SM5YPDDI.cjs.map +0 -1
- package/dist/chunk-TEM2I2NN.js +0 -1
- package/dist/chunk-VVZX7DQ6.cjs +0 -254
- package/dist/chunk-VVZX7DQ6.cjs.map +0 -1
- package/dist/chunk-WNFGDB7B.js +0 -254
- package/dist/chunk-WNFGDB7B.js.map +0 -1
- package/dist/sync.cjs +0 -12
- package/dist/sync.cjs.map +0 -1
- package/dist/sync.d.cts +0 -307
- package/dist/sync.d.ts +0 -307
- package/dist/sync.js +0 -12
- /package/dist/{chunk-TEM2I2NN.js.map → message.js.map} +0 -0
- /package/dist/{sync.js.map → module.js.map} +0 -0
|
@@ -0,0 +1,738 @@
|
|
|
1
|
+
import { j as Message, l as MessageInputPort, n as MessageOutputPort, A as Atom, J as JsonValue } from './context-DSa0ymyN.cjs';
|
|
2
|
+
import { G as GraphModule, a as GraphModuleOptions, d as ModuleOptionsJson, i as ScriptWorkerLike, c as ModuleEnvironment } from './module-plugin-CHb-5W0Y.cjs';
|
|
3
|
+
export { S as SCRIPT_PRELUDE, g as ScriptSandbox, h as ScriptSandboxOptions, s as scriptAtom, o as scriptMessage } from './module-plugin-CHb-5W0Y.cjs';
|
|
4
|
+
import { C as ControlModule, d as OscPacket } from './module-control-yH6nTJM9.cjs';
|
|
5
|
+
import { a as ControlSignal } from './parameter-DwQzFmBR.cjs';
|
|
6
|
+
import { x as ProjectPluginFactory } from './project-types-DufCV8Ma.cjs';
|
|
7
|
+
import './tick.cjs';
|
|
8
|
+
import './session.cjs';
|
|
9
|
+
import './transport.cjs';
|
|
10
|
+
import './effect-chain-Do75T7uK.cjs';
|
|
11
|
+
|
|
12
|
+
/** A number or a word, as options and function arguments carry them. */
|
|
13
|
+
type MessageValue = number | string;
|
|
14
|
+
/** The atom of a value: an integer is an int, another number a float, a string a symbol. */
|
|
15
|
+
declare function atomOf(value: MessageValue, float?: boolean): Atom;
|
|
16
|
+
/** A number message of the right type. */
|
|
17
|
+
declare const numberMessage: (value: number, float: boolean, time?: number) => Message;
|
|
18
|
+
interface FunctionPortSpec {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly label: string;
|
|
21
|
+
}
|
|
22
|
+
/** What a function's module instance may use. */
|
|
23
|
+
interface FunctionHost {
|
|
24
|
+
/** Send from output `index`. */
|
|
25
|
+
send(index: number, message: Message): void;
|
|
26
|
+
/** Uniform numbers in [0, 1). */
|
|
27
|
+
readonly random: () => number;
|
|
28
|
+
/** Write one line for the function named `name`. */
|
|
29
|
+
print(name: string, text: string): void;
|
|
30
|
+
}
|
|
31
|
+
/** One function at work in a graph: it holds the operands its inputs store. */
|
|
32
|
+
interface FunctionInstance {
|
|
33
|
+
receive(index: number, message: Message): void;
|
|
34
|
+
}
|
|
35
|
+
/** How a function is placed in a graph: its module type, options and ports. */
|
|
36
|
+
interface FunctionBinding<Options> {
|
|
37
|
+
/** The module type it is saved as, such as `webmusic.scale`. */
|
|
38
|
+
readonly type: string;
|
|
39
|
+
/** Complete options from partial or saved ones. Throws a TypeError, RangeError or SyntaxError that names the problem. */
|
|
40
|
+
options(input: unknown): Options;
|
|
41
|
+
inputs(options: Options): readonly FunctionPortSpec[];
|
|
42
|
+
outputs(options: Options): readonly FunctionPortSpec[];
|
|
43
|
+
bind(options: Options, host: FunctionHost): FunctionInstance;
|
|
44
|
+
}
|
|
45
|
+
/** A function a graph can place. */
|
|
46
|
+
interface MessageFunction<Options> {
|
|
47
|
+
readonly module: FunctionBinding<Options>;
|
|
48
|
+
}
|
|
49
|
+
interface FunctionModuleOptions<Options> extends GraphModuleOptions {
|
|
50
|
+
/** The function's options; absent ones take their defaults. */
|
|
51
|
+
readonly options?: Partial<Options>;
|
|
52
|
+
/** Uniform numbers in [0, 1) for functions that draw one. Defaults to `Math.random`. */
|
|
53
|
+
readonly random?: () => number;
|
|
54
|
+
/** Where a printing function writes. Defaults to `console.log`. */
|
|
55
|
+
readonly print?: (name: string, text: string) => void;
|
|
56
|
+
}
|
|
57
|
+
/** The one Headless adapter that gives a message function ports. */
|
|
58
|
+
declare class FunctionModule<Options extends object = object> extends GraphModule {
|
|
59
|
+
#private;
|
|
60
|
+
/** The message inputs, by port ID. */
|
|
61
|
+
readonly inputs: Readonly<Record<string, MessageInputPort>>;
|
|
62
|
+
/** The message outputs, by port ID. */
|
|
63
|
+
readonly outputs: Readonly<Record<string, MessageOutputPort>>;
|
|
64
|
+
constructor(fn: MessageFunction<Options>, init?: FunctionModuleOptions<Options>);
|
|
65
|
+
/** The options it was made with. Operands stored through an input are not saved. */
|
|
66
|
+
get options(): Options;
|
|
67
|
+
exportOptions(): ModuleOptionsJson;
|
|
68
|
+
}
|
|
69
|
+
/** A module with ports that calls `fn` as messages arrive. */
|
|
70
|
+
declare function functionModule<Options extends object>(fn: MessageFunction<Options>, init?: FunctionModuleOptions<Options>): FunctionModule<Options>;
|
|
71
|
+
interface ScaleOptions {
|
|
72
|
+
readonly inLow: number;
|
|
73
|
+
readonly inHigh: number;
|
|
74
|
+
readonly outLow: number;
|
|
75
|
+
readonly outHigh: number;
|
|
76
|
+
/** Curve of the mapping; 1 is linear. */
|
|
77
|
+
readonly exponent?: number;
|
|
78
|
+
/** In a graph, send floats even for an int input. */
|
|
79
|
+
readonly float?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** Map `value` from the input range onto the output range. Values outside the input range extend the line. */
|
|
82
|
+
declare const scale: ((value: number, range: ScaleOptions) => number) & MessageFunction<ScaleOptions>;
|
|
83
|
+
interface SelectOptions {
|
|
84
|
+
readonly matches: readonly MessageValue[];
|
|
85
|
+
}
|
|
86
|
+
/** The index of the first of `matches` that equals `value`, or -1. Numbers compare by value, whatever their type. */
|
|
87
|
+
declare const select: ((value: MessageValue | Atom | undefined, matches: readonly MessageValue[]) => number) & MessageFunction<SelectOptions>;
|
|
88
|
+
interface RouteOptions {
|
|
89
|
+
readonly keys: readonly MessageValue[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Route a message by its first element: the index of the key it starts with
|
|
93
|
+
* and the rest of the message, or -1 and the message itself.
|
|
94
|
+
*/
|
|
95
|
+
declare const route: ((value: Message, keys: readonly MessageValue[]) => {
|
|
96
|
+
index: number;
|
|
97
|
+
message: Message;
|
|
98
|
+
}) & MessageFunction<RouteOptions>;
|
|
99
|
+
/** What one trigger output sends: a conversion of the input, or a fixed value. */
|
|
100
|
+
type TriggerOutput = 'bang' | 'int' | 'float' | 'symbol' | 'list' | 'any' | {
|
|
101
|
+
readonly value: MessageValue;
|
|
102
|
+
readonly float?: boolean;
|
|
103
|
+
};
|
|
104
|
+
interface TriggerOptions {
|
|
105
|
+
readonly outputs: readonly TriggerOutput[];
|
|
106
|
+
}
|
|
107
|
+
/** One message per output, each a conversion of `value`, in output order. A graph sends them right to left. */
|
|
108
|
+
declare const trigger: ((value: Message, outputs: readonly TriggerOutput[]) => Message[]) & MessageFunction<TriggerOptions>;
|
|
109
|
+
type SlotType = 'int' | 'float' | 'symbol';
|
|
110
|
+
/** One element of a packed list: its type, and the value it holds until one arrives. */
|
|
111
|
+
type Slot = SlotType | {
|
|
112
|
+
readonly type: SlotType;
|
|
113
|
+
readonly value?: MessageValue;
|
|
114
|
+
};
|
|
115
|
+
interface SlotOptions {
|
|
116
|
+
readonly slots: readonly Slot[];
|
|
117
|
+
}
|
|
118
|
+
/** A list of `values`, each made the type of its slot; a slot with no value keeps its own. */
|
|
119
|
+
declare const pack: ((slots: readonly Slot[], values?: readonly (MessageValue | Atom)[], time?: number) => Message) & MessageFunction<SlotOptions>;
|
|
120
|
+
/** One message per slot from a list, each made the type of its slot; undefined where the list is shorter. */
|
|
121
|
+
declare const unpack: ((value: Message, slots: readonly Slot[]) => (Message | undefined)[]) & MessageFunction<SlotOptions>;
|
|
122
|
+
interface ExprOptions {
|
|
123
|
+
readonly expression: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Evaluate an expression of the `compileExpr` language with `inputs` as
|
|
127
|
+
* `$i1`, `$f2`…. Compile once with `compileExpr` to evaluate many times.
|
|
128
|
+
*/
|
|
129
|
+
declare const expr: ((expression: string, inputs?: readonly number[], random?: () => number) => number) & MessageFunction<ExprOptions>;
|
|
130
|
+
/** A repeatable generator of uniform numbers in [0, 1) from a seed (mulberry32). */
|
|
131
|
+
declare function seededRandom(seed: number): () => number;
|
|
132
|
+
interface RandomOptions {
|
|
133
|
+
/** Results are 0 to `range` − 1. Default 2. */
|
|
134
|
+
readonly range?: number;
|
|
135
|
+
/** A seed makes the series repeat; without one each instance draws from its host. */
|
|
136
|
+
readonly seed?: number;
|
|
137
|
+
}
|
|
138
|
+
/** A random integer from 0 to `range` − 1, drawn from `next`. */
|
|
139
|
+
declare const random: ((range: number, next?: () => number) => number) & MessageFunction<RandomOptions>;
|
|
140
|
+
interface PrintOptions {
|
|
141
|
+
readonly name?: string;
|
|
142
|
+
}
|
|
143
|
+
/** Write a message as text, as `name: text`, and return that line. */
|
|
144
|
+
declare const print: ((value: Message, name?: string, write?: (line: string) => void) => string) & MessageFunction<PrintOptions>;
|
|
145
|
+
/** Every message function, for a host that registers or lists them. */
|
|
146
|
+
declare const MESSAGE_FUNCTIONS: readonly MessageFunction<never>[];
|
|
147
|
+
|
|
148
|
+
interface ExprValue {
|
|
149
|
+
readonly value: number;
|
|
150
|
+
readonly float: boolean;
|
|
151
|
+
}
|
|
152
|
+
interface CompiledExpr {
|
|
153
|
+
/** Number of inlets the expression reads (at least 1). */
|
|
154
|
+
readonly inlets: number;
|
|
155
|
+
/** Evaluate with inlet values; missing inlets read 0. */
|
|
156
|
+
evaluate(inputs: readonly number[], random?: () => number): ExprValue;
|
|
157
|
+
}
|
|
158
|
+
/** Parse an expression. Throws a SyntaxError naming the problem. */
|
|
159
|
+
declare function compileExpr(source: string): CompiledExpr;
|
|
160
|
+
|
|
161
|
+
/** Sends a bang when it is activated, and again for anything at its input. */
|
|
162
|
+
declare class LoadBang extends GraphModule {
|
|
163
|
+
static readonly type = "webmusic.load-bang";
|
|
164
|
+
readonly inputs: {
|
|
165
|
+
trigger: MessageInputPort;
|
|
166
|
+
};
|
|
167
|
+
readonly outputs: {
|
|
168
|
+
bang: MessageOutputPort;
|
|
169
|
+
};
|
|
170
|
+
constructor(options?: GraphModuleOptions);
|
|
171
|
+
protected onActivate(): void;
|
|
172
|
+
exportOptions(): ModuleOptionsJson;
|
|
173
|
+
}
|
|
174
|
+
interface MetroOptions extends GraphModuleOptions {
|
|
175
|
+
/** Milliseconds, or a time value (`4n`, `8nt`, `1.0.0`) that follows the Session's transport. Default 500. */
|
|
176
|
+
readonly interval?: number | string;
|
|
177
|
+
/** Start ticking when activated. Default false. */
|
|
178
|
+
readonly running?: boolean;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A metronome. A millisecond interval ticks on the clock from its start; a
|
|
182
|
+
* time value ticks on the transport's grid, only while the Session plays.
|
|
183
|
+
*/
|
|
184
|
+
declare class Metro extends GraphModule {
|
|
185
|
+
#private;
|
|
186
|
+
static readonly type = "webmusic.metro";
|
|
187
|
+
readonly inputs: {
|
|
188
|
+
control: MessageInputPort;
|
|
189
|
+
interval: MessageInputPort;
|
|
190
|
+
};
|
|
191
|
+
readonly outputs: {
|
|
192
|
+
ticks: MessageOutputPort;
|
|
193
|
+
};
|
|
194
|
+
constructor(options?: MetroOptions);
|
|
195
|
+
/** Whether the metronome is on. A transport-locked one ticks only while the Session plays. */
|
|
196
|
+
get running(): boolean;
|
|
197
|
+
/** The interval: milliseconds, or the time value it follows. */
|
|
198
|
+
get interval(): number | string;
|
|
199
|
+
/** Turn it on from `time` (now by default). Activates the module if it is not yet active. */
|
|
200
|
+
start(time?: number): void;
|
|
201
|
+
stop(): void;
|
|
202
|
+
exportOptions(): ModuleOptionsJson;
|
|
203
|
+
protected onActivate(): void;
|
|
204
|
+
protected onDispose(): void;
|
|
205
|
+
}
|
|
206
|
+
interface DelayOptions extends GraphModuleOptions {
|
|
207
|
+
/** Delay in milliseconds. Default 0. */
|
|
208
|
+
readonly time?: number;
|
|
209
|
+
}
|
|
210
|
+
/** Sends one bang a time after it is triggered; a new trigger replaces the pending one. */
|
|
211
|
+
declare class Delay extends GraphModule {
|
|
212
|
+
#private;
|
|
213
|
+
static readonly type = "webmusic.delay";
|
|
214
|
+
readonly inputs: {
|
|
215
|
+
trigger: MessageInputPort;
|
|
216
|
+
time: MessageInputPort;
|
|
217
|
+
};
|
|
218
|
+
readonly outputs: {
|
|
219
|
+
bang: MessageOutputPort;
|
|
220
|
+
};
|
|
221
|
+
constructor(options?: DelayOptions);
|
|
222
|
+
/** The delay, in milliseconds. */
|
|
223
|
+
get time(): number;
|
|
224
|
+
set time(value: number);
|
|
225
|
+
/** Send the bang `time` milliseconds after `from` (now by default). */
|
|
226
|
+
trigger(from?: number): void;
|
|
227
|
+
/** Drop the pending bang. */
|
|
228
|
+
cancel(): void;
|
|
229
|
+
exportOptions(): ModuleOptionsJson;
|
|
230
|
+
protected onDispose(): void;
|
|
231
|
+
}
|
|
232
|
+
/** Sends every value it receives a time later, each on its own. */
|
|
233
|
+
declare class Pipe extends GraphModule {
|
|
234
|
+
#private;
|
|
235
|
+
static readonly type = "webmusic.pipe";
|
|
236
|
+
readonly inputs: {
|
|
237
|
+
value: MessageInputPort;
|
|
238
|
+
time: MessageInputPort;
|
|
239
|
+
};
|
|
240
|
+
readonly outputs: {
|
|
241
|
+
value: MessageOutputPort;
|
|
242
|
+
};
|
|
243
|
+
constructor(options?: DelayOptions);
|
|
244
|
+
/** The delay, in milliseconds. */
|
|
245
|
+
get time(): number;
|
|
246
|
+
set time(value: number);
|
|
247
|
+
/** Send `value` from the output after the delay, counted from its own time. */
|
|
248
|
+
send(value: Message): void;
|
|
249
|
+
/** Drop every value still waiting. */
|
|
250
|
+
clear(): void;
|
|
251
|
+
exportOptions(): ModuleOptionsJson;
|
|
252
|
+
protected onDispose(): void;
|
|
253
|
+
}
|
|
254
|
+
interface LineOptions extends GraphModuleOptions {
|
|
255
|
+
/** Where the ramp starts. Default 0. */
|
|
256
|
+
readonly value?: number;
|
|
257
|
+
/** Milliseconds between the values of a ramp. Default 20. */
|
|
258
|
+
readonly grain?: number;
|
|
259
|
+
/** Send floats; otherwise each value is rounded to an int. Default false. */
|
|
260
|
+
readonly float?: boolean;
|
|
261
|
+
}
|
|
262
|
+
/** Ramps to a target in steps: one value every `grain` milliseconds, then a bang. */
|
|
263
|
+
declare class Line extends GraphModule {
|
|
264
|
+
#private;
|
|
265
|
+
static readonly type = "webmusic.line";
|
|
266
|
+
readonly inputs: {
|
|
267
|
+
target: MessageInputPort;
|
|
268
|
+
time: MessageInputPort;
|
|
269
|
+
grain: MessageInputPort;
|
|
270
|
+
};
|
|
271
|
+
readonly outputs: {
|
|
272
|
+
value: MessageOutputPort;
|
|
273
|
+
done: MessageOutputPort;
|
|
274
|
+
};
|
|
275
|
+
constructor(options?: LineOptions);
|
|
276
|
+
/** The value the ramp has reached. */
|
|
277
|
+
get value(): number;
|
|
278
|
+
/** Ramp to `target` over `duration` milliseconds from `start` (now by default); 0 jumps. */
|
|
279
|
+
ramp(target: number, duration?: number, start?: number): void;
|
|
280
|
+
/** Stop where the ramp is. */
|
|
281
|
+
stop(): void;
|
|
282
|
+
exportOptions(): ModuleOptionsJson;
|
|
283
|
+
protected onDispose(): void;
|
|
284
|
+
}
|
|
285
|
+
interface CounterOptions extends GraphModuleOptions {
|
|
286
|
+
/** The first value, and where the count returns after `maximum`. Default 0. */
|
|
287
|
+
readonly minimum?: number;
|
|
288
|
+
/** The last value before the count wraps. Absent: it never wraps. */
|
|
289
|
+
readonly maximum?: number;
|
|
290
|
+
/** The value the next count sends. Defaults to `minimum`. */
|
|
291
|
+
readonly next?: number;
|
|
292
|
+
}
|
|
293
|
+
/** Counts up by one for each bang and reports when it wraps. */
|
|
294
|
+
declare class Counter extends GraphModule {
|
|
295
|
+
#private;
|
|
296
|
+
static readonly type = "webmusic.counter";
|
|
297
|
+
readonly inputs: {
|
|
298
|
+
trigger: MessageInputPort;
|
|
299
|
+
next: MessageInputPort;
|
|
300
|
+
};
|
|
301
|
+
readonly outputs: {
|
|
302
|
+
count: MessageOutputPort;
|
|
303
|
+
wrap: MessageOutputPort;
|
|
304
|
+
};
|
|
305
|
+
constructor(options?: CounterOptions);
|
|
306
|
+
/** The value the next count sends. */
|
|
307
|
+
get next(): number;
|
|
308
|
+
set next(value: number);
|
|
309
|
+
/** Send the count and advance it; returns the value sent. */
|
|
310
|
+
count(time?: number): number;
|
|
311
|
+
/** Return to the minimum without sending. */
|
|
312
|
+
reset(): void;
|
|
313
|
+
exportOptions(): ModuleOptionsJson;
|
|
314
|
+
}
|
|
315
|
+
interface GateOptions extends GraphModuleOptions {
|
|
316
|
+
/** How many outputs (gate) or inputs (switch) there are to choose among. */
|
|
317
|
+
readonly count?: number;
|
|
318
|
+
/** Which one is open, counted from 1; 0 closes all. Default 0. */
|
|
319
|
+
readonly open?: number;
|
|
320
|
+
}
|
|
321
|
+
/** Passes messages to the one output that is open. */
|
|
322
|
+
declare class Gate extends GraphModule {
|
|
323
|
+
#private;
|
|
324
|
+
static readonly type = "webmusic.gate";
|
|
325
|
+
readonly inputs: {
|
|
326
|
+
readonly open: MessageInputPort;
|
|
327
|
+
readonly message: MessageInputPort;
|
|
328
|
+
};
|
|
329
|
+
/** `out0`, `out1`…, one for each output. */
|
|
330
|
+
readonly outputs: Readonly<Record<string, MessageOutputPort>>;
|
|
331
|
+
constructor(options?: GateOptions);
|
|
332
|
+
/** The open output, counted from 1; 0 when closed. */
|
|
333
|
+
get open(): number;
|
|
334
|
+
set open(value: number);
|
|
335
|
+
exportOptions(): ModuleOptionsJson;
|
|
336
|
+
}
|
|
337
|
+
/** Passes the messages of the one input that is open. */
|
|
338
|
+
declare class Switch extends GraphModule {
|
|
339
|
+
#private;
|
|
340
|
+
static readonly type = "webmusic.switch";
|
|
341
|
+
/** `in0` chooses the open input; `in1`, `in2`… are the inputs. */
|
|
342
|
+
readonly inputs: Readonly<Record<string, MessageInputPort>>;
|
|
343
|
+
readonly outputs: {
|
|
344
|
+
readonly message: MessageOutputPort;
|
|
345
|
+
};
|
|
346
|
+
constructor(options?: GateOptions);
|
|
347
|
+
/** The open input, counted from 1; 0 when closed. */
|
|
348
|
+
get open(): number;
|
|
349
|
+
set open(value: number);
|
|
350
|
+
exportOptions(): ModuleOptionsJson;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** Sends a bang for anything it receives and counts its flashes. */
|
|
354
|
+
declare class Button extends ControlModule {
|
|
355
|
+
#private;
|
|
356
|
+
static readonly type = "webmusic.button";
|
|
357
|
+
readonly kind = "button";
|
|
358
|
+
readonly inputs: {
|
|
359
|
+
trigger: MessageInputPort;
|
|
360
|
+
};
|
|
361
|
+
readonly outputs: {
|
|
362
|
+
bang: MessageOutputPort;
|
|
363
|
+
};
|
|
364
|
+
constructor(options?: GraphModuleOptions);
|
|
365
|
+
/** How many times it has fired. */
|
|
366
|
+
get flashes(): number;
|
|
367
|
+
/** Fire: flash and send a bang at `time`. */
|
|
368
|
+
press(time?: number): void;
|
|
369
|
+
snapshot(): JsonValue;
|
|
370
|
+
exportOptions(): ModuleOptionsJson;
|
|
371
|
+
protected receive(value: Message): void;
|
|
372
|
+
}
|
|
373
|
+
interface ToggleOptions extends GraphModuleOptions {
|
|
374
|
+
/** Whether it starts on. Default false. */
|
|
375
|
+
readonly value?: boolean;
|
|
376
|
+
}
|
|
377
|
+
/** An on/off value: a bang flips it, a number sets it. */
|
|
378
|
+
declare class Toggle extends ControlModule {
|
|
379
|
+
#private;
|
|
380
|
+
static readonly type = "webmusic.toggle";
|
|
381
|
+
readonly kind = "toggle";
|
|
382
|
+
readonly inputs: {
|
|
383
|
+
value: MessageInputPort;
|
|
384
|
+
};
|
|
385
|
+
readonly outputs: {
|
|
386
|
+
value: MessageOutputPort;
|
|
387
|
+
};
|
|
388
|
+
constructor(options?: ToggleOptions);
|
|
389
|
+
get value(): boolean;
|
|
390
|
+
/** Set the value and send it; `silent` stores it without sending. */
|
|
391
|
+
set(on: boolean, options?: {
|
|
392
|
+
silent?: boolean;
|
|
393
|
+
time?: number;
|
|
394
|
+
}): void;
|
|
395
|
+
snapshot(): JsonValue;
|
|
396
|
+
exportOptions(): ModuleOptionsJson;
|
|
397
|
+
protected receive(value: Message): void;
|
|
398
|
+
}
|
|
399
|
+
interface NumberValueOptions extends GraphModuleOptions {
|
|
400
|
+
/** Which control shows it. Default `number`, a number box. */
|
|
401
|
+
readonly control?: 'number' | 'slider' | 'dial';
|
|
402
|
+
/** Lowest value. Default: none for a number box, 0 for a slider or dial. */
|
|
403
|
+
readonly min?: number;
|
|
404
|
+
/** Highest value. Default: none for a number box, 127 for a slider or dial. */
|
|
405
|
+
readonly max?: number;
|
|
406
|
+
/** Hold and send floats; otherwise values are rounded to ints. Default false. */
|
|
407
|
+
readonly float?: boolean;
|
|
408
|
+
/** The value it starts with. Default 0, moved into the range. */
|
|
409
|
+
readonly value?: number;
|
|
410
|
+
}
|
|
411
|
+
/** A number within a range, shown as a number box, a slider or a dial. */
|
|
412
|
+
declare class NumberValue extends ControlModule {
|
|
413
|
+
#private;
|
|
414
|
+
static readonly type = "webmusic.number";
|
|
415
|
+
readonly kind: 'number' | 'slider' | 'dial';
|
|
416
|
+
readonly inputs: {
|
|
417
|
+
value: MessageInputPort;
|
|
418
|
+
};
|
|
419
|
+
readonly outputs: {
|
|
420
|
+
value: MessageOutputPort;
|
|
421
|
+
};
|
|
422
|
+
readonly min: number;
|
|
423
|
+
readonly max: number;
|
|
424
|
+
readonly float: boolean;
|
|
425
|
+
constructor(options?: NumberValueOptions);
|
|
426
|
+
get value(): number;
|
|
427
|
+
/** Set the value, moved into the range, and send it; `silent` stores it without sending. */
|
|
428
|
+
set(value: number, options?: {
|
|
429
|
+
silent?: boolean;
|
|
430
|
+
time?: number;
|
|
431
|
+
}): void;
|
|
432
|
+
snapshot(): JsonValue;
|
|
433
|
+
exportOptions(): ModuleOptionsJson;
|
|
434
|
+
protected receive(input: Message): void;
|
|
435
|
+
}
|
|
436
|
+
interface ChoiceOptions extends GraphModuleOptions {
|
|
437
|
+
/** Which control shows it. Default `menu`. */
|
|
438
|
+
readonly control?: 'menu' | 'tab';
|
|
439
|
+
/** The items to choose among; at least one. */
|
|
440
|
+
readonly items: readonly string[];
|
|
441
|
+
/** The index chosen at the start. Default 0. */
|
|
442
|
+
readonly value?: number;
|
|
443
|
+
}
|
|
444
|
+
/** One of several named items, shown as a menu or as tabs. */
|
|
445
|
+
declare class Choice extends ControlModule {
|
|
446
|
+
#private;
|
|
447
|
+
static readonly type = "webmusic.choice";
|
|
448
|
+
readonly kind: 'menu' | 'tab';
|
|
449
|
+
readonly inputs: {
|
|
450
|
+
index: MessageInputPort;
|
|
451
|
+
};
|
|
452
|
+
readonly outputs: {
|
|
453
|
+
index: MessageOutputPort;
|
|
454
|
+
item: MessageOutputPort;
|
|
455
|
+
};
|
|
456
|
+
readonly items: readonly string[];
|
|
457
|
+
constructor(options: ChoiceOptions);
|
|
458
|
+
/** The chosen index. */
|
|
459
|
+
get value(): number;
|
|
460
|
+
/** Choose an index and send it; `silent` stores it without sending. */
|
|
461
|
+
set(index: number, options?: {
|
|
462
|
+
silent?: boolean;
|
|
463
|
+
time?: number;
|
|
464
|
+
}): void;
|
|
465
|
+
snapshot(): JsonValue;
|
|
466
|
+
exportOptions(): ModuleOptionsJson;
|
|
467
|
+
protected receive(value: Message): void;
|
|
468
|
+
}
|
|
469
|
+
interface MessageBoxOptions extends GraphModuleOptions {
|
|
470
|
+
/** The message text; commas separate messages sent one after another, and `$1`…`$9` take the input's values. */
|
|
471
|
+
readonly text?: string;
|
|
472
|
+
}
|
|
473
|
+
/** A message kept as text and sent when triggered. */
|
|
474
|
+
declare class MessageBox extends ControlModule {
|
|
475
|
+
#private;
|
|
476
|
+
static readonly type = "webmusic.message-box";
|
|
477
|
+
readonly kind = "message";
|
|
478
|
+
readonly inputs: {
|
|
479
|
+
trigger: MessageInputPort;
|
|
480
|
+
};
|
|
481
|
+
readonly outputs: {
|
|
482
|
+
message: MessageOutputPort;
|
|
483
|
+
};
|
|
484
|
+
constructor(options?: MessageBoxOptions);
|
|
485
|
+
get text(): string;
|
|
486
|
+
set text(value: string);
|
|
487
|
+
/** Send the text as messages, with `$1`… taken from `values`. */
|
|
488
|
+
send(values?: readonly Atom[], time?: number): void;
|
|
489
|
+
snapshot(): JsonValue;
|
|
490
|
+
exportOptions(): ModuleOptionsJson;
|
|
491
|
+
protected receive(value: Message): void;
|
|
492
|
+
}
|
|
493
|
+
interface ValueListOptions extends GraphModuleOptions {
|
|
494
|
+
/** How many values, 1 to 128. Default 8. */
|
|
495
|
+
readonly count?: number;
|
|
496
|
+
readonly min?: number;
|
|
497
|
+
readonly max?: number;
|
|
498
|
+
/** Hold floats. Default true. */
|
|
499
|
+
readonly float?: boolean;
|
|
500
|
+
/** The values it starts with; missing ones are `min`. */
|
|
501
|
+
readonly values?: readonly number[];
|
|
502
|
+
}
|
|
503
|
+
/** A list of numbers within one range, shown as a row of sliders. */
|
|
504
|
+
declare class ValueList extends ControlModule {
|
|
505
|
+
#private;
|
|
506
|
+
static readonly type = "webmusic.value-list";
|
|
507
|
+
readonly kind = "multislider";
|
|
508
|
+
readonly inputs: {
|
|
509
|
+
values: MessageInputPort;
|
|
510
|
+
};
|
|
511
|
+
readonly outputs: {
|
|
512
|
+
values: MessageOutputPort;
|
|
513
|
+
};
|
|
514
|
+
readonly min: number;
|
|
515
|
+
readonly max: number;
|
|
516
|
+
readonly float: boolean;
|
|
517
|
+
constructor(options?: ValueListOptions);
|
|
518
|
+
get values(): readonly number[];
|
|
519
|
+
/** Set values from the first on and send the list; `silent` stores them without sending. */
|
|
520
|
+
set(values: readonly number[], options?: {
|
|
521
|
+
silent?: boolean;
|
|
522
|
+
time?: number;
|
|
523
|
+
}): void;
|
|
524
|
+
snapshot(): JsonValue;
|
|
525
|
+
exportOptions(): ModuleOptionsJson;
|
|
526
|
+
protected receive(value: Message): void;
|
|
527
|
+
}
|
|
528
|
+
interface MatrixOptions extends GraphModuleOptions {
|
|
529
|
+
/** 1 to 32. Default 4. */
|
|
530
|
+
readonly columns?: number;
|
|
531
|
+
/** 1 to 32. Default 4. */
|
|
532
|
+
readonly rows?: number;
|
|
533
|
+
/** The cells by row, 0 or 1 each. */
|
|
534
|
+
readonly cells?: readonly number[];
|
|
535
|
+
}
|
|
536
|
+
/** A grid of on/off cells. */
|
|
537
|
+
declare class Matrix extends ControlModule {
|
|
538
|
+
#private;
|
|
539
|
+
static readonly type = "webmusic.matrix";
|
|
540
|
+
readonly kind = "matrix";
|
|
541
|
+
readonly inputs: {
|
|
542
|
+
cell: MessageInputPort;
|
|
543
|
+
};
|
|
544
|
+
readonly outputs: {
|
|
545
|
+
cell: MessageOutputPort;
|
|
546
|
+
};
|
|
547
|
+
readonly columns: number;
|
|
548
|
+
readonly rows: number;
|
|
549
|
+
constructor(options?: MatrixOptions);
|
|
550
|
+
/** The cells by row, 0 or 1 each. */
|
|
551
|
+
get cells(): readonly number[];
|
|
552
|
+
/** Set one cell and send it; `silent` stores it without sending. Cells outside the grid are ignored. */
|
|
553
|
+
set(column: number, row: number, on: boolean, options?: {
|
|
554
|
+
silent?: boolean;
|
|
555
|
+
time?: number;
|
|
556
|
+
}): void;
|
|
557
|
+
clear(): void;
|
|
558
|
+
snapshot(): JsonValue;
|
|
559
|
+
exportOptions(): ModuleOptionsJson;
|
|
560
|
+
protected receive(value: Message): void;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
interface ControlSourceOptions extends GraphModuleOptions {
|
|
564
|
+
/** The value it starts at. Default 0. */
|
|
565
|
+
readonly value?: number;
|
|
566
|
+
}
|
|
567
|
+
/** A control signal that jumps to each number it receives, on that message's sample. Needs a context. */
|
|
568
|
+
declare class ControlSource extends GraphModule {
|
|
569
|
+
#private;
|
|
570
|
+
static readonly type = "webmusic.control-source";
|
|
571
|
+
readonly inputs: {
|
|
572
|
+
value: MessageInputPort;
|
|
573
|
+
};
|
|
574
|
+
constructor(options?: ControlSourceOptions);
|
|
575
|
+
get control(): ControlSignal;
|
|
576
|
+
/** The last value it was set to. */
|
|
577
|
+
get value(): number;
|
|
578
|
+
/** Jump to `value` at `time` (now by default). */
|
|
579
|
+
set(value: number, time?: number): void;
|
|
580
|
+
exportOptions(): ModuleOptionsJson;
|
|
581
|
+
protected onDispose(): void;
|
|
582
|
+
}
|
|
583
|
+
/** A control signal that ramps through targets, then sends a bang. Needs a context. */
|
|
584
|
+
declare class ControlRamp extends GraphModule {
|
|
585
|
+
#private;
|
|
586
|
+
static readonly type = "webmusic.control-ramp";
|
|
587
|
+
readonly inputs: {
|
|
588
|
+
target: MessageInputPort;
|
|
589
|
+
};
|
|
590
|
+
readonly outputs: {
|
|
591
|
+
done: MessageOutputPort;
|
|
592
|
+
};
|
|
593
|
+
constructor(options?: ControlSourceOptions);
|
|
594
|
+
get control(): ControlSignal;
|
|
595
|
+
/** The value the signal has now. */
|
|
596
|
+
get value(): number;
|
|
597
|
+
/** Ramp through `[target, milliseconds]` pairs from `time` (now by default). */
|
|
598
|
+
ramp(pairs: readonly (readonly [number, number])[], time?: number): void;
|
|
599
|
+
/** Hold the value the signal has at `time` (now by default). */
|
|
600
|
+
stop(time?: number): void;
|
|
601
|
+
exportOptions(): ModuleOptionsJson;
|
|
602
|
+
protected onDispose(): void;
|
|
603
|
+
}
|
|
604
|
+
/** On a bang, the Session's position as `bar beat tick`, its tempo, its seconds and whether it plays. */
|
|
605
|
+
declare class TransportReadout extends GraphModule {
|
|
606
|
+
static readonly type = "webmusic.transport-readout";
|
|
607
|
+
readonly inputs: {
|
|
608
|
+
trigger: MessageInputPort;
|
|
609
|
+
};
|
|
610
|
+
readonly outputs: {
|
|
611
|
+
position: MessageOutputPort;
|
|
612
|
+
tempo: MessageOutputPort;
|
|
613
|
+
seconds: MessageOutputPort;
|
|
614
|
+
playing: MessageOutputPort;
|
|
615
|
+
};
|
|
616
|
+
constructor(options?: GraphModuleOptions);
|
|
617
|
+
/** Send the four readings, last output first. Without a Session it sends nothing. */
|
|
618
|
+
report(time?: number): void;
|
|
619
|
+
exportOptions(): ModuleOptionsJson;
|
|
620
|
+
}
|
|
621
|
+
interface GamepadSourceOptions extends GraphModuleOptions {
|
|
622
|
+
/** Which gamepad. Default 0. */
|
|
623
|
+
readonly index?: number;
|
|
624
|
+
}
|
|
625
|
+
/** While active, each change of a gamepad's button or axis as `button i value` or `axis i value`. */
|
|
626
|
+
declare class GamepadSource extends GraphModule {
|
|
627
|
+
#private;
|
|
628
|
+
static readonly type = "webmusic.gamepad";
|
|
629
|
+
readonly inputs: {
|
|
630
|
+
trigger: MessageInputPort;
|
|
631
|
+
};
|
|
632
|
+
readonly outputs: {
|
|
633
|
+
events: MessageOutputPort;
|
|
634
|
+
};
|
|
635
|
+
readonly index: number;
|
|
636
|
+
constructor(options?: GamepadSourceOptions);
|
|
637
|
+
/** Send what changed since the last report, or every button and axis with `all`. */
|
|
638
|
+
report(all?: boolean): void;
|
|
639
|
+
exportOptions(): ModuleOptionsJson;
|
|
640
|
+
protected onActivate(): void;
|
|
641
|
+
protected onDispose(): void;
|
|
642
|
+
}
|
|
643
|
+
/** A HID device the user chooses: each input report as `report id bytes…`. */
|
|
644
|
+
declare class HidSource extends GraphModule {
|
|
645
|
+
#private;
|
|
646
|
+
static readonly type = "webmusic.hid";
|
|
647
|
+
readonly inputs: {
|
|
648
|
+
control: MessageInputPort;
|
|
649
|
+
};
|
|
650
|
+
readonly outputs: {
|
|
651
|
+
reports: MessageOutputPort;
|
|
652
|
+
device: MessageOutputPort;
|
|
653
|
+
};
|
|
654
|
+
constructor(options?: GraphModuleOptions);
|
|
655
|
+
/** Ask the browser for a device and listen to it. Call it from a click, as the browser requires. */
|
|
656
|
+
open(): Promise<void>;
|
|
657
|
+
/** Release the device. */
|
|
658
|
+
close(): void;
|
|
659
|
+
exportOptions(): ModuleOptionsJson;
|
|
660
|
+
protected onDispose(): void;
|
|
661
|
+
}
|
|
662
|
+
/** A message from an OSC packet: the address is the selector. A bundle gives one message per element. */
|
|
663
|
+
declare function fromOsc(packet: OscPacket): Message[];
|
|
664
|
+
/** An OSC message from a message whose selector is an address. */
|
|
665
|
+
declare function toOsc(value: Message): OscPacket | undefined;
|
|
666
|
+
interface OscOptions extends GraphModuleOptions {
|
|
667
|
+
/** The WebSocket address of an OSC bridge: `ws://` or `wss://`. */
|
|
668
|
+
readonly url: string;
|
|
669
|
+
}
|
|
670
|
+
/** While active, each OSC message arriving through a bridge, as a message named by its address. */
|
|
671
|
+
declare class OscSource extends GraphModule {
|
|
672
|
+
#private;
|
|
673
|
+
static readonly type = "webmusic.osc-in";
|
|
674
|
+
readonly outputs: {
|
|
675
|
+
messages: MessageOutputPort;
|
|
676
|
+
status: MessageOutputPort;
|
|
677
|
+
};
|
|
678
|
+
readonly url: string;
|
|
679
|
+
constructor(options: OscOptions);
|
|
680
|
+
exportOptions(): ModuleOptionsJson;
|
|
681
|
+
protected onActivate(): void;
|
|
682
|
+
protected onDispose(): void;
|
|
683
|
+
}
|
|
684
|
+
/** While active, sends each message named by an address through a bridge as OSC. */
|
|
685
|
+
declare class OscSink extends GraphModule {
|
|
686
|
+
#private;
|
|
687
|
+
static readonly type = "webmusic.osc-out";
|
|
688
|
+
readonly inputs: {
|
|
689
|
+
messages: MessageInputPort;
|
|
690
|
+
};
|
|
691
|
+
readonly outputs: {
|
|
692
|
+
status: MessageOutputPort;
|
|
693
|
+
};
|
|
694
|
+
readonly url: string;
|
|
695
|
+
constructor(options: OscOptions);
|
|
696
|
+
/** Send one message; one whose selector is not an address is dropped. */
|
|
697
|
+
send(value: Message): void;
|
|
698
|
+
exportOptions(): ModuleOptionsJson;
|
|
699
|
+
protected onActivate(): void;
|
|
700
|
+
protected onDispose(): void;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
interface ScriptModuleOptions extends GraphModuleOptions {
|
|
704
|
+
/** How many inputs, 1 to 16. Default 1. */
|
|
705
|
+
readonly inputs?: number;
|
|
706
|
+
/** How many outputs, 1 to 16. Default 1. */
|
|
707
|
+
readonly outputs?: number;
|
|
708
|
+
/** The script's source. Default: a `bang` function that sends a bang. */
|
|
709
|
+
readonly code?: string;
|
|
710
|
+
/** Creates the Worker from the sandbox's source text. Defaults to a Worker from a Blob URL. */
|
|
711
|
+
readonly createWorker?: (source: string) => ScriptWorkerLike;
|
|
712
|
+
/** Receives `post(…)` output. Defaults to `console.log`. */
|
|
713
|
+
readonly print?: (text: string) => void;
|
|
714
|
+
}
|
|
715
|
+
/** One user script on its own thread, between message ports. */
|
|
716
|
+
declare class ScriptModule extends GraphModule {
|
|
717
|
+
#private;
|
|
718
|
+
static readonly type = "webmusic.script";
|
|
719
|
+
/** `in0`, `in1`…. */
|
|
720
|
+
readonly inputs: Readonly<Record<string, MessageInputPort>>;
|
|
721
|
+
/** `out0`, `out1`…. */
|
|
722
|
+
readonly outputs: Readonly<Record<string, MessageOutputPort>>;
|
|
723
|
+
readonly code: string;
|
|
724
|
+
constructor(options?: ScriptModuleOptions);
|
|
725
|
+
/** Hand a message to the script's handler for input `index`. */
|
|
726
|
+
deliver(index: number, value: Message): void;
|
|
727
|
+
exportOptions(): ModuleOptionsJson;
|
|
728
|
+
protected onDispose(): void;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Project plugins for every message module: the functions, timers and
|
|
733
|
+
* counters, values with a control, control sources, the script module and the
|
|
734
|
+
* device, network and Session sources. They share one environment.
|
|
735
|
+
*/
|
|
736
|
+
declare function createMessagePlugins(environment?: ModuleEnvironment): readonly ProjectPluginFactory[];
|
|
737
|
+
|
|
738
|
+
export { Button, Choice, type ChoiceOptions, type CompiledExpr, ControlRamp, ControlSource, type ControlSourceOptions, Counter, type CounterOptions, Delay, type DelayOptions, type ExprOptions, type ExprValue, type FunctionBinding, type FunctionHost, type FunctionInstance, FunctionModule, type FunctionModuleOptions, type FunctionPortSpec, GamepadSource, type GamepadSourceOptions, Gate, type GateOptions, HidSource, Line, type LineOptions, LoadBang, MESSAGE_FUNCTIONS, Matrix, type MatrixOptions, MessageBox, type MessageBoxOptions, type MessageFunction, type MessageValue, Metro, type MetroOptions, NumberValue, type NumberValueOptions, type OscOptions, OscSink, OscSource, Pipe, type PrintOptions, type RandomOptions, type RouteOptions, type ScaleOptions, ScriptModule, type ScriptModuleOptions, ScriptWorkerLike, type SelectOptions, type Slot, type SlotOptions, type SlotType, Switch, Toggle, type ToggleOptions, TransportReadout, type TriggerOptions, type TriggerOutput, ValueList, type ValueListOptions, atomOf, compileExpr, createMessagePlugins, expr, fromOsc, functionModule, numberMessage, pack, print, random, route, scale, seededRandom, select, toOsc, trigger, unpack };
|