2022-11-20 12:56:36 -07:00
|
|
|
import { Canvas } from "@react-three/fiber";
|
|
|
|
|
2022-11-24 01:00:06 -07:00
|
|
|
import { InferenceResult } from "../types";
|
|
|
|
import SpectrogramViewer from "./SpectrogramViewer";
|
2022-11-20 12:56:36 -07:00
|
|
|
|
2022-11-23 22:46:32 -07:00
|
|
|
interface CanvasProps {
|
|
|
|
paused: boolean;
|
2022-11-24 01:00:06 -07:00
|
|
|
inferenceResults: InferenceResult[];
|
2022-11-24 15:54:25 -07:00
|
|
|
getTime: () => number;
|
|
|
|
audioLength: number;
|
2022-11-23 22:46:32 -07:00
|
|
|
}
|
|
|
|
|
2022-11-20 14:39:15 -07:00
|
|
|
/**
|
|
|
|
* React three fiber canvas with spectrogram drawing.
|
|
|
|
*/
|
2022-11-24 15:54:25 -07:00
|
|
|
export default function ThreeCanvas({
|
|
|
|
paused,
|
|
|
|
inferenceResults,
|
|
|
|
getTime,
|
|
|
|
audioLength,
|
|
|
|
}: CanvasProps) {
|
2022-11-20 12:56:36 -07:00
|
|
|
return (
|
2022-11-24 11:43:11 -07:00
|
|
|
<Canvas camera={{ position: [0, 0, 7], rotation: [0.4, 0, 0] }}>
|
2022-11-20 14:39:15 -07:00
|
|
|
<ambientLight intensity={2} />
|
|
|
|
<pointLight position={[40, 40, 40]} />
|
2022-11-24 01:00:06 -07:00
|
|
|
<SpectrogramViewer
|
2022-11-24 15:54:25 -07:00
|
|
|
paused={paused}
|
|
|
|
inferenceResults={inferenceResults}
|
|
|
|
getTime={getTime}
|
|
|
|
audioLength={audioLength}
|
2022-11-23 22:46:32 -07:00
|
|
|
/>
|
2022-11-20 14:39:15 -07:00
|
|
|
</Canvas>
|
2022-11-20 12:56:36 -07:00
|
|
|
);
|
|
|
|
}
|