visual-song 0.13.1 → 0.13.2

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/dist/index.d.ts CHANGED
@@ -29,6 +29,11 @@ declare enum EasingType {
29
29
  OutBounce = 23,
30
30
  InOutBounce = 24
31
31
  }
32
+ declare enum RenderMode {
33
+ CONTINUOUS = "CONTINUOUS",
34
+ ONCE = "ONCE",
35
+ PAUSED = "PAUSED"
36
+ }
32
37
  declare function VisualSongProvider({ children }: PropsWithChildren<{}>): react_jsx_runtime.JSX.Element;
33
38
  type VisualSongAudioRef = {
34
39
  play(): void;
@@ -45,8 +50,6 @@ type VisualSongAudioRef = {
45
50
  declare function useVisualSongAudio(file?: File): VisualSongAudioRef;
46
51
  type VisualSongRef = {
47
52
  IsInitialized(): boolean;
48
- resumeMainLoop(): void;
49
- pauseMainLoop(): void;
50
53
  getBackgroundColor(): Float32Array;
51
54
  setBackgroundColor(color: Float32Array): void;
52
55
  setVertexShader(shader: string): boolean;
@@ -69,9 +72,11 @@ type Props = {
69
72
  vertexShader?: string;
70
73
  primitiveMode?: number;
71
74
  vertexCount?: number;
75
+ useSinWaveOnly?: boolean;
76
+ renderMode?: RenderMode;
72
77
  initializedCallback?: () => void;
73
78
  };
74
79
  declare const VisualSong: react.ForwardRefExoticComponent<Props & react.RefAttributes<VisualSongRef>>;
75
80
 
76
- export { EasingType, VisualSong, VisualSongProvider, useVisualSongAudio };
81
+ export { EasingType, RenderMode, VisualSong, VisualSongProvider, useVisualSongAudio };
77
82
  export type { VisualSongAudioRef, VisualSongRef };
package/dist/index.js CHANGED
@@ -6203,6 +6203,12 @@ var EasingType = /*#__PURE__*/ function(EasingType) {
6203
6203
  EasingType[EasingType["InOutBounce"] = 24] = "InOutBounce";
6204
6204
  return EasingType;
6205
6205
  }({});
6206
+ var RenderMode = /*#__PURE__*/ function(RenderMode) {
6207
+ RenderMode["CONTINUOUS"] = "CONTINUOUS";
6208
+ RenderMode["ONCE"] = "ONCE";
6209
+ RenderMode["PAUSED"] = "PAUSED";
6210
+ return RenderMode;
6211
+ }({});
6206
6212
  const VisualSongContext = /*#__PURE__*/ createContext({
6207
6213
  module: null
6208
6214
  });
@@ -6303,7 +6309,7 @@ function useVisualSongAudio(file) {
6303
6309
  }
6304
6310
  };
6305
6311
  }
6306
- const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoop, backgroundColor, vertexShader, primitiveMode, vertexCount, initializedCallback }, ref) {
6312
+ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoop, backgroundColor, vertexShader, primitiveMode, vertexCount, useSinWaveOnly, renderMode, initializedCallback }, ref) {
6307
6313
  const canvasRef = useRef(null);
6308
6314
  const canvasWrapperRef = useRef(null);
6309
6315
  const glContextRef = useRef(null);
@@ -6317,12 +6323,12 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
6317
6323
  });
6318
6324
  const useCustomResolutionRef = useRef(false);
6319
6325
  useImperativeHandle(ref, ()=>({
6320
- resumeMainLoop () {
6321
- module.current.resumeMainLoop();
6322
- },
6323
- pauseMainLoop () {
6324
- module.current.pauseMainLoop();
6325
- },
6326
+ // resumeMainLoop(): void {
6327
+ // module.current!.resumeMainLoop();
6328
+ // },
6329
+ // pauseMainLoop(): void {
6330
+ // module.current!.pauseMainLoop();
6331
+ // },
6326
6332
  IsInitialized () {
6327
6333
  return module.current !== null && playerRef.current !== null;
6328
6334
  },
@@ -6382,6 +6388,15 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
6382
6388
  },
6383
6389
  setFPS (fps) {
6384
6390
  module.current.Renderer.getInstance().setFPS(fps);
6391
+ },
6392
+ setUseSinWaveOnly (use) {
6393
+ playerRef.current.setUseSinWaveOnly(use);
6394
+ },
6395
+ getUseSinWaveOnly () {
6396
+ return playerRef.current.getUseSinWaveOnly();
6397
+ },
6398
+ setRenderMode (mode) {
6399
+ playerRef.current.setRenderMode(module.current.RenderMode[mode]);
6385
6400
  }
6386
6401
  }), []);
6387
6402
  useEffect(()=>{
@@ -6443,6 +6458,22 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
6443
6458
  }, [
6444
6459
  vertexCount
6445
6460
  ]);
6461
+ useEffect(()=>{
6462
+ if (!module.current || !playerRef.current) return;
6463
+ if (typeof useSinWaveOnly === 'boolean') {
6464
+ playerRef.current.setUseSinWaveOnly(useSinWaveOnly);
6465
+ }
6466
+ }, [
6467
+ useSinWaveOnly
6468
+ ]);
6469
+ useEffect(()=>{
6470
+ if (!module.current || !playerRef.current) return;
6471
+ if (renderMode !== undefined) {
6472
+ playerRef.current.setRenderMode(module.current.RenderMode[renderMode]);
6473
+ }
6474
+ }, [
6475
+ renderMode
6476
+ ]);
6446
6477
  function setBackgroundColorInternal(color) {
6447
6478
  if (color && color.length >= 4) {
6448
6479
  if (!playerRef.current) return;
@@ -6486,6 +6517,12 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
6486
6517
  if (vertexCount !== undefined) {
6487
6518
  playerRef.current.setVertexCount(vertexCount);
6488
6519
  }
6520
+ if (useSinWaveOnly !== undefined) {
6521
+ playerRef.current.setUseSinWaveOnly(useSinWaveOnly);
6522
+ }
6523
+ if (renderMode !== undefined) {
6524
+ playerRef.current.setRenderMode(module.current.RenderMode[renderMode]);
6525
+ }
6489
6526
  updateLayout();
6490
6527
  if (initializedCallback !== undefined) {
6491
6528
  initializedCallback();
@@ -6562,4 +6599,4 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
6562
6599
  });
6563
6600
  });
6564
6601
 
6565
- export { EasingType, VisualSong, VisualSongProvider, useVisualSongAudio };
6602
+ export { EasingType, RenderMode, VisualSong, VisualSongProvider, useVisualSongAudio };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visual-song",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "visual-song core library",
5
5
  "author": "kunyoungparkk (rjsdud3263@gmail.com)",
6
6
  "license": "MIT",