/** PCM is produced exclusively by Blender's Audaspace device. */ export const NATIVE_AUDIO_RATE = 48000; export const NATIVE_AUDIO_CHANNELS = 2; export const NATIVE_AUDIO_FRAMES = 1024; // Native mixer blocks, not a second decoder or playback clock. Keep both normal // look-ahead and the temporary synchronous-call reserve strictly bounded. export const NATIVE_AUDIO_BUFFER_BLOCKS = 6; export const NATIVE_AUDIO_RECOVERY_BLOCKS = 12; export const NATIVE_AUDIO_BUSY_BLOCKS = 24; export type NativeAudioPull = { type: "pull"; generation: number; sequence: number; blocks: number }; export type NativeAudioPrepared = { type: "prepared"; generation: number; sequence: number }; /** Device-clock positions, in seconds on AudioContext's timeline. Frame offsets * count only PCM produced by the native mixer in this generation. Gaps between * scheduled blocks are silence and must not advance Blender's scene clock. */ export type NativeAudioSegment = { start: number; frames: number; firstFrame: number }; export type NativeAudioClock = { type: "clock"; generation: number; sequence: number; sampledAtMs: number; outputTime: number; running: boolean; completedFrames: number; segments: NativeAudioSegment[]; }; export type NativeAudioInput = NativeAudioPull | NativeAudioClock | NativeAudioPrepared; export type NativeAudioOutput = | { type: "reset"; generation: number } | { type: "prepare"; generation: number; sequence: number; expiresAtMs: number } | { type: "clockAck"; generation: number; sequence: number } | { type: "pcm"; generation: number; sequence: number; samples?: ArrayBuffer } | { type: "error"; generation: number; message: string };