diff --git a/interface/src/scripting/Audio.h b/interface/src/scripting/Audio.h
index f7dd252c54..4b8eb6aabc 100644
--- a/interface/src/scripting/Audio.h
+++ b/interface/src/scripting/Audio.h
@@ -26,7 +26,7 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
SINGLETON_DEPENDENCY
/**jsdoc
- * The Audio
API ... TODO
+ * The Audio
API provides facilities to interact with audio inputs and outputs and to play sounds.
*
* @namespace Audio
*
@@ -35,15 +35,23 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
* @hifi-server-entity
* @hifi-assignment-client
*
- * @property {boolean} muted - true
if TODO, otherwise false
.
- * @property {boolean} noiseReduction - true
if TODO, otherwise false
.
- * @property {number} inputVolume - TODO
- * @property {number} inputLevel - TODO Read-only.
- * @property {string} context - TODO Read-only.
- * @property {object} devices Read-only. Deprecated: This property is deprecated and will be
+ * @property {boolean} muted - true
if the audio input is muted, otherwise false
.
+ * @property {boolean} noiseReduction - true
if noise reduction is enabled, otherwise false
. When
+ * enabled, the input audio signal is blocked (fully attenuated) when it falls below an adaptive threshold set just
+ * above the noise floor.
+ * @property {number} inputLevel - The loudness of the audio input, range 0.0
(no sound) –
+ * 1.0
(the onset of clipping). Read-only.
+ * @property {number} inputVolume - Adjusts the volume of the input audio; range 0.0
– 1.0
.
+ * If set to a value, the resulting value depends on the input device: for example, the volume can't be changed on some
+ * devices, and others might only support values of 0.0
and 1.0
.
+ * @property {boolean} isStereoInput - true
if the input audio is being used in stereo, otherwise
+ * false
. Some devices do not support stereo, in which case the value is always false
.
+ * @property {string} context - The current context of the audio: either "Desktop"
or "HMD"
.
+ * Read-only.
+ * @property {object} devices Read-only. Deprecated: This property is deprecated and will be
* removed.
*/
-
+
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
Q_PROPERTY(bool noiseReduction READ noiseReductionEnabled WRITE enableNoiseReduction NOTIFY noiseReductionChanged)
Q_PROPERTY(float inputVolume READ getInputVolume WRITE setInputVolume NOTIFY inputVolumeChanged)
@@ -85,85 +93,132 @@ public:
Q_INVOKABLE void setOutputDevice(const QAudioDeviceInfo& device, bool isHMD);
/**jsdoc
- * TODO
+ * Enable or disable reverberation. Reverberation is done by the client, on the post-mix audio. The reverberation options
+ * come from either the domain's audio zone if used — configured on the server — or as scripted by
+ * {@link Audio.setReverbOptions|setReverbOptions}.
* @function Audio.setReverb
- * @param {boolean} enable - TODO
- */
+ * @param {boolean} enable - true
to enable reverberation, false
to disable.
+ * @example
true
if TODO, otherwise false
.
+ * @param {string} filename - The path and name of the file to make the recording in. Should have a .wav
+ * extension. The file is overwritten if it already exists.
+ * @returns {boolean} true
if the specified file could be opened and audio recording has started, otherwise
+ * false
.
+ * @example true
if TODO, otherwise false
.
+ * @returns {boolean} true
if an audio recording is currently being made, otherwise false
.
*/
Q_INVOKABLE bool getRecording();
signals:
/**jsdoc
- * Triggered when ... TODO
* @function Audio.nop
* @returns {Signal}
+ * @deprecated This signal is deprecated and will be removed.
*/
void nop();
/**jsdoc
- * Triggered when ... TODO
+ * Triggered when the audio input is muted or unmuted.
* @function Audio.mutedChanged
- * @param {boolean} isMuted - TODO
+ * @param {boolean} isMuted - true
if the audio input is muted, otherwise false
.
* @returns {Signal}
+ * @example true
if audio input noise reduction is enabled, otherwise false
.
* @returns {Signal}
*/
void noiseReductionChanged(bool isEnabled);
/**jsdoc
- * Triggered when ... TODO
+ * Triggered when the input audio volume changes.
* @function Audio.inputVolumeChanged
- * @param {number} volume - TODO
+ * @param {number} volume - The requested volume to be applied to the audio input, range 0.0
–
+ * 1.0
. The resulting value of Audio.inputVolume
depends on the capabilities of the device:
+ * for example, the volume can't be changed on some devices, and others might only support values of 0.0
+ * and 1.0
.
* @returns {Signal}
*/
void inputVolumeChanged(float volume);
/**jsdoc
- * Triggered when ... TODO
+ * Triggered when the input audio level changes.
* @function Audio.inputLevelChanged
- * @param {number} level - TODO
+ * @param {number} level - The loudness of the input audio, range 0.0
(no sound) – 1.0
(the
+ * onset of clipping).
* @returns {Signal}
*/
void inputLevelChanged(float level);
/**jsdoc
- * Triggered when ... TODO
+ * Triggered when the current context of the audio changes.
* @function Audio.contextChanged
- * @param {string} context - TODO
+ * @param {string} context - The current context of the audio: either "Desktop"
or "HMD"
.
* @returns {Signal}
*/
void contextChanged(const QString& context);
diff --git a/libraries/audio/src/AudioEffectOptions.cpp b/libraries/audio/src/AudioEffectOptions.cpp
index 3ed1296b63..873ce7df87 100644
--- a/libraries/audio/src/AudioEffectOptions.cpp
+++ b/libraries/audio/src/AudioEffectOptions.cpp
@@ -59,29 +59,29 @@ static void setOption(QScriptValue arguments, const QString name, float defaultV
}
/**jsdoc
- * TODO
+ * Reverberation options that can be used to initialize an {@link AudioEffectOptions} object when created.
* @typedef {object} AudioEffectOptions.ReverbOptions
- * @property {number} bandwidth - TODO
- * @property {number} preDelay - TODO
- * @property {number} lateDelay - TODO
- * @property {number} reverbTime - TODO
- * @property {number} earlyDiffusion - TODO
- * @property {number} lateDiffusion - TODO
- * @property {number} roomSize - TODO
- * @property {number} density - TODO
- * @property {number} bassMult - TODO
- * @property {number} bassFreq - TODO
- * @property {number} highGain - TODO
- * @property {number} highFreq - TODO
- * @property {number} modRate - TODO
- * @property {number} modDepth - TODO
- * @property {number} earlyGain - TODO
- * @property {number} lateGain - TODO
- * @property {number} earlyMixLeft - TODO
- * @property {number} earlyMixRight - TODO
- * @property {number} lateMixLeft - TODO
- * @property {number} lateMixRight - TODO
- * @property {number} wetDryMix - TODO
+ * @property {number} bandwidth=10000 - The corner frequency (Hz) of the low-pass filter at reverb input.
+ * @property {number} preDelay=20 - The delay (milliseconds) between dry signal and the onset of early reflections.
+ * @property {number} lateDelay=0 - The delay (milliseconds) between early reflections and the onset of reverb tail.
+ * @property {number} reverbTime=2 - The time (seconds) for the reverb tail to decay by 60dB, also known as RT60.
+ * @property {number} earlyDiffusion=100 - Adjusts the buildup of echo density in the early reflections, normally 100%.
+ * @property {number} lateDiffusion=100 - Adjusts the buildup of echo density in the reverb tail, normally 100%.
+ * @property {number} roomSize=50 - The apparent room size, from small (0%) to large (100%).
+ * @property {number} density=100 - Adjusts the echo density in the reverb tail, normally 100%.
+ * @property {number} bassMult=1.5 - Adjusts the bass-frequency reverb time, as multiple of reverbTime.
+ * @property {number} bassFreq=250 - The crossover frequency (Hz) for the onset of bassMult.
+ * @property {number} highGain=-6 - Reduces the high-frequency reverb time, as attenuation (dB).
+ * @property {number} highFreq=3000 - The crossover frequency (Hz) for the onset of highGain.
+ * @property {number} modRate=2.3 - The rate of modulation (Hz) of the LFO-modulated delay lines.
+ * @property {number} modDepth=50 - The depth of modulation (percent) of the LFO-modulated delay lines.
+ * @property {number} earlyGain=0 - Adjusts the relative level (dB) of the early reflections.
+ * @property {number} lateGain=0 - Adjusts the relative level (dB) of the reverb tail.
+ * @property {number} earlyMixLeft=20 - The apparent distance of the source (percent) in the early reflections.
+ * @property {number} earlyMixRight=20 - The apparent distance of the source (percent) in the early reflections.
+ * @property {number} lateMixLeft=90 - The apparent distance of the source (percent) in the reverb tail.
+ * @property {number} lateMixRight=90 - The apparent distance of the source (percent) in the reverb tail.
+ * @property {number} wetDryMix=50 - Adjusts the wet/dry ratio, from completely dry (0%) to completely wet (100%).
*/
AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) {
setOption(arguments, BANDWIDTH_HANDLE, BANDWIDTH_DEFAULT, _bandwidth);
diff --git a/libraries/audio/src/AudioEffectOptions.h b/libraries/audio/src/AudioEffectOptions.h
index 0e2e017d49..4bc7957142 100644
--- a/libraries/audio/src/AudioEffectOptions.h
+++ b/libraries/audio/src/AudioEffectOptions.h
@@ -16,38 +16,39 @@
#include Create using new AudioEffectOptions(reverbOptions)
.
true
if TODO, otherwise false
.
- * @property {boolean} ignorePenumbra=false - true
if TODO, otherwise false
.
- * @property {boolean} localOnly=false - true
if TODO, otherwise false
.
- * @property {number} secondOffset=0 - TODO
- * @property {number} pitch=1 - TODO
+ * @property {Vec3} position=Vec3.ZERO - The position in the domain to play the sound.
+ * @property {Quat} orientation=Quat.IDENTITY - The orientation in the domain to play the sound in.
+ * @property {number} volume=1.0 - Playback volume, between 0.0
and 1.0
.
+ * @property {number} pitch=1.0 - Alter the pitch of the sound, within +/- 2 octaves. The value is the relative sample rate to
+ * resample the sound at, range 0.0625
– 16.0
. A value of 0.0625
lowers the
+ * pitch by 2 octaves; 1.0
is no change in pitch; 16.0
raises the pitch by 2 octaves.
+ * @property {boolean} loop=false - If true
, the sound is played repeatedly until playback is stopped.
+ * @property {number} secondOffset=0 - Starts playback from a specified time (seconds) within the sound file, ≥
+ * 0
.
+ * @property {boolean} localOnly=false - IF true
, the sound is played back locally on the client rather than to
+ * others via the audio mixer.
+ * @property {boolean} ignorePenumbra=false - Deprecated: This property is deprecated and will be
+ * removed.
*/
void injectorOptionsFromScriptValue(const QScriptValue& object, AudioInjectorOptions& injectorOptions) {
if (!object.isObject()) {
diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h
index 0edcb59cca..348600e4ae 100644
--- a/libraries/audio/src/Sound.h
+++ b/libraries/audio/src/Sound.h
@@ -79,8 +79,13 @@ private:
typedef QSharedPointerSupported formats:
+ *".stereo"
to be interpreted as stereo.true
if TODO, otherwise false
.
- * @property {number} duration - TODO
+ * @property {boolean} downloaded - true
if the sound has been downloaded and is ready to be played, otherwise
+ * false
.
+ * @property {number} duration - The duration of the sound, in seconds.
*/
class SoundScriptingInterface : public QObject {
Q_OBJECT
@@ -106,7 +112,7 @@ public:
float getDuration() { return _sound->getDuration(); }
/**jsdoc
- * Triggered when TODO
+ * Triggered when the sound has been downloaded and is ready to be played.
* @function SoundObject.ready
* @returns {Signal}
*/
diff --git a/libraries/audio/src/SoundCache.h b/libraries/audio/src/SoundCache.h
index 4352b1d459..ecb4451153 100644
--- a/libraries/audio/src/SoundCache.h
+++ b/libraries/audio/src/SoundCache.h
@@ -78,8 +78,9 @@ public:
/**jsdoc
+ * Loads the content of an audio file into an object, ready for playback by {@link Audio.playSound}.
* @function SoundCache.getSound
- * @param {string} url
+ * @param {string} url - The URL of the audio file to load. See {@link SoundObject} for supported formats.
* @returns {SoundObject}
*/
Q_INVOKABLE SharedSoundPointer getSound(const QUrl& url);
diff --git a/libraries/script-engine/src/AudioScriptingInterface.h b/libraries/script-engine/src/AudioScriptingInterface.h
index 6b87b0ee67..72b9541763 100644
--- a/libraries/script-engine/src/AudioScriptingInterface.h
+++ b/libraries/script-engine/src/AudioScriptingInterface.h
@@ -23,6 +23,7 @@ class AudioScriptingInterface : public QObject, public Dependency {
Q_OBJECT
SINGLETON_DEPENDENCY
+ // JSDoc for property is in Audio.h.
Q_PROPERTY(bool isStereoInput READ isStereoInput WRITE setStereoInput NOTIFY isStereoInputChanged)
public:
@@ -35,49 +36,69 @@ protected:
// these methods are protected to stop C++ callers from calling, but invokable from script
/**jsdoc
- * TODO
+ * Starts playing — "injecting" — the content of an audio file. The sound is played globally (sent to the audio
+ * mixer) so that everyone hears it, unless the injectorOptions
has localOnly
set to
+ * true
in which case only the client hears the sound played. No sound is played if sent to the audio mixer
+ * but the client is not connected to an audio mixer. The {@link AudioInjector} object returned by the function can be used
+ * to control the playback and get information about its current state.
* @function Audio.playSound
- * @param {SoundObject} sound - TODO
- * @param {AudioInjector.AudioInjectorOptions} [injectorOptions={}] - TODO
- * @returns {AudioInjector} TODO
+ * @param {SoundObject} sound - The content of an audio file, loaded using {@link SoundCache.getSound}. See
+ * {@link SoundObject} for supported formats.
+ * @param {AudioInjector.AudioInjectorOptions} [injectorOptions={}] - Audio injector configuration.
+ * @returns {AudioInjector} The audio injector that plays the audio file.
+ * @example localOnly
set true
and
+ * the specified position
.
* @function Audio.playSystemSound
- * @param {SoundObject} sound - TODO
- * @param {Vec3} position - TODO
- * @returns {AudioInjector} TODO
+ * @param {SoundObject} sound - The content of an audio file, loaded using {@link SoundCache.getSound}. See
+ * {@link SoundObject} for supported formats.
+ * @param {Vec3} position - The position in the domain to play the sound.
+ * @returns {AudioInjector} The audio injector that plays the audio file.
*/
// FIXME: there is no way to play a positionless sound
Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position);
/**jsdoc
- * TODO
+ * Set whether or not the audio input should be used in stereo. If the audio input does not support stereo then setting a
+ * value of true
has no effect.
* @function Audio.setStereoInput
- * @param {boolean} stereo - TODO
+ * @param {boolean} stereo - true
if the audio input should be used in stereo, otherwise false
.
*/
Q_INVOKABLE void setStereoInput(bool stereo);
/**jsdoc
- * TODO
+ * Get whether or not the audio input is used in stereo.
* @function Audio.isStereoInput
- * @returns {boolean} true
if TODO, otherwise false
.
+ * @returns {boolean} true
if the audio input is used in stereo, otherwise false
.
*/
Q_INVOKABLE bool isStereoInput();
signals:
/**jsdoc
- * Triggered when the client is muted by the mixer.
+ * Triggered when the client is muted by the mixer because their loudness value for the noise background has reached the
+ * threshold set for the domain in the server settings.
* @function Audio.mutedByMixer
* @returns {Signal}
*/
void mutedByMixer();
/**jsdoc
- * Triggered when the entire environment is muted by the mixer. TODO: What is the "whole environment"?
+ * Triggered when everyone is muted by the mixer.
* @function Audio.environmentMuted
* @returns {Signal}
*/
@@ -98,31 +119,35 @@ signals:
void disconnected();
/**jsdoc
- * Triggered when the noise gate is opened. TODO: Description of noise gate.
+ * Triggered when the noise gate is opened: the input audio signal is no longer blocked (fully attenuated) because it has
+ * risen above an adaptive threshold set just above the noise floor. Only occurs if Audio.noiseReduction
is
+ * true
.
* @function Audio.noiseGateOpened
* @returns {Signal}
*/
void noiseGateOpened();
/**jsdoc
- * Triggered when the noise gate is closed. TODO: Description of noise gate.
+ * Triggered when the noise gate is closed: the input audio signal is blocked (fully attenuated) because it has fallen
+ * below an adaptive threshold set just above the noise floor. Only occurs if Audio.noiseReduction
is
+ * true
.
* @function Audio.noiseGateClosed
* @returns {Signal}
*/
void noiseGateClosed();
/**jsdoc
- * Triggered when a frame of microphone audio input is processed.
+ * Triggered when a frame of audio input is processed.
* @function Audio.inputReceived
- * @param {Int16Array} inputSamples - TODO
+ * @param {Int16Array} inputSamples - The audio input processed.
* @returns {Signal}
*/
void inputReceived(const QByteArray& inputSamples);
/**jsdoc
- * TODO
+ * Triggered when the input audio use changes between mono and stereo.
* @function Audio.isStereoInputChanged
- * @param {boolean} isStereo - TODO
+ * @param {boolean} isStereo - true
if the input audio is stereo, otherwise false
.
* @returns {Signal}
*/
void isStereoInputChanged(bool isStereo);
diff --git a/libraries/script-engine/src/ScriptAudioInjector.h b/libraries/script-engine/src/ScriptAudioInjector.h
index 5d66461160..2c88d618e1 100644
--- a/libraries/script-engine/src/ScriptAudioInjector.h
+++ b/libraries/script-engine/src/ScriptAudioInjector.h
@@ -17,8 +17,7 @@
#include true
if TODO, otherwise false
. Read-only.
- * @property {number} loudness - TODO Read-only.
- * @property {AudioInjector.AudioInjectorOptions} options - TODO
+ * @property {boolean} playing - true
if the audio is currently playing, otherwise false
.
+ * Read-only.
+ * @property {number} loudness - The loudness in the last frame of audio, range 0.0
– 1.0
.
+ * Read-only.
+ * @property {AudioInjector.AudioInjectorOptions} options - Configures how the injector plays the audio.
*/
class ScriptAudioInjector : public QObject {
Q_OBJECT
@@ -43,58 +44,99 @@ public:
public slots:
/**jsdoc
- * TODO
+ * Stop current playback, if any, and start playing from the beginning.
* @function AudioInjector.restart
*/
void restart() { _injector->restart(); }
/**jsdoc
- * TODO
+ * Stop audio playback.
* @function AudioInjector.stop
+ * @example 0.0
– 1.0
.
*/
float getLoudness() const { return _injector->getLoudness(); }
/**jsdoc
- * TODO
+ * Get whether or not the audio is currently playing.
* @function AudioInjector.isPlaying
- * @returns {boolean} true
if TODO, otherwise false
.
+ * @returns {boolean} true
if the audio is currently playing, otherwise false
.
+ * @example