mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:49:12 +02:00
mv showAudioTools to just AvatarInputs
This commit is contained in:
parent
7d3bf75f0b
commit
89bd895054
5 changed files with 8 additions and 33 deletions
|
@ -59,10 +59,10 @@ Rectangle {
|
||||||
}
|
}
|
||||||
Audio.CheckBox {
|
Audio.CheckBox {
|
||||||
text: qsTr("Show audio level meter");
|
text: qsTr("Show audio level meter");
|
||||||
checked: Audio.showMicMeter
|
checked: AvatarInputs.showAudioTools
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Audio.showMicMeter = checked;
|
AvatarInputs.showAudioTools = checked;
|
||||||
checked = Qt.binding(function() { return Audio.showMicMeter; }); // restore binding
|
checked = Qt.binding(function() { return AvatarInputs.showAudioTools }); // restore binding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1924,16 +1924,7 @@ void Application::initializeUi() {
|
||||||
|
|
||||||
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
||||||
|
|
||||||
{
|
rootContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||||
auto ai = AvatarInputs::getInstance();
|
|
||||||
rootContext->setContextProperty("AvatarInputs", ai);
|
|
||||||
|
|
||||||
// hook up audio
|
|
||||||
auto audio = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
|
|
||||||
connect(ai, &AvatarInputs::showAudioToolsChanged, audio, &scripting::Audio::onChangedMicMeter);
|
|
||||||
connect(audio, &scripting::Audio::changedMicMeter, ai, &AvatarInputs::setShowAudioTools);
|
|
||||||
ai->setShowAudioTools(audio->micMeterShown());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||||
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
||||||
|
|
|
@ -22,7 +22,6 @@ QString Audio::DESKTOP { "Desktop" };
|
||||||
QString Audio::HMD { "VR" };
|
QString Audio::HMD { "VR" };
|
||||||
|
|
||||||
Setting::Handle<bool> enableNoiseReductionSetting { QStringList { Audio::AUDIO, "NoiseReduction" }, true };
|
Setting::Handle<bool> enableNoiseReductionSetting { QStringList { Audio::AUDIO, "NoiseReduction" }, true };
|
||||||
Setting::Handle<bool> showMicMeterSetting { QStringList { Audio::AUDIO, "MicMeter" }, false };
|
|
||||||
|
|
||||||
Audio::Audio() {
|
Audio::Audio() {
|
||||||
auto client = DependencyManager::get<AudioClient>();
|
auto client = DependencyManager::get<AudioClient>();
|
||||||
|
@ -31,7 +30,6 @@ Audio::Audio() {
|
||||||
connect(&_devices._inputs, &AudioDeviceList::deviceChanged, this, &Audio::onInputChanged);
|
connect(&_devices._inputs, &AudioDeviceList::deviceChanged, this, &Audio::onInputChanged);
|
||||||
|
|
||||||
enableNoiseReduction(enableNoiseReductionSetting.get());
|
enableNoiseReduction(enableNoiseReductionSetting.get());
|
||||||
_showMicMeter = showMicMeterSetting.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::setReverb(bool enable) {
|
void Audio::setReverb(bool enable) {
|
||||||
|
@ -87,18 +85,6 @@ void Audio::enableNoiseReduction(bool enable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::onChangedMicMeter(bool show) {
|
|
||||||
showMicMeter(show);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio::showMicMeter(bool show) {
|
|
||||||
if (_showMicMeter != show) {
|
|
||||||
showMicMeterSetting.set(show);
|
|
||||||
_showMicMeter = show;
|
|
||||||
emit changedMicMeter(show);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Audio::setInputVolume(float volume) {
|
void Audio::setInputVolume(float volume) {
|
||||||
// getInputVolume will not reflect changes synchronously, so clamp beforehand
|
// getInputVolume will not reflect changes synchronously, so clamp beforehand
|
||||||
volume = glm::clamp(volume, 0.0f, 1.0f);
|
volume = glm::clamp(volume, 0.0f, 1.0f);
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Audio : public AudioScriptingInterface {
|
||||||
|
|
||||||
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY changedMuted)
|
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY changedMuted)
|
||||||
Q_PROPERTY(bool noiseReduction READ noiseReductionEnabled WRITE enableNoiseReduction NOTIFY changedNoiseReduction)
|
Q_PROPERTY(bool noiseReduction READ noiseReductionEnabled WRITE enableNoiseReduction NOTIFY changedNoiseReduction)
|
||||||
Q_PROPERTY(bool showMicMeter READ micMeterShown WRITE showMicMeter NOTIFY changedMicMeter)
|
|
||||||
Q_PROPERTY(float inputVolume READ getInputVolume WRITE setInputVolume NOTIFY changedInputVolume)
|
Q_PROPERTY(float inputVolume READ getInputVolume WRITE setInputVolume NOTIFY changedInputVolume)
|
||||||
Q_PROPERTY(QString context READ getContext NOTIFY changedContext)
|
Q_PROPERTY(QString context READ getContext NOTIFY changedContext)
|
||||||
Q_PROPERTY(AudioDevices* devices READ getDevices NOTIFY nop)
|
Q_PROPERTY(AudioDevices* devices READ getDevices NOTIFY nop)
|
||||||
|
@ -39,7 +38,6 @@ public:
|
||||||
|
|
||||||
bool isMuted() const { return _isMuted; }
|
bool isMuted() const { return _isMuted; }
|
||||||
bool noiseReductionEnabled() const { return _enableNoiseReduction; }
|
bool noiseReductionEnabled() const { return _enableNoiseReduction; }
|
||||||
bool micMeterShown() const { return _showMicMeter; }
|
|
||||||
float getInputVolume() const { return _inputVolume; }
|
float getInputVolume() const { return _inputVolume; }
|
||||||
QString getContext() const;
|
QString getContext() const;
|
||||||
|
|
||||||
|
@ -55,13 +53,11 @@ signals:
|
||||||
void nop();
|
void nop();
|
||||||
void changedMuted(bool);
|
void changedMuted(bool);
|
||||||
void changedNoiseReduction(bool);
|
void changedNoiseReduction(bool);
|
||||||
void changedMicMeter(bool);
|
|
||||||
void changedInputVolume(float);
|
void changedInputVolume(float);
|
||||||
void changedContext(QString);
|
void changedContext(QString);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onChangedMuted();
|
void onChangedMuted();
|
||||||
void onChangedMicMeter(bool);
|
|
||||||
void onChangedContext();
|
void onChangedContext();
|
||||||
void onInputChanged();
|
void onInputChanged();
|
||||||
|
|
||||||
|
@ -73,7 +69,6 @@ private:
|
||||||
float _inputVolume { 1.0f };
|
float _inputVolume { 1.0f };
|
||||||
bool _isMuted { false };
|
bool _isMuted { false };
|
||||||
bool _enableNoiseReduction;
|
bool _enableNoiseReduction;
|
||||||
bool _showMicMeter;
|
|
||||||
bool _contextIsHMD { false };
|
bool _contextIsHMD { false };
|
||||||
|
|
||||||
AudioDevices* getDevices() { return &_devices; }
|
AudioDevices* getDevices() { return &_devices; }
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
|
|
||||||
HIFI_QML_DEF(AvatarInputs)
|
HIFI_QML_DEF(AvatarInputs)
|
||||||
|
|
||||||
|
|
||||||
static AvatarInputs* INSTANCE{ nullptr };
|
static AvatarInputs* INSTANCE{ nullptr };
|
||||||
|
|
||||||
|
Setting::Handle<bool> showAudioToolsSetting { QStringList { "AvatarInputs", "showAudioTools" }, false };
|
||||||
|
|
||||||
AvatarInputs* AvatarInputs::getInstance() {
|
AvatarInputs* AvatarInputs::getInstance() {
|
||||||
if (!INSTANCE) {
|
if (!INSTANCE) {
|
||||||
AvatarInputs::registerType();
|
AvatarInputs::registerType();
|
||||||
|
@ -32,6 +33,7 @@ AvatarInputs* AvatarInputs::getInstance() {
|
||||||
|
|
||||||
AvatarInputs::AvatarInputs(QQuickItem* parent) : QQuickItem(parent) {
|
AvatarInputs::AvatarInputs(QQuickItem* parent) : QQuickItem(parent) {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
_showAudioTools = showAudioToolsSetting.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AI_UPDATE(name, src) \
|
#define AI_UPDATE(name, src) \
|
||||||
|
@ -111,6 +113,7 @@ void AvatarInputs::setShowAudioTools(bool showAudioTools) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_showAudioTools = showAudioTools;
|
_showAudioTools = showAudioTools;
|
||||||
|
showAudioToolsSetting.set(_showAudioTools);
|
||||||
emit showAudioToolsChanged(_showAudioTools);
|
emit showAudioToolsChanged(_showAudioTools);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue