mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Add local injector gains to the Audio scripting interface
This commit is contained in:
parent
95b4f954a6
commit
37429a07b8
2 changed files with 70 additions and 4 deletions
|
@ -426,3 +426,37 @@ float Audio::getInjectorGain() {
|
|||
return DependencyManager::get<NodeList>()->getInjectorGain();
|
||||
});
|
||||
}
|
||||
|
||||
void Audio::setLocalInjectorGain(float gain) {
|
||||
withWriteLock([&] {
|
||||
if (_localInjectorGain != gain) {
|
||||
_localInjectorGain = gain;
|
||||
// convert dB to amplitude
|
||||
gain = fastExp2f(gain / 6.02059991f);
|
||||
DependencyManager::get<AudioClient>()->setLocalInjectorGain(gain);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
float Audio::getLocalInjectorGain() {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _localInjectorGain;
|
||||
});
|
||||
}
|
||||
|
||||
void Audio::setSystemInjectorGain(float gain) {
|
||||
withWriteLock([&] {
|
||||
if (_systemInjectorGain != gain) {
|
||||
_systemInjectorGain = gain;
|
||||
// convert dB to amplitude
|
||||
gain = fastExp2f(gain / 6.02059991f);
|
||||
DependencyManager::get<AudioClient>()->setSystemInjectorGain(gain);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
float Audio::getSystemInjectorGain() {
|
||||
return resultWithReadLock<float>([&] {
|
||||
return _systemInjectorGain;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public:
|
|||
Q_INVOKABLE void setReverbOptions(const AudioEffectOptions* options);
|
||||
|
||||
/**jsdoc
|
||||
* Sets the master avatar gain at the server.
|
||||
* Sets the avatar gain at the server.
|
||||
* Units are Decibels (dB)
|
||||
* @function Audio.setAvatarGain
|
||||
* @param {number} gain (in dB)
|
||||
|
@ -179,14 +179,14 @@ public:
|
|||
Q_INVOKABLE void setAvatarGain(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Gets the master avatar gain at the server.
|
||||
* Gets the avatar gain at the server.
|
||||
* @function Audio.getAvatarGain
|
||||
* @returns {number} gain (in dB)
|
||||
*/
|
||||
Q_INVOKABLE float getAvatarGain();
|
||||
|
||||
/**jsdoc
|
||||
* Sets the audio injector gain at the server.
|
||||
* Sets the injector gain at the server.
|
||||
* Units are Decibels (dB)
|
||||
* @function Audio.setInjectorGain
|
||||
* @param {number} gain (in dB)
|
||||
|
@ -194,12 +194,42 @@ public:
|
|||
Q_INVOKABLE void setInjectorGain(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Gets the audio injector gain at the server.
|
||||
* Gets the injector gain at the server.
|
||||
* @function Audio.getInjectorGain
|
||||
* @returns {number} gain (in dB)
|
||||
*/
|
||||
Q_INVOKABLE float getInjectorGain();
|
||||
|
||||
/**jsdoc
|
||||
* Sets the local injector gain in the client.
|
||||
* Units are Decibels (dB)
|
||||
* @function Audio.setLocalInjectorGain
|
||||
* @param {number} gain (in dB)
|
||||
*/
|
||||
Q_INVOKABLE void setLocalInjectorGain(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Gets the local injector gain in the client.
|
||||
* @function Audio.getLocalInjectorGain
|
||||
* @returns {number} gain (in dB)
|
||||
*/
|
||||
Q_INVOKABLE float getLocalInjectorGain();
|
||||
|
||||
/**jsdoc
|
||||
* Sets the injector gain for system sounds.
|
||||
* Units are Decibels (dB)
|
||||
* @function Audio.setSystemInjectorGain
|
||||
* @param {number} gain (in dB)
|
||||
*/
|
||||
Q_INVOKABLE void setSystemInjectorGain(float gain);
|
||||
|
||||
/**jsdoc
|
||||
* Gets the injector gain for system sounds.
|
||||
* @function Audio.getSystemInjectorGain
|
||||
* @returns {number} gain (in dB)
|
||||
*/
|
||||
Q_INVOKABLE float getSystemInjectorGain();
|
||||
|
||||
/**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.
|
||||
* @function Audio.startRecording
|
||||
|
@ -380,6 +410,8 @@ private:
|
|||
|
||||
float _inputVolume { 1.0f };
|
||||
float _inputLevel { 0.0f };
|
||||
float _localInjectorGain { 0.0f }; // in dB
|
||||
float _systemInjectorGain { 0.0f }; // in dB
|
||||
bool _isClipping { false };
|
||||
bool _enableNoiseReduction { true }; // Match default value of AudioClient::_isNoiseGateEnabled.
|
||||
bool _enableWarnWhenMuted { true };
|
||||
|
|
Loading…
Reference in a new issue