diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2024-03-12 17:37:22 -0400 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2024-03-12 17:37:22 -0400 |
| commit | b9f3cbc58d66478656f547d1672a0b39a01c2e88 (patch) | |
| tree | 9fcbdbdd5b3cbf2b41321608d8e04434249f1c98 /src | |
| parent | dcd16b6eb7a075297214ac370c92e0cc234c9ab6 (diff) | |
fix(nodes): handle null input in Fourier
Diffstat (limited to 'src')
| -rw-r--r-- | src/nodes/Fourier.tsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nodes/Fourier.tsx b/src/nodes/Fourier.tsx index f95f26d..b9bda3f 100644 --- a/src/nodes/Fourier.tsx +++ b/src/nodes/Fourier.tsx @@ -2,11 +2,11 @@ import { NodeShell, InputArray, OutputNumber, NodeComponentProps, NodeInfo } fro import { fft } from '../wasm.ts'; export interface FourierInputs { - data: Float32Array, + data: Float32Array | null, } export interface FourierOutputs { - data: Float32Array, + data: Float32Array | null, } export const Fourier = ({ id, x, y, inputs }: NodeComponentProps<FourierInputs>) => { @@ -20,6 +20,6 @@ export const Fourier = ({ id, x, y, inputs }: NodeComponentProps<FourierInputs>) export const FourierNode: NodeInfo<FourierInputs, FourierOutputs> = { component: Fourier, - func: ({ data }) => ({ data: fft(data) }), - inputs: { data: new Float32Array(0) }, -};
\ No newline at end of file + func: ({ data }) => ({ data: data ? fft(data) : null }), + inputs: { data: null }, +}; |
