131 lines
4.7 KiB
TypeScript
131 lines
4.7 KiB
TypeScript
export default ResonanceAudio;
|
|
/**
|
|
* ~ResonanceAudioOptions
|
|
*/
|
|
export type ResonanceAudio = {
|
|
/**
|
|
* Desired ambisonic Order. Defaults to
|
|
* {@link Utils.DEFAULT_AMBISONIC_ORDER DEFAULT_AMBISONIC_ORDER}.
|
|
*/
|
|
ambisonicOrder: number;
|
|
/**
|
|
* The listener's initial position (in meters), where origin is the center of
|
|
* the room. Defaults to {@link Utils.DEFAULT_POSITION DEFAULT_POSITION}.
|
|
*/
|
|
listenerPosition: Float32Array;
|
|
/**
|
|
* The listener's initial forward vector.
|
|
* Defaults to {@link Utils.DEFAULT_FORWARD DEFAULT_FORWARD}.
|
|
*/
|
|
listenerForward: Float32Array;
|
|
/**
|
|
* The listener's initial up vector.
|
|
* Defaults to {@link Utils.DEFAULT_UP DEFAULT_UP}.
|
|
*/
|
|
listenerUp: Float32Array;
|
|
/**
|
|
* ~RoomDimensions} dimensions Room dimensions (in meters). Defaults to
|
|
* {@link Utils.DEFAULT_ROOM_DIMENSIONS DEFAULT_ROOM_DIMENSIONS}.
|
|
*/
|
|
"": Utils;
|
|
/**
|
|
* (in meters/second). Defaults to
|
|
* {@link Utils.DEFAULT_SPEED_OF_SOUND DEFAULT_SPEED_OF_SOUND}.
|
|
*/
|
|
speedOfSound: number;
|
|
};
|
|
/**
|
|
* Options for constructing a new ResonanceAudio scene.
|
|
* @typedef {Object} ResonanceAudio~ResonanceAudioOptions
|
|
* @property {Number} ambisonicOrder
|
|
* Desired ambisonic Order. Defaults to
|
|
* {@linkcode Utils.DEFAULT_AMBISONIC_ORDER DEFAULT_AMBISONIC_ORDER}.
|
|
* @property {Float32Array} listenerPosition
|
|
* The listener's initial position (in meters), where origin is the center of
|
|
* the room. Defaults to {@linkcode Utils.DEFAULT_POSITION DEFAULT_POSITION}.
|
|
* @property {Float32Array} listenerForward
|
|
* The listener's initial forward vector.
|
|
* Defaults to {@linkcode Utils.DEFAULT_FORWARD DEFAULT_FORWARD}.
|
|
* @property {Float32Array} listenerUp
|
|
* The listener's initial up vector.
|
|
* Defaults to {@linkcode Utils.DEFAULT_UP DEFAULT_UP}.
|
|
* @property {Utils~RoomDimensions} dimensions Room dimensions (in meters). Defaults to
|
|
* {@linkcode Utils.DEFAULT_ROOM_DIMENSIONS DEFAULT_ROOM_DIMENSIONS}.
|
|
* @property {Utils~RoomMaterials} materials Named acoustic materials per wall.
|
|
* Defaults to {@linkcode Utils.DEFAULT_ROOM_MATERIALS DEFAULT_ROOM_MATERIALS}.
|
|
* @property {Number} speedOfSound
|
|
* (in meters/second). Defaults to
|
|
* {@linkcode Utils.DEFAULT_SPEED_OF_SOUND DEFAULT_SPEED_OF_SOUND}.
|
|
*/
|
|
/**
|
|
* @class ResonanceAudio
|
|
* @description Main class for managing sources, room and listener models.
|
|
* @param {AudioContext} context
|
|
* Associated {@link
|
|
https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext}.
|
|
* @param {ResonanceAudio~ResonanceAudioOptions} options
|
|
* Options for constructing a new ResonanceAudio scene.
|
|
*/
|
|
declare class ResonanceAudio {
|
|
constructor(context: any, options: any);
|
|
_ambisonicOrder: number;
|
|
_sources: any[];
|
|
_room: Room;
|
|
_listener: Listener;
|
|
_context: any;
|
|
output: any;
|
|
ambisonicOutput: any;
|
|
ambisonicInput: any;
|
|
/**
|
|
* Create a new source for the scene.
|
|
* @param {Source~SourceOptions} options
|
|
* Options for constructing a new Source.
|
|
* @return {Source}
|
|
*/
|
|
createSource(options: any): Source;
|
|
/**
|
|
* Set the scene's desired ambisonic order.
|
|
* @param {Number} ambisonicOrder Desired ambisonic order.
|
|
*/
|
|
setAmbisonicOrder(ambisonicOrder: number): void;
|
|
/**
|
|
* Set the room's dimensions and wall materials.
|
|
* @param {Object} dimensions Room dimensions (in meters).
|
|
* @param {Object} materials Named acoustic materials per wall.
|
|
*/
|
|
setRoomProperties(dimensions: any, materials: any): void;
|
|
/**
|
|
* Set the listener's position (in meters), where origin is the center of
|
|
* the room.
|
|
* @param {Number} x
|
|
* @param {Number} y
|
|
* @param {Number} z
|
|
*/
|
|
setListenerPosition(x: number, y: number, z: number): void;
|
|
/**
|
|
* Set the source's orientation using forward and up vectors.
|
|
* @param {Number} forwardX
|
|
* @param {Number} forwardY
|
|
* @param {Number} forwardZ
|
|
* @param {Number} upX
|
|
* @param {Number} upY
|
|
* @param {Number} upZ
|
|
*/
|
|
setListenerOrientation(forwardX: number, forwardY: number, forwardZ: number, upX: number, upY: number, upZ: number): void;
|
|
/**
|
|
* Set the listener's position and orientation using a Three.js Matrix4 object.
|
|
* @param {Object} matrix
|
|
* The Three.js Matrix4 object representing the listener's world transform.
|
|
*/
|
|
setListenerFromMatrix(matrix: any): void;
|
|
/**
|
|
* Set the speed of sound.
|
|
* @param {Number} speedOfSound
|
|
*/
|
|
setSpeedOfSound(speedOfSound: number): void;
|
|
}
|
|
import Utils from "./utils.js";
|
|
import Room from "./room.js";
|
|
import Listener from "./listener.js";
|
|
import Source from "./source.js";
|