diff --git a/scripts/system/create/audioFeedback/audioFeedback.js b/scripts/system/create/audioFeedback/audioFeedback.js new file mode 100644 index 0000000000..de94fb6efa --- /dev/null +++ b/scripts/system/create/audioFeedback/audioFeedback.js @@ -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; +})(); \ No newline at end of file diff --git a/scripts/system/create/audioFeedback/sounds/confirmation.mp3 b/scripts/system/create/audioFeedback/sounds/confirmation.mp3 new file mode 100644 index 0000000000..39143fce4f Binary files /dev/null and b/scripts/system/create/audioFeedback/sounds/confirmation.mp3 differ diff --git a/scripts/system/create/audioFeedback/sounds/rejection.mp3 b/scripts/system/create/audioFeedback/sounds/rejection.mp3 new file mode 100644 index 0000000000..46e564dcdc Binary files /dev/null and b/scripts/system/create/audioFeedback/sounds/rejection.mp3 differ