Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALPS-700 - Omnitone crash #148

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ForgeJS has the following dependencies:

- [three.js](https://threejs.org/) r86 ([MIT license](https://github.com/mrdoob/three.js/blob/dev/LICENSE))
- [hammer.js](http://hammerjs.github.io/) 2.0.8 ([MIT license](https://github.com/hammerjs/hammer.js/blob/master/LICENSE.md))
- [omnitone](http://googlechrome.github.io/omnitone/#home) 1.0.1 ([Apache 2.0 license](https://github.com/GoogleChrome/omnitone/blob/master/LICENSE))
- [omnitone](http://googlechrome.github.io/omnitone/#home) 1.0.6 ([Apache 2.0 license](https://github.com/GoogleChrome/omnitone/blob/master/LICENSE))
- [dash.js](https://github.com/Dash-Industry-Forum/dash.js) 2.6.0 ([BSD license](https://github.com/Dash-Industry-Forum/dash.js/blob/development/LICENSE.md))

> NOTE: We made a custom build of three.js with some classes concatenated to it. These classes are included in the original three.js repository but not concatenated in the main build. We added EffectComposer, RenderPass, ClearPass, MaskPass, ShaderPass, TexturePass and CopyShader in our three.custom.min.js.
Expand Down
150 changes: 125 additions & 25 deletions externs/lib/omnitone.ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,151 @@
var Omnitone = {};

/**
* Create a singleton FOADecoder instance.
* Create a FOARenderer, the first-order ambisonic decoder and the optimized binaural renderer.
* @param {AudioContext} context - Associated AudioContext.
* @param {HTMLMediaElement} element - Video or Audio DOM element to be streamed.
* @param {FOADecoderOptions} options - Options for FOA decoder.
* @return {FOADecoder}
* @param {FOARendererConfig} config
* @return {FOARenderer}
*/
Omnitone.createFOADecoder = function (context, element, options) {};
Omnitone.createFOARenderer = function(context, config) {};

/**
* @typedef {{HRTFSetUrl:(string|undefined), postGainDB:(number|undefined), channelMap:(Array<number>|undefined)}}
* @name FOADecoderOptions
* @property {string} HRTFSetUrl - Base URL for the cube HRTF sets.
* @property {number} postGainDB - Post-decoding gain compensation in dB.
* @property {Array<number>} channelMap - Custom channel map.
* @typedef {{channelMap:(Array|undefined), hrirPathList:(Array|undefined), renderingMode:(string|undefined)}}
* @name FOARendererConfig
* @property {Array} channelMap - Custom channel routing map. Useful for handling the inconsistency in browser's multichannel audio decoding.
* @property {Array} hrirPathList - A list of paths to HRIR files. It overrides the internal HRIR list if given.
* @property {string} renderingMode - Rendering mode.
*/
var FOADecoderOptions;
var FOARendererConfig;

/**
* Creates HOARenderer for higher-order ambisonic decoding and the optimized binaural rendering.
* @param {AudioContext} context - Associated AudioContext.
* @param {HOARendererConfig} config
* @return {HOARenderer}
*/
Omnitone.createHOARenderer = function(context, config) {};

/**
* @typedef {{ambisonicOrder:(number|undefined), hrirPathList:(Array|undefined), renderingMode:(string|undefined)}}
* @name HOARendererConfig
* @property {number} ambisonicOrder - Ambisonic order.
* @property {Array} hrirPathList - A list of paths to HRIR files. It overrides the internal HRIR list if given.
* @property {string} renderingMode - Rendering mode.
*/
var HOARendererConfig;

/**
* Omnitone FOA renderer class. Uses the optimized convolution technique.
* @constructor
* @param {AudioContext} context - Associated AudioContext.
* @param {HTMLMediaElement} element - Target video or audio element for streaming.
* @param {FOADecoderOptions} options
* @return {!FOADecoder}
* @param {FOARendererConfig} config
* @return {!FOARenderer}
*/
function FOADecoder(context, element, options) {};
function FOARenderer(context, config) {};

/**
* @param {Object} cameraMatrix - The Matrix4 object of the Three.js camera.
* @const
*/
FOADecoder.prototype.setRotationMatrixFromCamera = function(cameraMatrix) {};
Omnitone.FOARenderer = FOARenderer;

/**
* @param {string} mode - Decoding mode.
* When the mode is 'bypass' the decoder is disabled and bypass the input stream to the output.
* Setting the mode to 'ambisonic' activates the decoder.
* When the mode is 'off', all the processing is completely turned off saving the CPU power.
* Initializes and loads the resource for the renderer.
*/
FOARenderer.prototype.initialize = function() {};

/**
* Set the channel map.
* @param {Array<number>} channelMap - Custom channel routing for FOA stream.
*/
FOARenderer.prototype.setChannelMap = function(channelMap) {};

/**
* Updates the rotation matrix with 3x3 matrix.
* @param {Array<number>} rotationMatrix3 - A 3x3 rotation matrix. (column-major)
*/
FOADecoder.prototype.setMode = function(mode) {};
FOARenderer.prototype.setRotationMatrix3 = function(rotationMatrix3) {};

/**
*
* Updates the rotation matrix with 4x4 matrix.
* @param {Array<number>} rotationMatrix4 - A 4x4 rotation matrix. (column-major)
*/
FOADecoder.prototype.initialize = function() {};
FOARenderer.prototype.setRotationMatrix4 = function(rotationMatrix4) {};

/**
* Set the rotation matrix from a Three.js camera object. Deprecated in V1, and this exists only for the backward compatiblity. Instead, use |setRotatationMatrix4()| with Three.js |camera.worldMatrix.elements|.
* @deprecated
* @param {Object} cameraMatrix - Matrix4 from Three.js |camera.matrix|.
*/
FOARenderer.prototype.setRotationMatrixFromCamera = function(cameraMatrix) {};

/**
* Set the rendering mode.
* @param {string} mode - Rendering mode.
* - 'ambisonic': activates the ambisonic decoding/binaurl rendering.
* - 'bypass': bypasses the input stream directly to the output. No ambisonic
* decoding or encoding.
* - 'off': all the processing off saving the CPU power.
*/
FOARenderer.prototype.setRenderingMode = function(mode) {};

/**
* @type {GainNode}
*/
FOARenderer.prototype.input;

/**
* @type {GainNode}
*/
FOARenderer.prototype.output;

/**
* Omnitone HOA renderer class. Uses the optimized convolution technique.
* @constructor
* @param {AudioContext} context - Associated AudioContext.
* @param {HOARendererConfig} config
* @return {!HOARenderer}
*/
function HOARenderer(context, config) {};

/**
* @const
*/
Omnitone.FOADecoder = FOADecoder;
Omnitone.HOARenderer = HOARenderer;

/**
* Initializes and loads the resource for the renderer.
* @return {Promise}
*/
HOARenderer.prototype.initialize = function() {};

/**
* Updates the rotation matrix with 3x3 matrix.
* @param {Array<number>} rotationMatrix3 - A 3x3 rotation matrix. (column-major)
*/
HOARenderer.prototype.setRotationMatrix3 = function(rotationMatrix3) {};

/**
* Updates the rotation matrix with 4x4 matrix.
* @param {Array<number>} rotationMatrix4 - A 4x4 rotation matrix. (column-major)
*/
HOARenderer.prototype.setRotationMatrix4 = function(rotationMatrix4) {};

/**
* Set the decoding mode.
* @param {string} mode - Decoding mode.
* - 'ambisonic': activates the ambisonic decoding/binaurl rendering.
* - 'bypass': bypasses the input stream directly to the output. No ambisonic
* decoding or encoding.
* - 'off': all the processing off saving the CPU power.
*/
HOARenderer.prototype.setRenderingMode = function(mode) {};

/**
* @type {GainNode}
*/
HOARenderer.prototype.input;

/**
* @type {GainNode}
*/
HOARenderer.prototype.output;
Loading