Skip to content

Commit 5b6fb58

Browse files
fixed a few bugs with AudioFile class
- _this and device audio references - added logging for when audio is disabled or no supported urls are found
1 parent 36ffb13 commit 5b6fb58

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

v3/src/loader/filetypes/AudioFile.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var AudioFile = new Class({
3939
this.soundManager.context.decodeAudioData(this.xhrLoader.response,
4040
function (audioBuffer)
4141
{
42-
this.data = audioBuffer;
42+
_this.data = audioBuffer;
4343

4444
_this.onComplete();
4545

@@ -68,14 +68,16 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
6868
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
6969
{
7070
// TODO log not loading audio because sounds are disabled
71+
console.info('Skipping loading audio \'' + key + '\' since sounds are disabled.');
7172
return;
7273
}
7374

74-
var url = AudioFile.findAudioURL(urls);
75+
var url = AudioFile.findAudioURL(game, urls);
7576

7677
if (!url)
7778
{
7879
// TODO log no supported types
80+
console.warn('No supported url provided for audio \'' + key + '\'!');
7981
return;
8082
}
8183

@@ -133,7 +135,7 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
133135
// }
134136
// ],
135137
// config, xhrSettings);
136-
AudioFile.findAudioURL = function (urls)
138+
AudioFile.findAudioURL = function (game, urls)
137139
{
138140
if (urls.constructor !== Array)
139141
{
@@ -152,7 +154,7 @@ AudioFile.findAudioURL = function (urls)
152154
var type = url.match(/\.([a-zA-Z0-9]+)($|\?)/);
153155
type = GetFastValue(urls[i], 'type', type ? type[1] : '').toLowerCase();
154156

155-
if (Audio[type])
157+
if (game.device.Audio[type])
156158
{
157159
return {
158160
uri: url,

0 commit comments

Comments
 (0)