Add audioFeedback mechanism

Add an audio feedback mechanism
to play confirmation or rejection sound on specific actions that are not visually detectable.
- Duplicate (mainly for the HMD use case where the new entity is generated at the exact same position)
- Parent and Unparent (because it not visually detectable in HMD if the action was successful or not)
This commit is contained in:
Alezia Kurdis 2020-09-30 23:54:06 -04:00 committed by GitHub
parent ff39a03b5d
commit 64ad0b5afb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,34 @@
//
// audioFeedback.js
//
// Created by Alezia Kurdis on September 30, 2020.
// Copyright 2020 Vircadia contributors
//
// This script add audio feedback (confirmation and rejection) for user interactions that require one.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
audioFeedback = (function() {
var that = {};
var confirmationSound = SoundCache.getSound(Script.resolvePath("./sounds/confirmation.mp3"));
var rejectionSound = SoundCache.getSound(Script.resolvePath("./sounds/rejection.mp3"));
that.confirmation = function() { //Play a confirmation sound
var injector = Audio.playSound(confirmationSound, {
"volume": 0.3,
"localOnly": true
});
}
that.rejection = function() { //Play a rejection sound
var injector = Audio.playSound(rejectionSound, {
"volume": 0.3,
"localOnly": true
});
}
return that;
})();