overte/scripts/system/dialTone.js

37 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2016-08-23 12:34:32 -07:00
"use strict";
//
// dialTone.js
// examples
//
// Created by Stephen Birarda on 06/08/15.
// Added disconnect HRS 6/11/15.
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
2016-08-23 12:34:32 -07:00
(function() { // BEGIN LOCAL_SCOPE
2016-08-23 12:34:32 -07:00
// setup the local sound we're going to use
var connectSound = SoundCache.getSound(Script.resolvePath("assets/sounds/hello.wav"));
var disconnectSound = SoundCache.getSound(Script.resolvePath("assets/sounds/goodbye.wav"));
var micMutedSound = SoundCache.getSound(Script.resolvePath("assets/sounds/goodbye.wav"));
// setup the options needed for that sound
2015-06-12 12:33:17 -07:00
var soundOptions = {
2015-06-08 11:31:24 -07:00
localOnly: true
};
// play the sound locally once we get the first audio packet from a mixer
Audio.receivedFirstPacket.connect(function(){
2015-06-12 12:33:17 -07:00
Audio.playSound(connectSound, soundOptions);
});
Audio.disconnected.connect(function(){
2015-06-12 12:33:17 -07:00
Audio.playSound(disconnectSound, soundOptions);
});
2016-08-23 12:34:32 -07:00
}()); // END LOCAL_SCOPE