2
* Copyright (c) 2013, Intel Corporation.
4
* This program is licensed under the terms and conditions of the
5
* Apache License, version 2.0. The full text of the Apache License is at
6
* http://www.apache.org/licenses/LICENSE-2.0
10
// files is a map from a sound alias to a file URL,
11
// e.g. {"backgroundSound": "audio/background.ogg", ...}
12
var SoundBoard = function (files) {
18
SoundBoard.prototype.load = function (name) {
19
if (!this.sounds[name]) {
20
this.sounds[name] = new Sound(this.files[name]);
22
return this.sounds[name];
25
// pause all playing sounds
26
SoundBoard.prototype.pause = function () {
27
for (var name in this.sounds) {
28
this.sounds[name].pause();
33
SoundBoard.prototype.play = function (name) {
38
var sound = this.load(name);
41
sound.on('ready', function () {