新增ai降噪
This commit is contained in:
parent
e645c13158
commit
7d58420b77
|
|
@ -119,6 +119,8 @@ const App: React.FC = () => {
|
||||||
shareFilesPath: path.resolve(__dirname, '../../Downloads/') + '\\', //共享文件保存路径
|
shareFilesPath: path.resolve(__dirname, '../../Downloads/') + '\\', //共享文件保存路径
|
||||||
isShareSavePath: true, //是否下载钱询问每个文件保存的位置
|
isShareSavePath: true, //是否下载钱询问每个文件保存的位置
|
||||||
closeSetting: 'hide', //关闭按钮设置
|
closeSetting: 'hide', //关闭按钮设置
|
||||||
|
isAINoiseReduction: true, //是否开启ai降噪
|
||||||
|
aINoiseReduction: 0, // 降噪模式
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import styles from '@/components/StupWizard/index.module.scss'
|
import styles from '@/components/StupWizard/index.module.scss'
|
||||||
import ImageUrl from '@/utils/package/imageUrl';
|
import ImageUrl from '@/utils/package/imageUrl';
|
||||||
import { Button, Checkbox, Empty, Input, message, Modal, Popover, Radio, Select, Slider } from 'antd';
|
import { Button, Checkbox, Empty, Input, message, Modal, Popover, Radio, Select, Slider, Space } from 'antd';
|
||||||
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
||||||
import { agora } from '@/utils/package/agora'
|
import { agora } from '@/utils/package/agora'
|
||||||
import { CloseOutlined, LoadingOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
import { CloseOutlined, LoadingOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||||
|
|
@ -243,6 +243,8 @@ const AudioComponents = () => {
|
||||||
ecordingActive: false,
|
ecordingActive: false,
|
||||||
ecordingVolume: 0,
|
ecordingVolume: 0,
|
||||||
autoEcordingVolume: true,
|
autoEcordingVolume: true,
|
||||||
|
isAINoiseReduction: true,
|
||||||
|
aINoiseReduction: 0
|
||||||
});
|
});
|
||||||
const setting = JSON.parse(storage.getItem('setting') as string)
|
const setting = JSON.parse(storage.getItem('setting') as string)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -288,7 +290,9 @@ const AudioComponents = () => {
|
||||||
ecordingItem: setting.ecordingDeviceId,
|
ecordingItem: setting.ecordingDeviceId,
|
||||||
ecordingVolume: setting.ecordingVolume,
|
ecordingVolume: setting.ecordingVolume,
|
||||||
playBackVolume: setting.playBackVolume,
|
playBackVolume: setting.playBackVolume,
|
||||||
autoEcordingVolume: setting.autoEcordingVolume
|
autoEcordingVolume: setting.autoEcordingVolume,
|
||||||
|
isAINoiseReduction: setting.isAINoiseReduction,
|
||||||
|
aINoiseReduction: setting.aINoiseReduction,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
@ -350,6 +354,38 @@ const AudioComponents = () => {
|
||||||
})
|
})
|
||||||
}} disabled={!audioDeviceManager.ecordingItem} />
|
}} disabled={!audioDeviceManager.ecordingItem} />
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<Checkbox checked={audioDeviceManager.isAINoiseReduction} onChange={(e) => {
|
||||||
|
setting.isAINoiseReduction = e.target.checked;
|
||||||
|
storage.setItem('setting', JSON.stringify(setting))
|
||||||
|
setAudioDeviceManager({
|
||||||
|
...audioDeviceManager,
|
||||||
|
isAINoiseReduction: e.target.checked
|
||||||
|
})
|
||||||
|
agora.setAINSMode(e.target.checked, audioDeviceManager.aINoiseReduction)
|
||||||
|
}}>
|
||||||
|
AI降噪
|
||||||
|
</Checkbox>
|
||||||
|
</div>
|
||||||
|
<div style={{ margin: '10px 0 0 20px' }}>
|
||||||
|
<Radio.Group onChange={(e) => {
|
||||||
|
setting.aINoiseReduction = e.target.value;
|
||||||
|
storage.setItem('setting', JSON.stringify(setting))
|
||||||
|
setAudioDeviceManager({
|
||||||
|
...audioDeviceManager,
|
||||||
|
aINoiseReduction: e.target.value
|
||||||
|
})
|
||||||
|
agora.setAINSMode(audioDeviceManager.isAINoiseReduction, e.target.value)
|
||||||
|
}} disabled={!audioDeviceManager.isAINoiseReduction} value={audioDeviceManager.aINoiseReduction}>
|
||||||
|
<Space direction="vertical">
|
||||||
|
<Radio value={0}>均衡降噪模式</Radio>
|
||||||
|
<Radio value={1}>强降噪模式</Radio>
|
||||||
|
<Radio value={2}>低延时强降噪模式</Radio>
|
||||||
|
</Space>
|
||||||
|
</Radio.Group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{/* <div>
|
{/* <div>
|
||||||
<Checkbox onChange={async (e) => {
|
<Checkbox onChange={async (e) => {
|
||||||
setting.autoEcordingVolume = e.target.checked;
|
setting.autoEcordingVolume = e.target.checked;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ import {
|
||||||
VideoViewSetupMode,
|
VideoViewSetupMode,
|
||||||
ScreenCaptureSourceType,
|
ScreenCaptureSourceType,
|
||||||
RenderModeType,
|
RenderModeType,
|
||||||
ChannelProfileType
|
ChannelProfileType,
|
||||||
|
AudioAinsMode
|
||||||
} from "agora-electron-sdk";
|
} from "agora-electron-sdk";
|
||||||
import { GetRoomRtcToken } from "@/api/Home/Index";
|
import { GetRoomRtcToken } from "@/api/Home/Index";
|
||||||
import { storage } from '@/utils';
|
import { storage } from '@/utils';
|
||||||
|
|
@ -92,6 +93,7 @@ export const agora = {
|
||||||
if (setting.playBackVolume) agora.setPlaybackDeviceVolume(setting.playBackVolume) // 设置播放设备音量
|
if (setting.playBackVolume) agora.setPlaybackDeviceVolume(setting.playBackVolume) // 设置播放设备音量
|
||||||
if (setting.ecordingDeviceId) agora.setRecordingDevice(setting.ecordingDeviceId) // 设置音频采集设备
|
if (setting.ecordingDeviceId) agora.setRecordingDevice(setting.ecordingDeviceId) // 设置音频采集设备
|
||||||
if (setting.ecordingVolume) agora.setRecordingDeviceVolume(setting.ecordingVolume) // 设置音频设备音量
|
if (setting.ecordingVolume) agora.setRecordingDeviceVolume(setting.ecordingVolume) // 设置音频设备音量
|
||||||
|
if (setting.isAINoiseReduction) agora.setAINSMode(setting.isAINoiseReduction, setting.aINoiseReduction) // 设置ai降噪
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
|
|
@ -242,7 +244,7 @@ export const agora = {
|
||||||
option.tokenA,
|
option.tokenA,
|
||||||
{ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) },
|
{ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) },
|
||||||
{
|
{
|
||||||
clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster , //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
||||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
||||||
|
|
@ -256,6 +258,10 @@ export const agora = {
|
||||||
await agora.stopCameraCapture();
|
await agora.stopCameraCapture();
|
||||||
await rtcEngine.leaveChannelEx({ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) })
|
await rtcEngine.leaveChannelEx({ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) })
|
||||||
},
|
},
|
||||||
|
// ai降噪
|
||||||
|
setAINSMode: async (enabled: boolean, mode: AudioAinsMode) => {
|
||||||
|
rtcEngine.setAINSMode(enabled, mode)
|
||||||
|
},
|
||||||
// 离开共享屏幕频道
|
// 离开共享屏幕频道
|
||||||
leaveChannelEx: async (uid: any) => {
|
leaveChannelEx: async (uid: any) => {
|
||||||
await rtcEngine.leaveChannelEx({ channelId: option.channelId, localUid: Number(uid) })
|
await rtcEngine.leaveChannelEx({ channelId: option.channelId, localUid: Number(uid) })
|
||||||
|
|
|
||||||
|
|
@ -343,11 +343,16 @@ $pagination-hover-background-color: #5575F2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-radio-checked .ant-radio-inner {
|
.ant-radio-checked .ant-radio-inner {
|
||||||
border-color: $btn-background-color;
|
|
||||||
background-color: $btn-background-color;
|
background-color: $btn-background-color;
|
||||||
|
border-color: $btn-background-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:where(.css-dev-only-do-not-override-98ntnt).ant-radio-wrapper .ant-radio-disabled .ant-radio-inner {
|
||||||
|
background-color: #28282C;
|
||||||
|
border-color: #28282C;
|
||||||
|
}
|
||||||
|
|
||||||
// ant-notification
|
// ant-notification
|
||||||
.ant-notification {
|
.ant-notification {
|
||||||
.ant-notification-notice-wrapper {
|
.ant-notification-notice-wrapper {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,8 @@ export default defineConfig({
|
||||||
RenderModeType,
|
RenderModeType,
|
||||||
ScreenCaptureSourceType,
|
ScreenCaptureSourceType,
|
||||||
VideoSourceType,
|
VideoSourceType,
|
||||||
VideoViewSetupMode
|
VideoViewSetupMode,
|
||||||
|
AudioAinsMode
|
||||||
} = require("agora-electron-sdk")
|
} = require("agora-electron-sdk")
|
||||||
export {
|
export {
|
||||||
createAgoraRtcEngine,
|
createAgoraRtcEngine,
|
||||||
|
|
@ -69,7 +70,8 @@ export default defineConfig({
|
||||||
RenderModeType,
|
RenderModeType,
|
||||||
ScreenCaptureSourceType,
|
ScreenCaptureSourceType,
|
||||||
VideoSourceType,
|
VideoSourceType,
|
||||||
VideoViewSetupMode
|
VideoViewSetupMode,
|
||||||
|
AudioAinsMode
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue