connecting pushingToTalkChanged with handlePushedToTalk

This commit is contained in:
Wayne Chen 2019-03-10 19:39:45 -07:00
parent cf3694e8e3
commit 20487b2ad1
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, connect(this, &Application::activeDisplayPluginChanged,
reinterpret_cast<scripting::Audio*>(audioScriptingInterface.data()), &scripting::Audio::onContextChanged); 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 // 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; bool navAxis = false;
switch (actionEnum) { switch (actionEnum) {
case Action::TOGGLE_PUSHTOTALK: case Action::TOGGLE_PUSHTOTALK:
if (audioScriptingInterface->getPTT()) { if (state > 0.0f) {
if (state > 0.0f) { audioScriptingInterface->setPushingToTalk(false);
audioScriptingInterface->setPushingToTalk(false); } else if (state < 0.0f) {
} else if (state < 0.0f) { audioScriptingInterface->setPushingToTalk(true);
audioScriptingInterface->setPushingToTalk(true);
}
} }
break;
case Action::UI_NAV_VERTICAL: case Action::UI_NAV_VERTICAL:
navAxis = true; navAxis = true;
@ -4218,7 +4215,8 @@ void Application::keyPressEvent(QKeyEvent* event) {
break; break;
case Qt::Key_T: case Qt::Key_T:
emit pushedToTalk(true); auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
audioScriptingInterface->setPushingToTalk(true);
break; break;
case Qt::Key_P: { case Qt::Key_P: {
@ -4329,7 +4327,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
switch (event->key()) { switch (event->key()) {
case Qt::Key_T: case Qt::Key_T:
emit pushedToTalk(false); auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
audioScriptingInterface->setPushingToTalk(false);
break; break;
} }
} }

View file

@ -358,8 +358,6 @@ signals:
void miniTabletEnabledChanged(bool enabled); void miniTabletEnabledChanged(bool enabled);
void pushedToTalk(bool enabled);
public slots: public slots:
QVector<EntityItemID> pasteEntities(float x, float y, float z); QVector<EntityItemID> pasteEntities(float x, float y, float z);
bool exportEntities(const QString& filename, const QVector<QUuid>& entityIDs, const glm::vec3* givenOffset = nullptr); 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::inputLoudnessChanged, this, &Audio::onInputLoudnessChanged);
connect(client, &AudioClient::inputVolumeChanged, this, &Audio::setInputVolume); connect(client, &AudioClient::inputVolumeChanged, this, &Audio::setInputVolume);
connect(this, &Audio::contextChanged, &_devices, &AudioDevices::onContextChanged); connect(this, &Audio::contextChanged, &_devices, &AudioDevices::onContextChanged);
// when pushing to talk changed, handle it.
connect(this, &Audio::pushingToTalkChanged, this, &Audio::handlePushedToTalk);
enableNoiseReduction(enableNoiseReductionSetting.get()); enableNoiseReduction(enableNoiseReductionSetting.get());
onContextChanged(); onContextChanged();
} }
@ -344,7 +346,6 @@ void Audio::handlePushedToTalk(bool enabled) {
} else { } else {
setMuted(true); setMuted(true);
} }
setPushingToTalk(enabled);
} }
} }