import { ReplaceMediaOptions } from '../../../../index'; import { FadeCurveEnum } from '../../../../types'; import { Clip, ClipOptions } from "../../Clip"; /** * Options for creating an audio-only media clip. */ export interface AudioClipOptions extends ClipOptions { mediaDataId: string; volume?: number; muted?: boolean; playbackSpeed?: number; perservePitch?: boolean; volumeFadeInDuration?: number; volumeFadeInCurve?: FadeCurveEnum; volumeFadeOutDuration?: number; volumeFadeOutCurve?: FadeCurveEnum; } /** * Clip implementation that plays and trims an audio-only media asset on the timeline. */ export declare class AudioClip extends Clip { private audioElement; private isPlaying; private volume; private muted; private playbackSpeed; private perservePitch; private volumeFadeInDuration; private volumeFadeInCurve; private volumeFadeOutDuration; private volumeFadeOutCurve; private actions; private isProcessing; private lastUpdateTime; private lastStartTime; private lastLeftTrim; private lastRightTrim; private mediaDataDuration; /** * Creates an audio clip bound to a library media asset. * * @param options Initial audio clip configuration. */ constructor(options: AudioClipOptions); /** * Creates the backing audio element, binds media data, and initializes runtime playback state. * * @param layerId Layer ID that owns this clip. * @returns A promise that resolves after initialization completes. */ init(layerId: string): Promise; private getGlobalTimeToClipTime; /** * Indicates whether the clip is currently processing a queued play, pause, or seek operation. * * @returns `true` if an asynchronous media action is still in progress; otherwise `false`. */ getIsProcessing(): boolean; /** * Clears any queued media actions waiting to run on the audio element. * * @returns Nothing. */ discardProcessing(): void; /** * Rebinds the clip to updated audio media and refreshes derived timing and playback state. * * @param newMediaId Optional replacement media asset ID. * @param _ Unused replacement options placeholder kept for signature compatibility. * @returns A promise that resolves to `true` if the media update succeeds; otherwise `false`. */ updateMediaData(newMediaId?: string, _?: ReplaceMediaOptions): Promise; /** * Preloads the audio element by seeking it near the requested timeline time. * * @param currentTime Current timeline time in seconds. * @returns Nothing. */ preload(currentTime: number): void; /** * Queues an audio element action so it can run after the current async media operation completes. * * @param action Action name such as `play`, `pause`, or `seek`. * @param params Additional action parameters. * @returns Nothing. */ addActionToQueue(action: string, params?: object): void; /** * Runs the next queued audio element action, if any. * * @returns Nothing. */ processNextQueue(): void; private seekedCallback; private playingCallback; private pausedCallback; private endedCallback; private errorCallback; private audioLoadedCallback; /** * Indicates whether the backing audio element has loaded enough data to seek and play. * * @returns `true` if the audio element is ready; otherwise `false`. */ isReady(): boolean; private getVolumeFadeRelativeBounds; private getFadeVolume; /** * Applies clip, layer, timeline, and fade multipliers to the underlying audio element volume. * * @returns Nothing. */ applyVolume(): void; /** * Sets the clip volume multiplier. * * @param volume Clip volume multiplier. * @returns Nothing. */ setVolume(volume: number): void; /** * Returns the clip volume multiplier. * * @returns The clip volume multiplier. */ getVolume(): number; /** * Sets the audible fade-in duration at the start of the clip. * * @param duration Fade-in duration in seconds. * @returns Nothing. */ setVolumeFadeInDuration(duration: number): void; /** * Returns the configured fade-in duration. * * @returns The fade-in duration in seconds. */ getVolumeFadeInDuration(): number; /** * Sets the interpolation curve used for the clip fade-in. * * @param curve Fade curve to use. * @returns Nothing. */ setVolumeFadeInCurve(curve: FadeCurveEnum): void; /** * Returns the fade curve used for the clip fade-in. * * @returns The configured fade-in curve. */ getVolumeFadeInCurve(): FadeCurveEnum; /** * Sets the audible fade-out duration at the end of the clip. * * @param duration Fade-out duration in seconds. * @returns Nothing. */ setVolumeFadeOutDuration(duration: number): void; /** * Returns the configured fade-out duration. * * @returns The fade-out duration in seconds. */ getVolumeFadeOutDuration(): number; /** * Sets the interpolation curve used for the clip fade-out. * * @param curve Fade curve to use. * @returns Nothing. */ setVolumeFadeOutCurve(curve: FadeCurveEnum): void; /** * Returns the fade curve used for the clip fade-out. * * @returns The configured fade-out curve. */ getVolumeFadeOutCurve(): FadeCurveEnum; /** * Changes audio playback speed and updates duration and trims to preserve the requested timing behavior. * * @param speed Playback speed multiplier. * @param perserveLeftBound When `true`, keeps the audible left edge fixed in timeline space. * @param perserveTrimmedDuration When `true`, preserves the trimmed audible duration after the speed change. * @returns Nothing. */ setPlaybackSpeed(speed: number, perserveLeftBound?: boolean, perserveTrimmedDuration?: boolean): void; /** * Returns the playback speed multiplier. * * @returns The playback speed multiplier. */ getPlaybackSpeed(): number; /** * Sets whether pitch correction should be preserved while changing playback speed. * * @param perservePitch Whether pitch should be preserved. * @returns Nothing. */ setPerservePitch(perservePitch: boolean): void; /** * Indicates whether pitch preservation is enabled during speed changes. * * @returns `true` if pitch preservation is enabled; otherwise `false`. */ getPerservePitch(): boolean; private play; private pause; private willSeekAtTime; private seek; /** * Primes the clip for timeline playback and seeks the audio element to the requested time. * * @param currentTime Current timeline time in seconds. * @returns A promise that resolves after playback pre-roll work completes. */ onPlay(currentTime: number): Promise; /** * Pauses audio playback and seeks the audio element back to the requested timeline time. * * @param currentTime Current timeline time in seconds. * @returns A promise that resolves after pause handling completes. */ onPause(currentTime: number): Promise; /** * Synchronizes audio playback state with the timeline playhead. * * @param currentTime Current timeline time in seconds. * @returns Nothing. */ update(currentTime: number): void; /** * Mutes or unmutes the clip. * * @param muted Whether the clip should be muted. * @returns Nothing. */ setMuted(muted: boolean): void; /** * Indicates whether the clip is muted. * * @returns `true` if the clip is muted; otherwise `false`. */ isMuted(): boolean; /** * Retrieves audio samples for a specified time range relative to the startTime from the associated media data. * * @param startTime - The start time in seconds relative to the startTime from which to extract audio samples. * @param duration - The duration in seconds for which to extract audio samples. * @returns An array of Float32Array representing the audio samples, or null if the media data is unavailable. */ /** * Returns decoded audio samples from the underlying media asset. * * @param startTime Start time in seconds, relative to the source media. * @param duration Optional duration in seconds to extract. * @returns The audio sample channels, or `null` if the media data is unavailable. */ getAudioSamples(startTime: number, duration?: number): Float32Array[] | null; /** * * @deprecated Use getAudioSamples instead, don't forget to enable them in the settings */ extractMonoAudioData(startTime: number, endTime: number): Promise; destroy(): void; /** * Creates a cloned audio clip instance from serialized data. * * @returns A cloned audio clip. */ clone(): AudioClip; /** * Serializes the audio clip. * * @returns The serialized audio clip payload. */ serialize(): { type: string; id: string; duration: number; mediaDataId: string; subtitlesOffset: number; startTime: number; leftTrim: number; rightTrim: number; filters: { intensity: number; id: string; provider: string; filterId: string; clipId?: string | undefined; }[]; effects: any[]; isVisible: boolean; playbackSpeed: number; perservePitch: boolean; volumeFadeInDuration: number; volumeFadeInCurve: FadeCurveEnum; volumeFadeOutDuration: number; volumeFadeOutCurve: FadeCurveEnum; text?: string | undefined; name?: string | undefined; customData?: [string, unknown][] | undefined; wrapMode?: import('../../../../types').WrapModeEnum | undefined; blendMode?: import('../../../../types').BlendModeEnum | undefined; style?: unknown; subtitlesId?: string | undefined; animationController?: { animationInDuration: number; animationOutDuration: number; animationLoopCount: number; loopSmoothing: number; animationDataIn?: { name: string; inOutOfRange: import('../../../../index').OutOfRangeEnum; outOutOfRange: import('../../../../index').OutOfRangeEnum; propertyAnimations: { property: string; keyframes: { value: string | number; time: number; easing: import('../../../../index').EasingEnum; space: import('../../../../index').AnimationSpaceEnum; relativeProperty?: string | undefined; }[]; inOutOfRange: import('../../../../index').OutOfRangeEnum; outOutOfRange: import('../../../../index').OutOfRangeEnum; }[]; speed?: number | undefined; offset?: number | undefined; amplification?: number | undefined; } | undefined; animationDataOut?: { name: string; inOutOfRange: import('../../../../index').OutOfRangeEnum; outOutOfRange: import('../../../../index').OutOfRangeEnum; propertyAnimations: { property: string; keyframes: { value: string | number; time: number; easing: import('../../../../index').EasingEnum; space: import('../../../../index').AnimationSpaceEnum; relativeProperty?: string | undefined; }[]; inOutOfRange: import('../../../../index').OutOfRangeEnum; outOutOfRange: import('../../../../index').OutOfRangeEnum; }[]; speed?: number | undefined; offset?: number | undefined; amplification?: number | undefined; } | undefined; animationDataLoop?: { name: string; inOutOfRange: import('../../../../index').OutOfRangeEnum; outOutOfRange: import('../../../../index').OutOfRangeEnum; propertyAnimations: { property: string; keyframes: { value: string | number; time: number; easing: import('../../../../index').EasingEnum; space: import('../../../../index').AnimationSpaceEnum; relativeProperty?: string | undefined; }[]; inOutOfRange: import('../../../../index').OutOfRangeEnum; outOutOfRange: import('../../../../index').OutOfRangeEnum; }[]; speed?: number | undefined; offset?: number | undefined; amplification?: number | undefined; } | undefined; } | undefined; clipMasks?: { wrapMode: import('../../../../index').MaskWrapModeEnum; id: string; clipId: string; }[] | undefined; propertyAnimator?: { tracks: { type: import('../../../../index').PropertyDescriptionTypeEnum; property: string; keyframes: { value: (string | number | boolean | number[]) & (string | number | boolean | number[] | undefined); time: number; handleIn: { value: number; time: number; }; handleOut: { value: number; time: number; }; hold?: boolean | undefined; }[]; defaults?: { handleIn?: { value: number; time: number; } | undefined; handleOut?: { value: number; time: number; } | undefined; hold?: boolean | undefined; } | undefined; customData?: [string, unknown][] | undefined; }[]; initialValues?: [string, string | number | boolean | number[]][] | undefined; } | undefined; volume?: number | undefined; muted?: boolean | undefined; }; /** * Creates an audio clip instance from serialized data. * * @param payload Serialized audio clip payload. * @returns The deserialized audio clip. */ static deserialize(payload: object): AudioClip; /** * Indicates that audio clips do not expose a renderable PIXI sprite. * * @returns `false`. */ hasSprite(): boolean; }