Commit e2f14bcc authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Improve inclusiveness of language in earcon_engine.js

To replace "master", I chose outputVolume for masterVolume because it's
applied as a final factor, and then basePan and baseReverb because
individual earcons use those values as a starting point for further
adjustments.

Bug: 842296
Change-Id: I5b36205b6dcafd1351daf3b66d2686618804007a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487882Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821053}
parent d6fc20eb
...@@ -17,11 +17,11 @@ EarconEngine = class { ...@@ -17,11 +17,11 @@ EarconEngine = class {
constructor() { constructor() {
// Public control parameters. All of these are meant to be adjustable. // Public control parameters. All of these are meant to be adjustable.
/** @type {number} The master volume, as an amplification factor. */ /** @type {number} The output volume, as an amplification factor. */
this.masterVolume = 1.0; this.outputVolume = 1.0;
/** @type {number} The base relative pitch adjustment, in half-steps. */ /** @type {number} The base relative pitch adjustment, in half-steps. */
this.masterPitch = -4; this.basePitch = -4;
/** @type {number} The click volume, as an amplification factor. */ /** @type {number} The click volume, as an amplification factor. */
this.clickVolume = 0.4; this.clickVolume = 0.4;
...@@ -35,11 +35,11 @@ EarconEngine = class { ...@@ -35,11 +35,11 @@ EarconEngine = class {
/** @type {number} The base delay for repeated sounds, in seconds. */ /** @type {number} The base delay for repeated sounds, in seconds. */
this.baseDelay = 0.045; this.baseDelay = 0.045;
/** @type {number} The master stereo panning, from -1 to 1. */ /** @type {number} The base stereo panning, from -1 to 1. */
this.masterPan = EarconEngine.CENTER_PAN_; this.basePan = EarconEngine.CENTER_PAN_;
/** @type {number} The master reverb level as an amplification factor. */ /** @type {number} The base reverb level as an amplification factor. */
this.masterReverb = 0.4; this.baseReverb = 0.4;
/** /**
* @type {string} The choice of the reverb impulse response to use. * @type {string} The choice of the reverb impulse response to use.
...@@ -155,7 +155,7 @@ EarconEngine = class { ...@@ -155,7 +155,7 @@ EarconEngine = class {
/** /**
* Return an AudioNode containing the final processing that all * Return an AudioNode containing the final processing that all
* sounds go through: master volume / gain, panning, and reverb. * sounds go through: output volume / gain, panning, and reverb.
* The chain is hooked up to the destination automatically, so you * The chain is hooked up to the destination automatically, so you
* just need to connect your source to the return value from this * just need to connect your source to the return value from this
* method. * method.
...@@ -165,12 +165,12 @@ EarconEngine = class { ...@@ -165,12 +165,12 @@ EarconEngine = class {
* reverb: (number | undefined)}} properties * reverb: (number | undefined)}} properties
* An object where you can override the default * An object where you can override the default
* gain, pan, and reverb, otherwise these are taken from * gain, pan, and reverb, otherwise these are taken from
* masterVolume, masterPan, and masterReverb. * outputVolume, basePan, and baseReverb.
* @return {!AudioNode} The filters to be applied to all sounds, connected * @return {!AudioNode} The filters to be applied to all sounds, connected
* to the destination node. * to the destination node.
*/ */
createCommonFilters(properties) { createCommonFilters(properties) {
let gain = this.masterVolume; let gain = this.outputVolume;
if (properties.gain) { if (properties.gain) {
gain *= properties.gain; gain *= properties.gain;
} }
...@@ -179,7 +179,7 @@ EarconEngine = class { ...@@ -179,7 +179,7 @@ EarconEngine = class {
const first = gainNode; const first = gainNode;
let last = gainNode; let last = gainNode;
let pan = this.masterPan; let pan = this.basePan;
if (properties.pan !== undefined) { if (properties.pan !== undefined) {
pan = properties.pan; pan = properties.pan;
} }
...@@ -191,7 +191,7 @@ EarconEngine = class { ...@@ -191,7 +191,7 @@ EarconEngine = class {
last = panNode; last = panNode;
} }
let reverb = this.masterReverb; let reverb = this.baseReverb;
if (properties.reverb !== undefined) { if (properties.reverb !== undefined) {
reverb = properties.reverb; reverb = properties.reverb;
} }
...@@ -249,7 +249,7 @@ EarconEngine = class { ...@@ -249,7 +249,7 @@ EarconEngine = class {
opt_properties = /** @type {undefined} */ ({}); opt_properties = /** @type {undefined} */ ({});
} }
let pitch = this.masterPitch; let pitch = this.basePitch;
if (opt_properties.pitch) { if (opt_properties.pitch) {
pitch += opt_properties.pitch; pitch += opt_properties.pitch;
} }
...@@ -426,7 +426,7 @@ EarconEngine = class { ...@@ -426,7 +426,7 @@ EarconEngine = class {
* and the decay time |decay|, in seconds. * and the decay time |decay|, in seconds.
* *
* As with other functions, |pan| and |reverb| can be used to override * As with other functions, |pan| and |reverb| can be used to override
* masterPan and masterReverb. * basePan and baseReverb.
* *
* @param {{gain: number, * @param {{gain: number,
* freq: number, * freq: number,
...@@ -753,14 +753,14 @@ EarconEngine = class { ...@@ -753,14 +753,14 @@ EarconEngine = class {
// pan position. // pan position.
x = (2 * x - 1) * EarconEngine.MAX_PAN_ABS_X_POSITION; x = (2 * x - 1) * EarconEngine.MAX_PAN_ABS_X_POSITION;
this.masterPan = x; this.basePan = x;
} }
/** /**
* Resets panning to default (centered). * Resets panning to default (centered).
*/ */
resetPan() { resetPan() {
this.masterPan = EarconEngine.CENTER_PAN_; this.basePan = EarconEngine.CENTER_PAN_;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment