Removed sounds for tablet in and out, added sounds for stylus instead. Added logging for testing semi-pressed laser and keyboard sounds

This commit is contained in:
vladest 2017-09-25 17:11:44 +02:00
parent b5f0c4d940
commit 1a2d38e31f
5 changed files with 13 additions and 19 deletions

View file

@ -1,4 +1,5 @@
import QtQuick 2.0
import TabletScriptingInterface 1.0
Item {
id: keyItem
@ -32,8 +33,15 @@ Item {
}
}
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover)
}
}
onClicked: {
mouse.accepted = true;
tabletInterface.playSound(TabletEnums.ButtonClick)
webEntity.synthesizeKeyPress(glyph);
webEntity.synthesizeKeyPress(glyph, mirrorText);

View file

@ -1,7 +1,6 @@
import QtQuick 2.0
import Hifi 1.0
import QtQuick.Controls 1.4
import TabletScriptingInterface 1.0
import "../../dialogs"
import "../../controls"
@ -147,7 +146,7 @@ Item {
SoundEffect {
id: buttonClickSound
volume: 0.1
source: ""
source: "../../../sounds/Gamemaster-Audio-button-click.wav"
}
function playButtonClickSound() {

View file

@ -167,10 +167,6 @@ void Web3DOverlay::buildWebSurface() {
if (!self) {
return;
}
auto tabletScreenID = DependencyManager::get<HMDScriptingInterface>()->getCurrentTabletScreenID();
if (overlayID == tabletScreenID) { //play only on Tablet border crossing
DependencyManager::get<TabletScriptingInterface>()->playSound(TabletScriptingInterface::TabletHandsOut);
}
if (overlayID == selfOverlayID && (self->_pressed || (!self->_activeTouchPoints.empty() && self->_touchBeginAccepted))) {
PointerEvent endEvent(PointerEvent::Release, event.getID(), event.getPos2D(), event.getPos3D(), event.getNormal(), event.getDirection(),
event.getButton(), event.getButtons(), event.getKeyboardModifiers());
@ -178,19 +174,6 @@ void Web3DOverlay::buildWebSurface() {
}
});
QObject::connect(overlays, &Overlays::hoverEnterOverlay, this, [=](OverlayID overlayID, const PointerEvent& event) {
Q_UNUSED(event)
auto self = weakSelf.lock();
if (!self) {
return;
}
auto tabletScreenID = DependencyManager::get<HMDScriptingInterface>()->getCurrentTabletScreenID();
if (overlayID == tabletScreenID) { //play only on Tablet border crossing
DependencyManager::get<TabletScriptingInterface>()->playSound(TabletScriptingInterface::TabletHandsIn);
}
});
QObject::connect(this, &Web3DOverlay::scriptEventReceived, _webSurface.data(), &OffscreenQmlSurface::emitScriptEvent);
QObject::connect(_webSurface.data(), &OffscreenQmlSurface::webEventReceived, this, &Web3DOverlay::webEventReceived);
}

View file

@ -93,6 +93,7 @@ void TabletScriptingInterface::playSound(TabletAudioEvents aEvent) {
options.localOnly = options.localOnly || sound->isAmbisonic(); // force localOnly when Ambisonic
AudioInjectorPointer injector = AudioInjector::playSoundAndDelete(sound->getByteArray(), options);
qDebug() << "playing sound for event" << aEvent;
}
}

View file

@ -157,6 +157,8 @@ Script.include("/~/system/libraries/controllers.js");
return;
}
tabletInterface.playSound(3);//HandsIn
var X_ROT_NEG_90 = { x: -0.70710678, y: 0, z: 0, w: 0.70710678 };
var modelOrientation = Quat.multiply(this.stylusTip.orientation, X_ROT_NEG_90);
var modelPositionOffset = Vec3.multiplyQbyV(modelOrientation, { x: 0, y: 0, z: MyAvatar.sensorToWorldScale * -WEB_STYLUS_LENGTH / 2 });
@ -184,6 +186,7 @@ Script.include("/~/system/libraries/controllers.js");
if (!this.stylus) {
return;
}
tabletInterface.playSound(4);//HandsOut
Overlays.deleteOverlay(this.stylus);
this.stylus = null;
};