/**
* Channel-specific Noise Reduction Component
* Simplified UI for channel strip integration
*/
import { Mic, MicOff } from "lucide-react"
import { useCallback, useState } from "react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Label } from "@/components/ui/label"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
import { Slider } from "@/components/ui/slider"
import { Switch } from "@/components/ui/switch"
import type { NoiseReductionConfig } from "../../services/noise-reduction/noise-reduction-engine"
interface ChannelNoiseReductionProps {
channelId: string
enabled: boolean
strength: number
onToggle: (enabled: boolean) => void
onStrengthChange: (strength: number) => void
onOpenAdvanced?: () => void
}
export function ChannelNoiseReduction({
enabled,
strength,
onToggle,
onStrengthChange,
onOpenAdvanced,
}: ChannelNoiseReductionProps) {
const { t } = useTranslation()
const [isOpen, setIsOpen] = useState(false)
return (
{strength}%
onStrengthChange(value)}
disabled={!enabled}
className="w-full"
/>
{onOpenAdvanced && (
)}
{enabled && `${strength}%`}
)
}
/**
* Inline Noise Reduction Strip
* For integration into channel strips
*/
interface NoiseReductionStripProps {
enabled: boolean
config: NoiseReductionConfig
onToggle: (enabled: boolean) => void
onConfigChange: (config: NoiseReductionConfig) => void
}
export function NoiseReductionStrip({ enabled, config, onToggle, onConfigChange }: NoiseReductionStripProps) {
const { t } = useTranslation()
const handleStrengthChange = useCallback(
(strength: number) => {
onConfigChange({
...config,
strength,
})
},
[config, onConfigChange],
)
const handlePreserveVoiceToggle = useCallback(
(preserveVoice: boolean) => {
onConfigChange({
...config,
preserveVoice,
})
},
[config, onConfigChange],
)
return (
{config.algorithm === "ai" ? "AI" : config.algorithm}
{enabled && (
<>
{config.strength}%
handleStrengthChange(value)}
className="h-1"
/>
{(config.algorithm === "ai" || config.algorithm === "adaptive") && (
)}
>
)}
)
}