From 644e81e20b4c8b15cd53e7be0a9910668ac592a0 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Sep 2015 15:26:50 -0700 Subject: [PATCH] Toggle mute while holding the hydras --- interface/src/Application.cpp | 9 +++++++++ .../input-plugins/src/input-plugins/SixenseManager.cpp | 4 ++++ .../input-plugins/src/input-plugins/UserInputMapper.h | 3 +++ 3 files changed, 16 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 7321be5ac1..990e93c854 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -612,6 +612,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : // Setup the userInputMapper with the actions auto userInputMapper = DependencyManager::get(); connect(userInputMapper.data(), &UserInputMapper::actionEvent, &_controllerScriptingInterface, &AbstractControllerScriptingInterface::actionEvent); + connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) { + if (state) { + switch (action) { + case UserInputMapper::Action::TOGGLE_MUTE: + DependencyManager::get()->toggleMute(); + break; + } + } + }); // Setup the keyboardMouseDevice and the user input mapper with the default bindings _keyboardMouseDevice->registerToUserInputMapper(*userInputMapper); diff --git a/libraries/input-plugins/src/input-plugins/SixenseManager.cpp b/libraries/input-plugins/src/input-plugins/SixenseManager.cpp index f090db7959..9bc3a71fd5 100644 --- a/libraries/input-plugins/src/input-plugins/SixenseManager.cpp +++ b/libraries/input-plugins/src/input-plugins/SixenseManager.cpp @@ -595,6 +595,10 @@ void SixenseManager::assignDefaultInputMapping(UserInputMapper& mapper) { mapper.addInputChannel(UserInputMapper::LEFT_HAND_CLICK, makeInput(BACK_TRIGGER, 0)); mapper.addInputChannel(UserInputMapper::RIGHT_HAND_CLICK, makeInput(BACK_TRIGGER, 1)); + // TODO find a mechanism to allow users to navigate the context menu via + mapper.addInputChannel(UserInputMapper::CONTEXT_MENU, makeInput(BUTTON_0, 0)); + mapper.addInputChannel(UserInputMapper::TOGGLE_MUTE, makeInput(BUTTON_0, 1)); + } UserInputMapper::Input SixenseManager::makeInput(unsigned int button, int index) { diff --git a/libraries/input-plugins/src/input-plugins/UserInputMapper.h b/libraries/input-plugins/src/input-plugins/UserInputMapper.h index 464c39b64c..2657f335a0 100755 --- a/libraries/input-plugins/src/input-plugins/UserInputMapper.h +++ b/libraries/input-plugins/src/input-plugins/UserInputMapper.h @@ -162,6 +162,9 @@ public: ACTION1, ACTION2, + CONTEXT_MENU, + TOGGLE_MUTE, + NUM_ACTIONS, };