History

Allow Hifi.SoundEffect to be used in all qml

Including webEntities, webOverlays and the system tablet. We might want to add this to enable spatial sound effects for the web keyboard.

Anthony J. Thibault committed 9 years ago

Commit 0860c501 parent 2bff5586 files · +16 −32Browse files

Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 6 files). Show all

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+3−6
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212
1313 #include <AudioInjector.h>
1414 #include <PathUtils.h>
15+#include <RegisteredMetaTypes.h>
1516 #include "ScriptEngineLogging.h"
1617
1718 TabletScriptingInterface::TabletScriptingInterface() {
@@ -165,10 +166,6 @@ void TabletProxy::updateAudioBar(const double micLevel) { · 147 unmodified lines
165166 }
166167 }
167168
168−void TabletProxy::updateTabletPosition(glm::vec3 tabletPosition) {
169− _position.set(tabletPosition);
170−}
171−
172169 void TabletProxy::emitScriptEvent(QVariant msg) {
173170 if (_qmlOffscreenSurface) {
174171 QMetaObject::invokeMethod(_qmlOffscreenSurface, "emitScriptEvent", Qt::AutoConnection, Q_ARG(QVariant, msg));
@@ -269,13 +266,13 @@ void SoundEffect::setSource(QUrl url) { · 94 unmodified lines
269266 _sound = DependencyManager::get<SoundCache>()->getSound(_url);
270267 }
271268
272−void SoundEffect::play() {
269+void SoundEffect::play(QVariant position) {
273270 auto tsi = DependencyManager::get<TabletScriptingInterface>();
274271 if (tsi) {
275272 TabletProxy* tablet = qobject_cast<TabletProxy*>(tsi->getTablet("com.highfidelity.interface.tablet.system"));
276273 if (tablet) {
277274 AudioInjectorOptions options;
278− options.position = tablet->getPosition();
275+ options.position = vec3FromVariant(position);
279276 options.localOnly = true;
280277 if (_injector) {
281278 _injector->setOptions(options);