Skip to content

Commit 361a0ea

Browse files
authored
Merge pull request #55 from codeacme17/docs
docs: update pages base on #53
2 parents 18f5818 + 95c8bc7 commit 361a0ea

16 files changed

Lines changed: 39 additions & 39 deletions

docs/en/hook/useOscilloscope.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ A hook for creating an oscilloscope, which can obtain real-time amplitude data.
4444

4545
Calling this method initializes the `analyser`. After initialization, the `onReady` callback function will be called.
4646

47-
- **analyser** : `Tone.Analyser`
47+
- **analyser** : `React.MutableRefObject<Tone.Analyser | null>`
4848

49-
After initialization, a `waveform` type analyzer [Tone.Analyser](https://tonejs.github.io/docs/14.7.77/Analyser) instance is constructed.
49+
After initialization, a `waveform` type analyzer [Tone.Analyser](https://tonejs.github.io/docs/14.7.77/Analyser) instance is constructed. Need to use `.current` to obtain.
5050

5151
- **data** : `SpectrogramDataPoint[]`
5252

docs/en/hook/usePlayer.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ This hook enables the implementation of basic functions of a music player, inclu
8484

8585
<CodeBlock code={`init(audioBuffer, [filter, analyzer])`} />
8686

87-
- **player**: `Tone.Player`
87+
- **player**: `React.MutableRefObject<Tone.Player | null>`
8888

89-
The [Tone.Player](https://tonejs.github.io/docs/14.7.77/Player) instance created after initialization.
89+
The [Tone.Player](https://tonejs.github.io/docs/14.7.77/Player) instance created after initialization. Need to use `.current` to obtain.
9090

91-
- **audioDuration**: `number`
91+
- **audioDuration**: `React.MutableRefObject<number>`
9292

93-
The duration of the audio in seconds.
93+
The duration of the audio in seconds. Need to use `.current` to obtain.
9494

9595
- **isReady**: `boolean`
9696

docs/en/hook/useSpectrogram.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ This hook can be used to generate a spectrogram for audio.
4444

4545
Calling this method can initialize `analyser`, and the `onReady` callback function will be called after the initialization is completed.
4646

47-
- **analyser** : `Tone.Analyser`
47+
- **analyser** : `React.MutableRefObject<Tone.Analyser | null>`
4848

49-
Instance of [Tone.Analyser](https://tonejs.github.io/docs/14.7.77/Analyser) constructed after initialization
49+
Instance of [Tone.Analyser](https://tonejs.github.io/docs/14.7.77/Analyser) constructed after initialization. Need to use `.current` to obtain.
5050

5151
- **data** : `SpectrogramDataPoint[]`
5252

docs/en/hook/useVuMeter.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ A Hook for obtaining audio volume levels
4444

4545
Calling this method can initialize `meter`. After the initialization is completed, the `onReady` callback function will be called.
4646

47-
- **meter**: `Tone.Meter | Tone.Split`
47+
- **meter**: `React.MutableRefObject<Tone.Split | null> | React.MutableRefObject<Tone.Meter | null>`
4848

49-
Initially constructed [Tone.Meter](https://tonejs.github.io/docs/14.7.77/Meter)(Mono) or [Tone.Split](https://tonejs.github.io/docs/14.7.77/Split)(Stereo) instances
49+
Initially constructed [Tone.Meter](https://tonejs.github.io/docs/14.7.77/Meter)(Mono) or [Tone.Split](https://tonejs.github.io/docs/14.7.77/Split)(Stereo) instances. Need to use `.current` to obtain.
5050

5151
- **value**: `number | number[]`
5252

docs/src/components/Example/OscilloscopeDefault.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export const OscilloscopeDefault = () => {
1313
}, [])
1414

1515
React.useEffect(() => {
16-
if (!audioBuffer || !analyser) return
17-
initPlayer(audioBuffer, [analyser])
18-
}, [audioBuffer, analyser])
16+
if (!audioBuffer || !analyser.current) return
17+
initPlayer(audioBuffer, [analyser.current])
18+
}, [audioBuffer, analyser.current])
1919

2020
const handleTrigger = () => {
2121
if (isPlaying) {

docs/src/components/Example/SliderUncontrolled.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const SliderUncontrolled = () => {
2424
}, [])
2525

2626
useEffect(() => {
27-
if (!audioBuffer || !meter) return
28-
initPlayer(audioBuffer, [meter])
29-
}, [audioBuffer, meter])
27+
if (!audioBuffer || !meter.current) return
28+
initPlayer(audioBuffer, [meter.current])
29+
}, [audioBuffer, meter.current])
3030

3131
const handlePlay = () => {
3232
if (!player) return

docs/src/components/Example/SpectrogramDefault.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export const SpectrogramDefault = () => {
2929
}, [])
3030

3131
React.useEffect(() => {
32-
if (!analyser) return
33-
initPlayer(audioBuffer!, [analyser])
34-
}, [audioBuffer, analyser])
32+
if (!analyser.current) return
33+
initPlayer(audioBuffer!, [analyser.current])
34+
}, [audioBuffer, analyser.current])
3535

3636
const handleTrigger = async () => {
3737
if (isPlaying) stop()

docs/src/components/Example/VuMeterColor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const VuMeterColor = () => {
2424
}, [])
2525

2626
React.useEffect(() => {
27-
if (!audioBuffer || !meter) return
28-
initPlayer(audioBuffer, [meter])
27+
if (!audioBuffer || !meter.current) return
28+
initPlayer(audioBuffer, [meter.current])
2929
}, [audioBuffer, meter])
3030

3131
const handlePlay = () => {

docs/src/components/Example/VuMeterDefault.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const VuMeterDefault = () => {
2424
}, [])
2525

2626
React.useEffect(() => {
27-
if (!audioBuffer || !meter) return
28-
initPlayer(audioBuffer, [meter])
29-
}, [audioBuffer, meter])
27+
if (!audioBuffer || !meter.current) return
28+
initPlayer(audioBuffer, [meter.current])
29+
}, [audioBuffer, meter.current])
3030

3131
const handlePlay = () => {
3232
if (!player) return

docs/src/components/Example/VuMeterStereo.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export const VuMeterStereo = () => {
3030
}, [])
3131

3232
React.useEffect(() => {
33-
if (!audioBuffer || !meter) return
34-
initPlayer(audioBuffer, [meter])
35-
}, [audioBuffer, meter])
33+
if (!audioBuffer || !meter.current) return
34+
initPlayer(audioBuffer, [meter.current])
35+
}, [audioBuffer, meter.current])
3636

3737
const handlePlay = () => {
3838
if (!player) return

0 commit comments

Comments
 (0)