bugfix vf disabled

This commit is contained in:
wataru 2023-02-12 18:50:10 +09:00
parent b87f7983b3
commit 17ac07e263
4 changed files with 12 additions and 15 deletions

File diff suppressed because one or more lines are too long

View File

@ -140,6 +140,7 @@ export const useDeviceSetting = (audioContext: AudioContext | null, props: UseDe
const audio_echo = document.getElementById(AUDIO_ELEMENT_FOR_TEST_CONVERTED_ECHOBACK) as HTMLAudioElement
audio_echo.srcObject = dst.stream
audio_echo.play()
audio_echo.volume = 0
setFileInputEchoback(false)
// original stream to play.
@ -235,12 +236,10 @@ export const useDeviceSetting = (audioContext: AudioContext | null, props: UseDe
// @ts-ignore
audio.setSinkId("")
if (x == AUDIO_ELEMENT_FOR_TEST_CONVERTED_ECHOBACK) {
audio.volume = fileInputEchoback ? 1 : 0
audio.volume = 0
} else {
audio.volume = 1
audio.volume = 0
}
} else if (audioOutputForGUI == "record") {
audio.volume = 0
} else {
// @ts-ignore
audio.setSinkId(audioOutputForGUI)

View File

@ -205,7 +205,7 @@ export const useAdvancedSetting = (props: UseAdvancedSettingProps): AdvancedSett
<div className="body-row split-3-7 left-padding-1 guided">
<div className="body-item-title left-padding-1">Trancate Num</div>
<div className="body-input-container">
<input type="number" min={50} max={300} step={1} value={props.clientState.workletSetting.setting.numTrancateTreshold} onChange={(e) => {
<input type="number" min={5} max={300} step={1} value={props.clientState.workletSetting.setting.numTrancateTreshold} onChange={(e) => {
props.clientState.workletSetting.setSetting({
...props.clientState.workletSetting.setting,
numTrancateTreshold: Number(e.target.value)

View File

@ -153,12 +153,11 @@ export class VoiceChangerClient {
context: this.ctx
})
// connect nodes.
this.currentMediaStreamAudioSourceNode = this.ctx.createMediaStreamSource(this.currentMediaStream)
this.inputGainNode = this.ctx.createGain()
this.inputGainNode.gain.value = this.inputGain
this.currentMediaStreamAudioSourceNode.connect(this.inputGainNode)
if (this.currentDevice && forceVfDisable == false) {
this.currentMediaStreamAudioSourceNode = this.ctx.createMediaStreamSource(this.currentMediaStream) // input node
this.inputGainNode = this.ctx.createGain()
this.inputGainNode.gain.value = this.inputGain
this.currentMediaStreamAudioSourceNode.connect(this.inputGainNode)
this.currentDevice.chooseNewInnerDevice(this.currentMediaStream)
const voiceFocusNode = await this.currentDevice.createAudioNode(this.ctx); // vf node
this.inputGainNode.connect(voiceFocusNode.start) // input node -> vf node
@ -166,9 +165,8 @@ export class VoiceChangerClient {
this.micStream.setStream(this.outputNodeFromVF!.stream) // vf node -> mic stream
} else {
console.log("VF disabled")
this.inputGainNode = this.ctx.createGain()
this.inputGainNode.gain.value = this.inputGain
const inputDestinationNodeForMicStream = this.ctx.createMediaStreamDestination()
this.inputGainNode.connect(inputDestinationNodeForMicStream)
this.micStream.setStream(inputDestinationNodeForMicStream.stream) // input device -> mic stream
}
this.micStream.pipe(this.audioStreamer) // mic stream -> audio streamer