mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 09:29:02 +02:00
Initial implementation (deadlocks still occurring in Audio.cpp)
This commit is contained in:
parent
3b274c2b6e
commit
88a125aff0
4 changed files with 71 additions and 32 deletions
|
@ -152,6 +152,25 @@ Rectangle {
|
||||||
checked = Qt.binding(function() { return AudioScriptingInterface.noiseReduction; }); // restore binding
|
checked = Qt.binding(function() { return AudioScriptingInterface.noiseReduction; }); // restore binding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AudioControls.CheckBox {
|
||||||
|
spacing: muteMic.spacing
|
||||||
|
text: qsTr("Push To Talk");
|
||||||
|
checked: isVR ? AudioScriptingInterface.pushToTalkHMD : AudioScriptingInterface.pushToTalkDesktop;
|
||||||
|
onClicked: {
|
||||||
|
if (isVR) {
|
||||||
|
AudioScriptingInterface.pushToTalkHMD = checked;
|
||||||
|
} else {
|
||||||
|
AudioScriptingInterface.pushToTalkDesktop = checked;
|
||||||
|
}
|
||||||
|
checked = Qt.binding(function() {
|
||||||
|
if (isVR) {
|
||||||
|
return AudioScriptingInterface.pushToTalkHMD;
|
||||||
|
} else {
|
||||||
|
return AudioScriptingInterface.pushToTalkDesktop;
|
||||||
|
}
|
||||||
|
}); // restore binding
|
||||||
|
}
|
||||||
|
}
|
||||||
AudioControls.CheckBox {
|
AudioControls.CheckBox {
|
||||||
spacing: muteMic.spacing
|
spacing: muteMic.spacing
|
||||||
text: qsTr("Show audio level meter");
|
text: qsTr("Show audio level meter");
|
||||||
|
|
|
@ -19,13 +19,13 @@ Rectangle {
|
||||||
HifiConstants { id: hifi; }
|
HifiConstants { id: hifi; }
|
||||||
|
|
||||||
readonly property var level: AudioScriptingInterface.inputLevel;
|
readonly property var level: AudioScriptingInterface.inputLevel;
|
||||||
|
|
||||||
property bool gated: false;
|
property bool gated: false;
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; });
|
AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; });
|
||||||
AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; });
|
AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool standalone: false;
|
property bool standalone: false;
|
||||||
property var dragTarget: null;
|
property var dragTarget: null;
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ Rectangle {
|
||||||
Item {
|
Item {
|
||||||
id: status;
|
id: status;
|
||||||
|
|
||||||
readonly property string color: AudioScriptingInterface.muted ? colors.muted : colors.unmuted;
|
readonly property string color: (AudioScriptingInterface.pushingToTalk && AudioScriptingInterface.muted) ? hifi.colors.blueHighlight : AudioScriptingInterface.muted ? colors.muted : colors.unmuted;
|
||||||
|
|
||||||
visible: (AudioScriptingInterface.pushToTalk && !AudioScriptingInterface.pushingToTalk) || AudioScriptingInterface.muted;
|
visible: (AudioScriptingInterface.pushToTalk && !AudioScriptingInterface.pushingToTalk) || AudioScriptingInterface.muted;
|
||||||
|
|
||||||
|
@ -235,12 +235,12 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: gatedIndicator;
|
id: gatedIndicator;
|
||||||
visible: gated && !AudioScriptingInterface.clipping
|
visible: gated && !AudioScriptingInterface.clipping
|
||||||
|
|
||||||
radius: 4;
|
radius: 4;
|
||||||
width: 2 * radius;
|
width: 2 * radius;
|
||||||
height: 2 * radius;
|
height: 2 * radius;
|
||||||
color: "#0080FF";
|
color: "#0080FF";
|
||||||
|
@ -249,12 +249,12 @@ Rectangle {
|
||||||
verticalCenter: parent.verticalCenter;
|
verticalCenter: parent.verticalCenter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: clippingIndicator;
|
id: clippingIndicator;
|
||||||
visible: AudioScriptingInterface.clipping
|
visible: AudioScriptingInterface.clipping
|
||||||
|
|
||||||
radius: 4;
|
radius: 4;
|
||||||
width: 2 * radius;
|
width: 2 * radius;
|
||||||
height: 2 * radius;
|
height: 2 * radius;
|
||||||
color: colors.red;
|
color: colors.red;
|
||||||
|
|
|
@ -231,6 +231,26 @@ void Audio::loadData() {
|
||||||
_pttHMD = _pttHMDSetting.get();
|
_pttHMD = _pttHMDSetting.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Audio::getPTTHMD() const {
|
||||||
|
return resultWithReadLock<bool>([&] {
|
||||||
|
return _pttHMD;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void Audio::saveData() {
|
||||||
|
_desktopMutedSetting.set(getMutedDesktop());
|
||||||
|
_hmdMutedSetting.set(getMutedHMD());
|
||||||
|
_pttDesktopSetting.set(getPTTDesktop());
|
||||||
|
_pttHMDSetting.set(getPTTHMD());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Audio::loadData() {
|
||||||
|
_desktopMuted = _desktopMutedSetting.get();
|
||||||
|
_hmdMuted = _hmdMutedSetting.get();
|
||||||
|
_pttDesktop = _pttDesktopSetting.get();
|
||||||
|
_pttHMD = _pttHMDSetting.get();
|
||||||
|
}
|
||||||
|
|
||||||
bool Audio::noiseReductionEnabled() const {
|
bool Audio::noiseReductionEnabled() const {
|
||||||
return resultWithReadLock<bool>([&] {
|
return resultWithReadLock<bool>([&] {
|
||||||
return _enableNoiseReduction;
|
return _enableNoiseReduction;
|
||||||
|
|
|
@ -41,16 +41,16 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
|
||||||
* @hifi-assignment-client
|
* @hifi-assignment-client
|
||||||
*
|
*
|
||||||
* @property {boolean} muted - <code>true</code> if the audio input is muted, otherwise <code>false</code>.
|
* @property {boolean} muted - <code>true</code> if the audio input is muted, otherwise <code>false</code>.
|
||||||
* @property {boolean} noiseReduction - <code>true</code> if noise reduction is enabled, otherwise <code>false</code>. When
|
* @property {boolean} noiseReduction - <code>true</code> if noise reduction is enabled, otherwise <code>false</code>. When
|
||||||
* enabled, the input audio signal is blocked (fully attenuated) when it falls below an adaptive threshold set just
|
* enabled, the input audio signal is blocked (fully attenuated) when it falls below an adaptive threshold set just
|
||||||
* above the noise floor.
|
* above the noise floor.
|
||||||
* @property {number} inputLevel - The loudness of the audio input, range <code>0.0</code> (no sound) –
|
* @property {number} inputLevel - The loudness of the audio input, range <code>0.0</code> (no sound) –
|
||||||
* <code>1.0</code> (the onset of clipping). <em>Read-only.</em>
|
* <code>1.0</code> (the onset of clipping). <em>Read-only.</em>
|
||||||
* @property {boolean} clipping - <code>true</code> if the audio input is clipping, otherwise <code>false</code>.
|
* @property {boolean} clipping - <code>true</code> if the audio input is clipping, otherwise <code>false</code>.
|
||||||
* @property {number} inputVolume - Adjusts the volume of the input audio; range <code>0.0</code> – <code>1.0</code>.
|
* @property {number} inputVolume - Adjusts the volume of the input audio; range <code>0.0</code> – <code>1.0</code>.
|
||||||
* If set to a value, the resulting value depends on the input device: for example, the volume can't be changed on some
|
* 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 <code>0.0</code> and <code>1.0</code>.
|
* devices, and others might only support values of <code>0.0</code> and <code>1.0</code>.
|
||||||
* @property {boolean} isStereoInput - <code>true</code> if the input audio is being used in stereo, otherwise
|
* @property {boolean} isStereoInput - <code>true</code> if the input audio is being used in stereo, otherwise
|
||||||
* <code>false</code>. Some devices do not support stereo, in which case the value is always <code>false</code>.
|
* <code>false</code>. Some devices do not support stereo, in which case the value is always <code>false</code>.
|
||||||
* @property {string} context - The current context of the audio: either <code>"Desktop"</code> or <code>"HMD"</code>.
|
* @property {string} context - The current context of the audio: either <code>"Desktop"</code> or <code>"HMD"</code>.
|
||||||
* <em>Read-only.</em>
|
* <em>Read-only.</em>
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function Audio.setInputDevice
|
* @function Audio.setInputDevice
|
||||||
* @param {object} device
|
* @param {object} device
|
||||||
* @param {boolean} isHMD
|
* @param {boolean} isHMD
|
||||||
* @deprecated This function is deprecated and will be removed.
|
* @deprecated This function is deprecated and will be removed.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void setInputDevice(const QAudioDeviceInfo& device, bool isHMD);
|
Q_INVOKABLE void setInputDevice(const QAudioDeviceInfo& device, bool isHMD);
|
||||||
|
@ -129,8 +129,8 @@ public:
|
||||||
Q_INVOKABLE void setOutputDevice(const QAudioDeviceInfo& device, bool isHMD);
|
Q_INVOKABLE void setOutputDevice(const QAudioDeviceInfo& device, bool isHMD);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Enable or disable reverberation. Reverberation is done by the client, on the post-mix audio. The reverberation options
|
* 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
|
* come from either the domain's audio zone if used — configured on the server — or as scripted by
|
||||||
* {@link Audio.setReverbOptions|setReverbOptions}.
|
* {@link Audio.setReverbOptions|setReverbOptions}.
|
||||||
* @function Audio.setReverb
|
* @function Audio.setReverb
|
||||||
* @param {boolean} enable - <code>true</code> to enable reverberation, <code>false</code> to disable.
|
* @param {boolean} enable - <code>true</code> to enable reverberation, <code>false</code> to disable.
|
||||||
|
@ -140,13 +140,13 @@ public:
|
||||||
* var injectorOptions = {
|
* var injectorOptions = {
|
||||||
* position: MyAvatar.position
|
* position: MyAvatar.position
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* Script.setTimeout(function () {
|
* Script.setTimeout(function () {
|
||||||
* print("Reverb OFF");
|
* print("Reverb OFF");
|
||||||
* Audio.setReverb(false);
|
* Audio.setReverb(false);
|
||||||
* injector = Audio.playSound(sound, injectorOptions);
|
* injector = Audio.playSound(sound, injectorOptions);
|
||||||
* }, 1000);
|
* }, 1000);
|
||||||
*
|
*
|
||||||
* Script.setTimeout(function () {
|
* Script.setTimeout(function () {
|
||||||
* var reverbOptions = new AudioEffectOptions();
|
* var reverbOptions = new AudioEffectOptions();
|
||||||
* reverbOptions.roomSize = 100;
|
* reverbOptions.roomSize = 100;
|
||||||
|
@ -154,26 +154,26 @@ public:
|
||||||
* print("Reverb ON");
|
* print("Reverb ON");
|
||||||
* Audio.setReverb(true);
|
* Audio.setReverb(true);
|
||||||
* }, 4000);
|
* }, 4000);
|
||||||
*
|
*
|
||||||
* Script.setTimeout(function () {
|
* Script.setTimeout(function () {
|
||||||
* print("Reverb OFF");
|
* print("Reverb OFF");
|
||||||
* Audio.setReverb(false);
|
* Audio.setReverb(false);
|
||||||
* }, 8000); */
|
* }, 8000); */
|
||||||
Q_INVOKABLE void setReverb(bool enable);
|
Q_INVOKABLE void setReverb(bool enable);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Configure reverberation options. Use {@link Audio.setReverb|setReverb} to enable or disable reverberation.
|
* Configure reverberation options. Use {@link Audio.setReverb|setReverb} to enable or disable reverberation.
|
||||||
* @function Audio.setReverbOptions
|
* @function Audio.setReverbOptions
|
||||||
* @param {AudioEffectOptions} options - The reverberation options.
|
* @param {AudioEffectOptions} options - The reverberation options.
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void setReverbOptions(const AudioEffectOptions* options);
|
Q_INVOKABLE void setReverbOptions(const AudioEffectOptions* options);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Starts making an audio recording of the audio being played in-world (i.e., not local-only audio) to a file in WAV format.
|
* Starts making an audio recording of the audio being played in-world (i.e., not local-only audio) to a file in WAV format.
|
||||||
* @function Audio.startRecording
|
* @function Audio.startRecording
|
||||||
* @param {string} filename - The path and name of the file to make the recording in. Should have a <code>.wav</code>
|
* @param {string} filename - The path and name of the file to make the recording in. Should have a <code>.wav</code>
|
||||||
* extension. The file is overwritten if it already exists.
|
* extension. The file is overwritten if it already exists.
|
||||||
* @returns {boolean} <code>true</code> if the specified file could be opened and audio recording has started, otherwise
|
* @returns {boolean} <code>true</code> if the specified file could be opened and audio recording has started, otherwise
|
||||||
* <code>false</code>.
|
* <code>false</code>.
|
||||||
* @example <caption>Make a 10 second audio recording.</caption>
|
* @example <caption>Make a 10 second audio recording.</caption>
|
||||||
* var filename = File.getTempDir() + "/audio.wav";
|
* var filename = File.getTempDir() + "/audio.wav";
|
||||||
|
@ -182,13 +182,13 @@ public:
|
||||||
* Audio.stopRecording();
|
* Audio.stopRecording();
|
||||||
* print("Audio recording made in: " + filename);
|
* print("Audio recording made in: " + filename);
|
||||||
* }, 10000);
|
* }, 10000);
|
||||||
*
|
*
|
||||||
* } else {
|
* } else {
|
||||||
* print("Could not make an audio recording in: " + filename);
|
* print("Could not make an audio recording in: " + filename);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool startRecording(const QString& filename);
|
Q_INVOKABLE bool startRecording(const QString& filename);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Finish making an audio recording started with {@link Audio.startRecording|startRecording}.
|
* Finish making an audio recording started with {@link Audio.startRecording|startRecording}.
|
||||||
* @function Audio.stopRecording
|
* @function Audio.stopRecording
|
||||||
|
@ -222,7 +222,7 @@ signals:
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
void mutedChanged(bool isMuted);
|
void mutedChanged(bool isMuted);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Triggered when desktop audio input is muted or unmuted.
|
* Triggered when desktop audio input is muted or unmuted.
|
||||||
* @function Audio.desktopMutedChanged
|
* @function Audio.desktopMutedChanged
|
||||||
|
@ -274,9 +274,9 @@ signals:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Triggered when the input audio volume changes.
|
* Triggered when the input audio volume changes.
|
||||||
* @function Audio.inputVolumeChanged
|
* @function Audio.inputVolumeChanged
|
||||||
* @param {number} volume - The requested volume to be applied to the audio input, range <code>0.0</code> –
|
* @param {number} volume - The requested volume to be applied to the audio input, range <code>0.0</code> –
|
||||||
* <code>1.0</code>. The resulting value of <code>Audio.inputVolume</code> depends on the capabilities of the device:
|
* <code>1.0</code>. The resulting value of <code>Audio.inputVolume</code> 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 <code>0.0</code>
|
* for example, the volume can't be changed on some devices, and others might only support values of <code>0.0</code>
|
||||||
* and <code>1.0</code>.
|
* and <code>1.0</code>.
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
|
@ -285,7 +285,7 @@ signals:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Triggered when the input audio level changes.
|
* Triggered when the input audio level changes.
|
||||||
* @function Audio.inputLevelChanged
|
* @function Audio.inputLevelChanged
|
||||||
* @param {number} level - The loudness of the input audio, range <code>0.0</code> (no sound) – <code>1.0</code> (the
|
* @param {number} level - The loudness of the input audio, range <code>0.0</code> (no sound) – <code>1.0</code> (the
|
||||||
* onset of clipping).
|
* onset of clipping).
|
||||||
* @returns {Signal}
|
* @returns {Signal}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue