import { useTranslation } from 'react-i18next'; import { VolumeSlider, VoiceDeviceList } from '@/components/voice/VoiceControls'; import { PUSH_TO_TALK_KEYS, useVoiceStore, type PushToTalkKey } from '@/stores/voice'; import { useDeviceChoice } from '@/lib/useMediaDevices'; import { SettingsSection } from '@/pages/settings/SettingsSection'; /** * Подписи клавиш push-to-talk: `code` не зависит от раскладки, поэтому * хранится код, а показывается человекочитаемое имя. */ const PTT_KEY_LABELS: Record = { Space: 'settings.voice.pttKeys.space', KeyV: 'settings.voice.pttKeys.v', KeyB: 'settings.voice.pttKeys.b', KeyN: 'settings.voice.pttKeys.n', AltLeft: 'settings.voice.pttKeys.alt', ControlLeft: 'settings.voice.pttKeys.ctrl', }; /** * «Аудио-видео»: устройства ввода/вывода, громкости, режим активации * микрофона (голосовая активация или push-to-talk) и переключатели звуков * сервера (AGENT.md 7.13/7.14). * * Значения хранятся локально (zustand + localStorage) и применяются на лету: * выбранное устройство сразу переключается в активной голосовой сессии. */ export function VoiceSettingsSection() { const { t } = useTranslation(); const mic = useDeviceChoice('audioinput'); const camera = useDeviceChoice('videoinput'); const output = useDeviceChoice('audiooutput'); const micVolume = useVoiceStore((state) => state.micVolume); const outputVolume = useVoiceStore((state) => state.outputVolume); const setMicVolume = useVoiceStore((state) => state.setMicVolume); const setOutputVolume = useVoiceStore((state) => state.setOutputVolume); const micActivation = useVoiceStore((state) => state.micActivation); const pttKey = useVoiceStore((state) => state.pttKey); const eventSoundsEnabled = useVoiceStore((state) => state.eventSoundsEnabled); const soundboardEnabled = useVoiceStore((state) => state.soundboardEnabled); const latencySharingEnabled = useVoiceStore((state) => state.latencySharingEnabled); const interfaceSoundsEnabled = useVoiceStore((state) => state.interfaceSoundsEnabled); const setMicActivation = useVoiceStore((state) => state.setMicActivation); const setPttKey = useVoiceStore((state) => state.setPttKey); const setEventSoundsEnabled = useVoiceStore((state) => state.setEventSoundsEnabled); const setLatencySharingEnabled = useVoiceStore((state) => state.setLatencySharingEnabled); const setInterfaceSoundsEnabled = useVoiceStore((state) => state.setInterfaceSoundsEnabled); const setSoundboardEnabled = useVoiceStore((state) => state.setSoundboardEnabled); return (
{/* Режим активации микрофона: голосовая активация или push-to-talk. */}
{t('settings.voice.micMode')}
{(['voice', 'push_to_talk'] as const).map((mode) => ( ))}
{micActivation === 'push_to_talk' ? (

{t('settings.voice.pttHint')}

) : null}
{/* Звуки сервера: палитра событий и саундборд (AGENT.md 7.13). */}
{t('settings.voice.sounds')}

{t('settings.voice.eventSoundsHint')}

{t('settings.voice.interfaceSoundsHint')}

{t('settings.voice.soundboardHint')}

{/* Пинг участников: задержка в комнате и публикация своей (AGENT.md 7.14). */}
{t('settings.voice.latency')}

{t('settings.voice.latencySharingHint')}

{t('settings.voice.stub')}

); }