import React, { useState, useEffect, useMemo } from 'react'; import { Globe, Volume2, Mic2, Settings2, Loader2, Zap, Sparkles, MessageSquare, ArrowRight, Users, ChevronRight, Activity, ShieldCheck, Search, Filter, X } from 'lucide-react'; import { synthesizeSpeech, TTS_VOICES, TTS_LANGUAGES, callGemini } from '../services/geminiService'; const Broadcast: React.FC = () => { const [activeTab, setActiveTab] = useState<'single' | 'multi'>('single'); const [selectedLang, setSelectedLang] = useState(TTS_LANGUAGES.find(l => l.code === 'en')!); const [selectedVoice, setSelectedVoice] = useState(TTS_VOICES[0]); const [directorNotes, setDirectorNotes] = useState('Professional, authoritative corporate tone.'); const [transcript, setTranscript] = useState("Greetings, this is a global institutional broadcast via the Lumina Quantum Node. System parity achieved."); const [isSynthesizing, setIsSynthesizing] = useState(false); // Multi-speaker state const [msConfig, setMsConfig] = useState({ speaker1: 'Alex', voice1: 'Kore', speaker2: 'Lumina', voice2: 'Zephyr' }); const [searchTerm, setSearchTerm] = useState(''); const filteredLangs = useMemo(() => TTS_LANGUAGES.filter(l => l.name.toLowerCase().includes(searchTerm.toLowerCase())), [searchTerm]); const handleGenerateNotes = async () => { try { const response = await callGemini('gemini-3-flash-preview', `Generate professional, detailed director's notes for a TTS reading in ${selectedLang.name}. The theme is "Quantum Financial Hub Status Update". Keep it to 2 sentences. tone should be ${selectedVoice.style}.` ); setDirectorNotes(response.text || ''); } catch (e) { console.error(e); } }; const handleBroadcast = async () => { setIsSynthesizing(true); const success = await synthesizeSpeech({ text: transcript, voiceName: selectedVoice.name, directorNotes: directorNotes, multiSpeaker: activeTab === 'multi' ? msConfig : undefined }); setIsSynthesizing(false); }; return (
Active Node: {selectedLang.code.toUpperCase()}_PARITY
Zero-persistence audio packet shredding enabled.
Fine-grained accent and pace control active.