import { BungeePitchShift } from '../BungeePitchShift'; import type { BungeePitchShiftConfig, PitchShiftParams, BungeeInfo } from '../types'; /** * Extended parameters that include enabled state */ export interface UsePitchShiftParams extends PitchShiftParams { enabled: boolean; } /** * Return type for the usePitchShift hook */ export interface UsePitchShiftControls { /** The pitch shift instance (null until initialized) */ pitchShift: BungeePitchShift | null; /** Current parameters */ params: UsePitchShiftParams; /** Update pitch shift in semitones */ updatePitch: (semitones: number) => void; /** Update playback speed */ updateSpeed: (speed: number) => void; /** Update wet/dry mix */ updateMix: (mix: number) => void; /** Enable or disable the effect */ setEnabled: (enabled: boolean) => void; /** Reset the internal state (useful for seeking) */ reset: () => void; /** Whether the pitch shifter is initialized */ initialized: boolean; /** Information about the Bungee processor */ info: BungeeInfo; } /** * React hook for managing Bungee pitch shifting and time stretching * * @param audioContext - Web Audio API AudioContext * @param config - Optional configuration * @returns Controls and state for the pitch shifter * * @example * ```tsx * function AudioPlayer() { * const audioContext = useRef(new AudioContext()).current; * const { * pitchShift, * initialized, * updatePitch, * updateSpeed * } = usePitchShift(audioContext, { * workletPath: '/bungee-processor.js' * }); * * useEffect(() => { * if (!pitchShift || !initialized) return; * * // Connect to audio graph * sourceNode.connect(pitchShift.node); * pitchShift.connect(audioContext.destination); * }, [pitchShift, initialized]); * * return ( *
* updatePitch(Number(e.target.value))} * /> *
* ); * } * ``` */ export declare function usePitchShift(audioContext: AudioContext | null, config?: BungeePitchShiftConfig): UsePitchShiftControls; //# sourceMappingURL=usePitchShift.d.ts.map