Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfire committed Oct 14, 2016
1 parent 879d206 commit cdcb68f
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 21 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 2.0.1 (October 14, 2016)
- `ADDED` Support for FLAC audio files.
- `FIXED` Improve fading performance when short fade times are used ([#621](https://github.com/goldfire/howler.js/issues/621)).
- `FIXED` Correctly handle fades from 0 to 0 volume ([#575](https://github.com/goldfire/howler.js/issues/575)).
- `FIXED` Prevent a load error from blocking all future playback ([#613](https://github.com/goldfire/howler.js/issues/613)).
- `FIXED` Reset `noAudio` to `false` when a sound is unloaded ([#617](https://github.com/goldfire/howler.js/pull/617)).
- `FIXED` Stop a sound even if it is not playing ([#595](https://github.com/goldfire/howler.js/issues/595)).
- `FIXED` Emit `stop` event before returning from `stop` ([#616](https://github.com/goldfire/howler.js/pull/616)).
- `FIXED` Improve codec checks by removing `x-` prefix ([#576](https://github.com/goldfire/howler.js/issues/576)).
- `FIXED` Set correct loop start/end when calling `loop` on a sprite ([#604](https://github.com/goldfire/howler.js/issues/604)).

## 2.0.0 (July 19, 2016)
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.

Expand Down
4 changes: 2 additions & 2 deletions dist/howler.core.min.js

Large diffs are not rendered by default.

42 changes: 29 additions & 13 deletions dist/howler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* howler.js v2.0.0
* howler.js v2.0.1
* howlerjs.com
*
* (c) 2013-2016, James Simpson of GoldFire Studios
Expand Down Expand Up @@ -170,7 +170,7 @@
* @return {Boolean}
*/
codecs: function(ext) {
return (this || Howler)._codecs[ext];
return (this || Howler)._codecs[ext.replace(/^x-/, '')];
},

/**
Expand Down Expand Up @@ -225,7 +225,8 @@
mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, '')
dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''),
flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '')
};

return self;
Expand Down Expand Up @@ -820,7 +821,7 @@
// Get the sound.
var sound = self._soundById(ids[i]);

if (sound && !sound._paused) {
if (sound) {
// Reset the seek position.
sound._seek = sound._start || 0;
sound._rateSeek = 0;
Expand All @@ -834,6 +835,10 @@
if (self._webAudio) {
// make sure the sound has been created
if (!sound._node.bufferSource) {
if (!internal) {
self._emit('stop', sound._id);
}

return self;
}

Expand Down Expand Up @@ -930,7 +935,7 @@
if (args.length === 0) {
// Return the value of the groups' volume.
return self._volume;
} else if (args.length === 1) {
} else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') {
// First check if this is an ID, and if not, assume it is a new volume.
var ids = self._getSoundIds();
var index = ids.indexOf(args[0]);
Expand Down Expand Up @@ -1008,7 +1013,13 @@
var diff = Math.abs(from - to);
var dir = from > to ? 'out' : 'in';
var steps = diff / 0.01;
var stepLen = len / steps;
var stepLen = (steps > 0) ? len / steps : len;

// Since browsers clamp timeouts to 4ms, we need to clamp our steps to that too.
if (stepLen < 4) {
steps = Math.ceil(steps / (4 / stepLen));
stepLen = 4;
}

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

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

// Make sure the volume is in the right bounds.
vol = Math.max(0, vol);
Expand Down Expand Up @@ -1147,6 +1160,10 @@
sound._loop = loop;
if (self._webAudio && sound._node && sound._node.bufferSource) {
sound._node.bufferSource.loop = loop;
if (loop) {
sound._node.bufferSource.loopStart = sound._start || 0;
sound._node.bufferSource.loopEnd = sound._stop;
}
}
}
}
Expand Down Expand Up @@ -1439,6 +1456,9 @@
delete cache[self._src];
}

// Clear global errors.
Howler.noAudio = false;

// Clear out `self`.
self._state = 'unloaded';
self._sounds = [];
Expand Down Expand Up @@ -1900,10 +1920,6 @@
_errorListener: function() {
var self = this;

if (self._node.error && self._node.error.code === 4) {
Howler.noAudio = true;
}

// Fire an error event and pass back the code.
self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0);

Expand Down Expand Up @@ -2162,7 +2178,7 @@
/*!
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
*
* howler.js v2.0.0
* howler.js v2.0.1
* howlerjs.com
*
* (c) 2013-2016, James Simpson of GoldFire Studios
Expand Down
4 changes: 2 additions & 2 deletions dist/howler.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/howler.spatial.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"uglify-js": "2.x"
},
"main": "dist/howler.js",
"version": "2.0.0",
"version": "2.0.1",
"license": {
"type": "MIT",
"url": "https://raw.githubusercontent.com/goldfire/howler.js/master/LICENSE.md"
Expand Down
2 changes: 1 addition & 1 deletion src/howler.core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* howler.js v2.0.0
* howler.js v2.0.1
* howlerjs.com
*
* (c) 2013-2016, James Simpson of GoldFire Studios
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/howler.spatial.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
*
* howler.js v2.0.0
* howler.js v2.0.1
* howlerjs.com
*
* (c) 2013-2016, James Simpson of GoldFire Studios
Expand Down

0 comments on commit cdcb68f

Please sign in to comment.