Skip to content

Commit cdcb68f

Browse files
committed
v2.0.1
1 parent 879d206 commit cdcb68f

8 files changed

+48
-21
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 2.0.1 (October 14, 2016)
2+
- `ADDED` Support for FLAC audio files.
3+
- `FIXED` Improve fading performance when short fade times are used ([#621](https://github.com/goldfire/howler.js/issues/621)).
4+
- `FIXED` Correctly handle fades from 0 to 0 volume ([#575](https://github.com/goldfire/howler.js/issues/575)).
5+
- `FIXED` Prevent a load error from blocking all future playback ([#613](https://github.com/goldfire/howler.js/issues/613)).
6+
- `FIXED` Reset `noAudio` to `false` when a sound is unloaded ([#617](https://github.com/goldfire/howler.js/pull/617)).
7+
- `FIXED` Stop a sound even if it is not playing ([#595](https://github.com/goldfire/howler.js/issues/595)).
8+
- `FIXED` Emit `stop` event before returning from `stop` ([#616](https://github.com/goldfire/howler.js/pull/616)).
9+
- `FIXED` Improve codec checks by removing `x-` prefix ([#576](https://github.com/goldfire/howler.js/issues/576)).
10+
- `FIXED` Set correct loop start/end when calling `loop` on a sprite ([#604](https://github.com/goldfire/howler.js/issues/604)).
11+
112
## 2.0.0 (July 19, 2016)
213
This major release contains just a few breaking changes outlined below. Howler.js has been rewritten from the ground up using the knowledge and work since the initial release. There's a long list of additions and improvements, which I urge you to read through as the library has evolved quite a bit over this time.
314

dist/howler.core.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/howler.js

+29-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* howler.js v2.0.0
2+
* howler.js v2.0.1
33
* howlerjs.com
44
*
55
* (c) 2013-2016, James Simpson of GoldFire Studios
@@ -170,7 +170,7 @@
170170
* @return {Boolean}
171171
*/
172172
codecs: function(ext) {
173-
return (this || Howler)._codecs[ext];
173+
return (this || Howler)._codecs[ext.replace(/^x-/, '')];
174174
},
175175

176176
/**
@@ -225,7 +225,8 @@
225225
mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
226226
weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
227227
webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
228-
dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, '')
228+
dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''),
229+
flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '')
229230
};
230231

231232
return self;
@@ -820,7 +821,7 @@
820821
// Get the sound.
821822
var sound = self._soundById(ids[i]);
822823

823-
if (sound && !sound._paused) {
824+
if (sound) {
824825
// Reset the seek position.
825826
sound._seek = sound._start || 0;
826827
sound._rateSeek = 0;
@@ -834,6 +835,10 @@
834835
if (self._webAudio) {
835836
// make sure the sound has been created
836837
if (!sound._node.bufferSource) {
838+
if (!internal) {
839+
self._emit('stop', sound._id);
840+
}
841+
837842
return self;
838843
}
839844

@@ -930,7 +935,7 @@
930935
if (args.length === 0) {
931936
// Return the value of the groups' volume.
932937
return self._volume;
933-
} else if (args.length === 1) {
938+
} else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') {
934939
// First check if this is an ID, and if not, assume it is a new volume.
935940
var ids = self._getSoundIds();
936941
var index = ids.indexOf(args[0]);
@@ -1008,7 +1013,13 @@
10081013
var diff = Math.abs(from - to);
10091014
var dir = from > to ? 'out' : 'in';
10101015
var steps = diff / 0.01;
1011-
var stepLen = len / steps;
1016+
var stepLen = (steps > 0) ? len / steps : len;
1017+
1018+
// Since browsers clamp timeouts to 4ms, we need to clamp our steps to that too.
1019+
if (stepLen < 4) {
1020+
steps = Math.ceil(steps / (4 / stepLen));
1021+
stepLen = 4;
1022+
}
10121023

10131024
// If the sound hasn't loaded, add it to the load queue to fade when capable.
10141025
if (self._state !== 'loaded') {
@@ -1049,8 +1060,10 @@
10491060

10501061
var vol = from;
10511062
sound._interval = setInterval(function(soundId, sound) {
1052-
// Update the volume amount.
1053-
vol += (dir === 'in' ? 0.01 : -0.01);
1063+
// Update the volume amount, but only if the volume should change.
1064+
if (steps > 0) {
1065+
vol += (dir === 'in' ? 0.01 : -0.01);
1066+
}
10541067

10551068
// Make sure the volume is in the right bounds.
10561069
vol = Math.max(0, vol);
@@ -1147,6 +1160,10 @@
11471160
sound._loop = loop;
11481161
if (self._webAudio && sound._node && sound._node.bufferSource) {
11491162
sound._node.bufferSource.loop = loop;
1163+
if (loop) {
1164+
sound._node.bufferSource.loopStart = sound._start || 0;
1165+
sound._node.bufferSource.loopEnd = sound._stop;
1166+
}
11501167
}
11511168
}
11521169
}
@@ -1439,6 +1456,9 @@
14391456
delete cache[self._src];
14401457
}
14411458

1459+
// Clear global errors.
1460+
Howler.noAudio = false;
1461+
14421462
// Clear out `self`.
14431463
self._state = 'unloaded';
14441464
self._sounds = [];
@@ -1900,10 +1920,6 @@
19001920
_errorListener: function() {
19011921
var self = this;
19021922

1903-
if (self._node.error && self._node.error.code === 4) {
1904-
Howler.noAudio = true;
1905-
}
1906-
19071923
// Fire an error event and pass back the code.
19081924
self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0);
19091925

@@ -2162,7 +2178,7 @@
21622178
/*!
21632179
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
21642180
*
2165-
* howler.js v2.0.0
2181+
* howler.js v2.0.1
21662182
* howlerjs.com
21672183
*
21682184
* (c) 2013-2016, James Simpson of GoldFire Studios

dist/howler.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/howler.spatial.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"uglify-js": "2.x"
2929
},
3030
"main": "dist/howler.js",
31-
"version": "2.0.0",
31+
"version": "2.0.1",
3232
"license": {
3333
"type": "MIT",
3434
"url": "https://raw.githubusercontent.com/goldfire/howler.js/master/LICENSE.md"

src/howler.core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* howler.js v2.0.0
2+
* howler.js v2.0.1
33
* howlerjs.com
44
*
55
* (c) 2013-2016, James Simpson of GoldFire Studios

src/plugins/howler.spatial.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
33
*
4-
* howler.js v2.0.0
4+
* howler.js v2.0.1
55
* howlerjs.com
66
*
77
* (c) 2013-2016, James Simpson of GoldFire Studios

0 commit comments

Comments
 (0)