Skip to content

Commit 6856c02

Browse files
committed
Do not wait
1 parent 93f8dcb commit 6856c02

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/react/src/lib/useSoundPlayer.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export const useSoundPlayer = (props: {
143143
check();
144144
});
145145

146-
const fadeOutAndPostMessage = useCallback(async (type: 'end' | 'clear') => {
146+
const fadeOutAndPostMessage = useCallback((type: 'end' | 'clear') => {
147147
if (!gainNode.current || !audioContext.current) {
148148
workletNode.current?.port.postMessage({ type });
149149
return;
@@ -159,11 +159,11 @@ export const useSoundPlayer = (props: {
159159
);
160160

161161
isFadeCancelled.current = false;
162-
await waitForAudioTime(
163-
now + FADE_DURATION,
164-
audioContext.current,
165-
() => isFadeCancelled.current,
166-
);
162+
//await waitForAudioTime(
163+
// now + FADE_DURATION,
164+
// audioContext.current,
165+
// () => isFadeCancelled.current,
166+
//);
167167

168168
workletNode.current?.port.postMessage({ type });
169169

@@ -179,7 +179,7 @@ export const useSoundPlayer = (props: {
179179
};
180180
}, []);
181181

182-
const stopAll = useCallback(async () => {
182+
const stopAll = useCallback(() => {
183183
isInitialized.current = false;
184184
isProcessing.current = false;
185185
setIsPlaying(false);
@@ -190,7 +190,7 @@ export const useSoundPlayer = (props: {
190190
window.clearInterval(frequencyDataIntervalId.current);
191191
}
192192

193-
await fadeOutAndPostMessage('end');
193+
fadeOutAndPostMessage('end');
194194

195195
if (analyserNode.current) {
196196
analyserNode.current.disconnect();
@@ -221,7 +221,7 @@ export const useSoundPlayer = (props: {
221221
}, [fadeOutAndPostMessage]);
222222

223223
const clearQueue = useCallback(() => {
224-
void fadeOutAndPostMessage('clear');
224+
fadeOutAndPostMessage('clear');
225225
isProcessing.current = false;
226226
setIsPlaying(false);
227227
setFft(generateEmptyFft());

0 commit comments

Comments
 (0)