mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-13 02:32:17 +02:00
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:
parent
ff39a03b5d
commit
64ad0b5afb
3 changed files with 34 additions and 0 deletions
34
scripts/system/create/audioFeedback/audioFeedback.js
Normal file
34
scripts/system/create/audioFeedback/audioFeedback.js
Normal 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;
|
||||
})();
|
BIN
scripts/system/create/audioFeedback/sounds/confirmation.mp3
Normal file
BIN
scripts/system/create/audioFeedback/sounds/confirmation.mp3
Normal file
Binary file not shown.
BIN
scripts/system/create/audioFeedback/sounds/rejection.mp3
Normal file
BIN
scripts/system/create/audioFeedback/sounds/rejection.mp3
Normal file
Binary file not shown.
Loading…
Reference in a new issue