26 lines
628 B
TypeScript
Raw Normal View History

2023-04-05 03:35:16 +09:00
import { ClientState, useClient, ClientType } from "@dannadori/voice-changer-client-js"
import { AUDIO_ELEMENT_FOR_PLAY_RESULT } from "../const"
2023-02-17 00:09:56 +09:00
export type UseVCClientProps = {
2023-02-17 02:11:03 +09:00
audioContext: AudioContext | null
2023-04-05 03:35:16 +09:00
clientType: ClientType
2023-02-17 00:09:56 +09:00
}
export type VCClientState = {
clientState: ClientState
}
export const useVCClient = (props: UseVCClientProps) => {
const clientState = useClient({
2023-04-05 03:35:16 +09:00
clientType: props.clientType,
2023-02-17 00:09:56 +09:00
audioContext: props.audioContext,
audioOutputElementId: AUDIO_ELEMENT_FOR_PLAY_RESULT
})
const ret: VCClientState = {
clientState
}
return ret
}