mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 18:14:05 +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
interface
|
@ -59,10 +59,10 @@ Rectangle {
|
|||
}
|
||||
Audio.CheckBox {
|
||||
text: qsTr("Show audio level meter");
|
||||
checked: Audio.showMicMeter
|
||||
checked: AvatarInputs.showAudioTools
|
||||
onClicked: {
|
||||
Audio.showMicMeter = checked;
|
||||
checked = Qt.binding(function() { return Audio.showMicMeter; }); // restore binding
|
||||
AvatarInputs.showAudioTools = checked;
|
||||
checked = Qt.binding(function() { return AvatarInputs.showAudioTools }); // restore binding
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1924,16 +1924,7 @@ void Application::initializeUi() {
|
|||
|
||||
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
||||
|
||||
{
|
||||
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());
|
||||
}
|
||||
rootContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||
|
||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
||||
|
|
|
@ -22,7 +22,6 @@ QString Audio::DESKTOP { "Desktop" };
|
|||
QString Audio::HMD { "VR" };
|
||||
|
||||
Setting::Handle<bool> enableNoiseReductionSetting { QStringList { Audio::AUDIO, "NoiseReduction" }, true };
|
||||
Setting::Handle<bool> showMicMeterSetting { QStringList { Audio::AUDIO, "MicMeter" }, false };
|
||||
|
||||
Audio::Audio() {
|
||||
auto client = DependencyManager::get<AudioClient>();
|
||||
|
@ -31,7 +30,6 @@ Audio::Audio() {
|
|||
connect(&_devices._inputs, &AudioDeviceList::deviceChanged, this, &Audio::onInputChanged);
|
||||
|
||||
enableNoiseReduction(enableNoiseReductionSetting.get());
|
||||
_showMicMeter = showMicMeterSetting.get();
|
||||
}
|
||||
|
||||
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) {
|
||||
// getInputVolume will not reflect changes synchronously, so clamp beforehand
|
||||
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 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(QString context READ getContext NOTIFY changedContext)
|
||||
Q_PROPERTY(AudioDevices* devices READ getDevices NOTIFY nop)
|
||||
|
@ -39,7 +38,6 @@ public:
|
|||
|
||||
bool isMuted() const { return _isMuted; }
|
||||
bool noiseReductionEnabled() const { return _enableNoiseReduction; }
|
||||
bool micMeterShown() const { return _showMicMeter; }
|
||||
float getInputVolume() const { return _inputVolume; }
|
||||
QString getContext() const;
|
||||
|
||||
|
@ -55,13 +53,11 @@ signals:
|
|||
void nop();
|
||||
void changedMuted(bool);
|
||||
void changedNoiseReduction(bool);
|
||||
void changedMicMeter(bool);
|
||||
void changedInputVolume(float);
|
||||
void changedContext(QString);
|
||||
|
||||
public slots:
|
||||
void onChangedMuted();
|
||||
void onChangedMicMeter(bool);
|
||||
void onChangedContext();
|
||||
void onInputChanged();
|
||||
|
||||
|
@ -73,7 +69,6 @@ private:
|
|||
float _inputVolume { 1.0f };
|
||||
bool _isMuted { false };
|
||||
bool _enableNoiseReduction;
|
||||
bool _showMicMeter;
|
||||
bool _contextIsHMD { false };
|
||||
|
||||
AudioDevices* getDevices() { return &_devices; }
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
|
||||
HIFI_QML_DEF(AvatarInputs)
|
||||
|
||||
|
||||
static AvatarInputs* INSTANCE{ nullptr };
|
||||
|
||||
Setting::Handle<bool> showAudioToolsSetting { QStringList { "AvatarInputs", "showAudioTools" }, false };
|
||||
|
||||
AvatarInputs* AvatarInputs::getInstance() {
|
||||
if (!INSTANCE) {
|
||||
AvatarInputs::registerType();
|
||||
|
@ -32,6 +33,7 @@ AvatarInputs* AvatarInputs::getInstance() {
|
|||
|
||||
AvatarInputs::AvatarInputs(QQuickItem* parent) : QQuickItem(parent) {
|
||||
INSTANCE = this;
|
||||
_showAudioTools = showAudioToolsSetting.get();
|
||||
}
|
||||
|
||||
#define AI_UPDATE(name, src) \
|
||||
|
@ -111,6 +113,7 @@ void AvatarInputs::setShowAudioTools(bool showAudioTools) {
|
|||
return;
|
||||
|
||||
_showAudioTools = showAudioTools;
|
||||
showAudioToolsSetting.set(_showAudioTools);
|
||||
emit showAudioToolsChanged(_showAudioTools);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue