2018-01-20 19:56:49 +00:00
|
|
|
var Class = require('../../utils/Class');
|
|
|
|
var EventEmitter = require('eventemitter3');
|
2018-01-20 20:28:37 +00:00
|
|
|
var Extend = require('../../utils/object/Extend');
|
2018-01-20 20:14:15 +00:00
|
|
|
var BaseSound = require('../BaseSound');
|
2018-01-26 13:51:34 +00:00
|
|
|
/*!
|
|
|
|
* @author Pavle Goloskokovic <pgoloskokovic@gmail.com> (http://prunegames.com)
|
|
|
|
*/
|
2018-01-20 19:56:49 +00:00
|
|
|
var NoAudioSound = new Class({
|
|
|
|
Extends: EventEmitter,
|
2018-01-26 13:51:34 +00:00
|
|
|
/**
|
|
|
|
* No audio implementation of the sound. It is used if audio has been
|
|
|
|
* disabled in the game config or the device doesn't support any audio.
|
|
|
|
*
|
|
|
|
* It represents a graceful degradation of sound logic that provides
|
|
|
|
* minimal functionality and prevents Phaser projects that use audio from
|
|
|
|
* breaking on devices that don't support any audio playback technologies.
|
|
|
|
*
|
|
|
|
* @class Phaser.Sound.NoAudioSound
|
|
|
|
* @constructor
|
|
|
|
* @param {Phaser.Sound.NoAudioSoundManager} manager - Reference to the current sound manager instance.
|
|
|
|
* @param {string} key - Asset key for the sound.
|
|
|
|
* @param {ISoundConfig} [config={}] - An optional config object containing default sound settings.
|
|
|
|
*/
|
2018-01-20 19:56:49 +00:00
|
|
|
initialize: function NoAudioSound(manager, key, config) {
|
2018-01-26 13:52:03 +00:00
|
|
|
if (config === void 0) { config = {}; }
|
2018-01-20 19:56:49 +00:00
|
|
|
EventEmitter.call(this);
|
2018-01-20 19:58:02 +00:00
|
|
|
this.manager = manager;
|
2018-01-20 19:58:31 +00:00
|
|
|
this.key = key;
|
2018-01-20 19:59:13 +00:00
|
|
|
this.isPlaying = false;
|
2018-01-20 19:59:27 +00:00
|
|
|
this.isPaused = false;
|
2018-01-20 20:00:31 +00:00
|
|
|
this.totalRate = 1;
|
2018-01-20 20:00:50 +00:00
|
|
|
this.duration = 0;
|
2018-01-20 20:01:04 +00:00
|
|
|
this.totalDuration = 0;
|
2018-01-20 20:07:00 +00:00
|
|
|
this.config = Extend({
|
|
|
|
mute: false,
|
|
|
|
volume: 1,
|
|
|
|
rate: 1,
|
|
|
|
detune: 0,
|
|
|
|
seek: 0,
|
|
|
|
loop: false,
|
|
|
|
delay: 0
|
|
|
|
}, config);
|
2018-01-20 20:07:30 +00:00
|
|
|
this.currentConfig = this.config;
|
2018-01-20 20:07:54 +00:00
|
|
|
this.mute = false;
|
2018-01-20 20:08:08 +00:00
|
|
|
this.volume = 1;
|
2018-01-20 20:08:21 +00:00
|
|
|
this.rate = 1;
|
2018-01-20 20:08:34 +00:00
|
|
|
this.detune = 0;
|
2018-01-20 20:08:47 +00:00
|
|
|
this.seek = 0;
|
2018-01-20 20:09:08 +00:00
|
|
|
this.loop = false;
|
2018-01-20 20:09:28 +00:00
|
|
|
this.markers = {};
|
2018-01-20 20:09:46 +00:00
|
|
|
this.currentMarker = null;
|
2018-01-20 20:10:00 +00:00
|
|
|
this.pendingRemove = false;
|
2018-01-20 20:10:51 +00:00
|
|
|
},
|
|
|
|
addMarker: function (marker) {
|
|
|
|
return false;
|
2018-01-20 20:11:16 +00:00
|
|
|
},
|
|
|
|
updateMarker: function (marker) {
|
|
|
|
return false;
|
2018-01-20 20:11:35 +00:00
|
|
|
},
|
|
|
|
removeMarker: function (markerName) {
|
|
|
|
return null;
|
2018-01-20 20:11:53 +00:00
|
|
|
},
|
|
|
|
play: function (markerName, config) {
|
|
|
|
return false;
|
2018-01-20 20:12:18 +00:00
|
|
|
},
|
|
|
|
pause: function () {
|
|
|
|
return false;
|
2018-01-20 20:12:36 +00:00
|
|
|
},
|
|
|
|
resume: function () {
|
|
|
|
return false;
|
2018-01-20 20:12:53 +00:00
|
|
|
},
|
|
|
|
stop: function () {
|
|
|
|
return false;
|
2018-01-20 20:13:36 +00:00
|
|
|
},
|
2018-01-20 20:14:15 +00:00
|
|
|
destroy: function () {
|
2018-01-20 20:18:42 +00:00
|
|
|
this.manager.remove(this);
|
2018-01-20 20:14:15 +00:00
|
|
|
BaseSound.prototype.destroy.call(this);
|
|
|
|
}
|
2018-01-20 19:56:49 +00:00
|
|
|
});
|
|
|
|
module.exports = NoAudioSound;
|