/** Local tuple type for diffraction spatial positions — avoids coupling to @holoscript/core object-style Vec3. */ type Vec3 = [number, number, number]; /** * AudioDiffraction.ts * * Advanced diffraction modeling for spatial audio: * - Edge detection for diffraction points * - Kirchhoff-Fresnel diffraction coefficient calculation * - Secondary raycast paths for indirect sound propagation * - Integration with AudioOcclusion system * * @module audio */ export interface DiffractionEdge { id: string; point1: Vec3; point2: Vec3; obstacleId?: string; } export interface DiffractionPath { edgeId: string; diffractionPoint: Vec3; totalDistance: number; directDistance: number; pathDifference: number; diffractionCoefficient: number; angle: number; } export interface DiffractionResult { sourceId: string; hasDiffraction: boolean; paths: DiffractionPath[]; combinedCoefficient: number; volumeMultiplier: number; } export interface DiffractionConfig { enabled: boolean; maxPaths: number; minDiffractionGain: number; frequency: number; speedOfSound: number; } /** * Provider function to detect edges in the scene. * Implementations should return edges that could cause diffraction. */ export type EdgeDetectionProvider = (sourcePos: Vec3, listenerPos: Vec3) => DiffractionEdge[]; /** * Provider function to check line-of-sight between two points. * Returns true if the path is clear, false if obstructed. */ export type LineOfSightProvider = (point1: Vec3, point2: Vec3) => boolean; export declare class AudioDiffractionSystem { private config; private edgeProvider; private losProvider; private cache; setConfig(config: Partial): void; getConfig(): DiffractionConfig; setEdgeDetectionProvider(provider: EdgeDetectionProvider): void; setLineOfSightProvider(provider: LineOfSightProvider): void; /** * Compute diffraction paths between source and listener. * Returns all valid diffraction paths sorted by coefficient (strongest first). */ computeDiffraction(sourcePos: Vec3, listenerPos: Vec3, sourceId: string): DiffractionResult; /** * Compute diffraction for a specific edge. * Returns null if edge is not valid for diffraction. */ private computeEdgeDiffraction; /** * Find the optimal diffraction point on an edge. * Uses closest point on line segment to the midpoint between source and listener. */ private findDiffractionPoint; /** * Calculate the diffraction angle in radians. * This is the angle between source->edge and edge->listener vectors. */ private calculateDiffractionAngle; /** * Calculate Fresnel diffraction coefficient. * Based on Kirchhoff-Fresnel theory for edge diffraction. * * @param pathDifference - Extra distance traveled via edge (meters) * @param angle - Diffraction angle (radians) * @returns Attenuation coefficient (0-1) */ private calculateFresnelCoefficient; /** * Combine multiple diffraction paths using energy-based summation. * Paths contribute independently (incoherent sum). */ private combineDiffractionPaths; private distance3D; /** * Find closest point on line segment AB to point P. */ private closestPointOnSegment; getCachedResult(sourceId: string): DiffractionResult | undefined; clearCache(): void; /** * Get volume multiplier for a source based on diffraction. * Returns 1.0 if direct path exists, otherwise returns diffraction coefficient. */ getVolumeMultiplier(sourceId: string): number; /** * Check if a source has active diffraction paths. */ hasDiffraction(sourceId: string): boolean; /** * Get all diffraction paths for a source. */ getDiffractionPaths(sourceId: string): DiffractionPath[]; } export {}; //# sourceMappingURL=AudioDiffraction.d.ts.map