Toggle mute while holding the hydras

This commit is contained in:
Brad Davis 2015-09-04 15:26:50 -07:00
parent 7d2bdb3689
commit 644e81e20b
3 changed files with 16 additions and 0 deletions

View file

@ -612,6 +612,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// Setup the userInputMapper with the actions
auto userInputMapper = DependencyManager::get<UserInputMapper>();
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<AudioClient>()->toggleMute();
break;
}
}
});
// Setup the keyboardMouseDevice and the user input mapper with the default bindings
_keyboardMouseDevice->registerToUserInputMapper(*userInputMapper);

View file

@ -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) {

View file

@ -162,6 +162,9 @@ public:
ACTION1,
ACTION2,
CONTEXT_MENU,
TOGGLE_MUTE,
NUM_ACTIONS,
};