Merge pull request #18 from wayne-chen/pushToTalk

connecting pushingToTalkChanged with handlePushedToTalk
This commit is contained in:
Wayne Chen 2019-03-10 19:41:13 -07:00 committed by GitHub
commit a794da83da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

View file

@ -1435,8 +1435,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
});
connect(this, &Application::activeDisplayPluginChanged,
reinterpret_cast<scripting::Audio*>(audioScriptingInterface.data()), &scripting::Audio::onContextChanged);
connect(this, &Application::pushedToTalk,
reinterpret_cast<scripting::Audio*>(audioScriptingInterface.data()), &scripting::Audio::handlePushedToTalk);
}
// Create the rendering engine. This can be slow on some machines due to lots of
@ -1609,13 +1607,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
bool navAxis = false;
switch (actionEnum) {
case Action::TOGGLE_PUSHTOTALK:
if (audioScriptingInterface->getPTT()) {
if (state > 0.0f) {
audioScriptingInterface->setPushingToTalk(false);
} else if (state < 0.0f) {
audioScriptingInterface->setPushingToTalk(true);
}
if (state > 0.0f) {
audioScriptingInterface->setPushingToTalk(false);
} else if (state < 0.0f) {
audioScriptingInterface->setPushingToTalk(true);
}
break;
case Action::UI_NAV_VERTICAL:
navAxis = true;
@ -4218,7 +4215,8 @@ void Application::keyPressEvent(QKeyEvent* event) {
break;
case Qt::Key_T:
emit pushedToTalk(true);
auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
audioScriptingInterface->setPushingToTalk(true);
break;
case Qt::Key_P: {
@ -4329,7 +4327,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
switch (event->key()) {
case Qt::Key_T:
emit pushedToTalk(false);
auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
audioScriptingInterface->setPushingToTalk(false);
break;
}
}

View file

@ -358,8 +358,6 @@ signals:
void miniTabletEnabledChanged(bool enabled);
void pushedToTalk(bool enabled);
public slots:
QVector<EntityItemID> pasteEntities(float x, float y, float z);
bool exportEntities(const QString& filename, const QVector<QUuid>& entityIDs, const glm::vec3* givenOffset = nullptr);

View file

@ -40,6 +40,8 @@ Audio::Audio() : _devices(_contextIsHMD) {
connect(client, &AudioClient::inputLoudnessChanged, this, &Audio::onInputLoudnessChanged);
connect(client, &AudioClient::inputVolumeChanged, this, &Audio::setInputVolume);
connect(this, &Audio::contextChanged, &_devices, &AudioDevices::onContextChanged);
// when pushing to talk changed, handle it.
connect(this, &Audio::pushingToTalkChanged, this, &Audio::handlePushedToTalk);
enableNoiseReduction(enableNoiseReductionSetting.get());
onContextChanged();
}
@ -344,7 +346,6 @@ void Audio::handlePushedToTalk(bool enabled) {
} else {
setMuted(true);
}
setPushingToTalk(enabled);
}
}