-
Notifications
You must be signed in to change notification settings - Fork 826
Expand file tree
/
Copy pathSoundFactory.js
More file actions
82 lines (69 loc) · 2.47 KB
/
SoundFactory.js
File metadata and controls
82 lines (69 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// TODO remove SoundFactory from namespace
// namespace:
this.createjs = this.createjs || {};
createjs.soundUtils = createjs.soundUtils || {};
createjs.soundUtils.SoundFactory = (function () {
var SoundEventHandler = createjs.soundUtils.SoundEventHandler,
SoundInstance = createjs.soundUtils.SoundInstance,
SoundParser = createjs.soundUtils.SoundParser,
SoundPlugin = createjs.soundUtils.SoundPlugin,
SoundRegister = createjs.soundUtils.SoundRegister,
SoundVolume = createjs.soundUtils.SoundVolume;
var _soundEventHandler = null,
_soundInstance = null,
_soundParser = null,
_soundPlugin = null,
_soundRegister = null,
_soundVolume = null;
return {
getSoundEventHandler: getSoundEventHandler,
getSoundInstance: getSoundInstance,
getSoundParser: getSoundParser,
getSoundPlugin: getSoundPlugin,
getSoundRegister: getSoundRegister,
getSoundVolume: getSoundVolume
}
function getSoundEventHandler() {
if (!_soundEventHandler)
_soundEventHandler = new SoundEventHandler();
return _soundEventHandler;
}
function getSoundInstance() {
if (!_soundInstance) {
var soundPlugin = getSoundPlugin(),
soundParser = getSoundParser(),
soundRegister = getSoundRegister();
_soundInstance = new SoundInstance(soundPlugin, soundParser, soundRegister);
}
return _soundInstance;
}
function getSoundParser() {
if (!_soundParser) {
var soundVolume = getSoundVolume();
_soundParser = new SoundParser(soundVolume);
}
return _soundParser;
}
function getSoundPlugin() {
if (!_soundPlugin)
_soundPlugin = new SoundPlugin();
return _soundPlugin;
}
function getSoundRegister() {
if (!_soundRegister) {
var soundEventHandler = getSoundEventHandler(),
soundPlugin = getSoundPlugin(),
soundParser = getSoundParser();
_soundRegister = new SoundRegister(soundEventHandler, soundPlugin, soundParser);
}
return _soundRegister;
}
function getSoundVolume() {
if (!_soundVolume) {
var soundPlugin = getSoundPlugin(),
soundInstance = getSoundInstance();
_soundVolume = new SoundVolume(soundPlugin, soundInstance);
}
return _soundVolume;
}
})();