Skip to content

Commit d6622ba

Browse files
author
OJay Robinson
committed
deprecate HTMLAudioPlugin defaultNumChannels and cleaned up associated code
1 parent ce40ad2 commit d6622ba

9 files changed

+29
-33
lines changed

VERSIONS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CRITICAL (may break existing content):
1313
- added muted and volume properties to Sound, and deprecated get/setMute and get/setVolume
1414
- added capabilities property to Sound, and deprecated getCapabilities and getCapability
1515
- refactor HTMLAudioTagPool as Chrome no longer requires tags be pre-created
16+
- deprecate HTMLAudioPlugin defaultNumChannels and cleaned up associated code
1617

1718
Version 0.6.0 [December 12, 2014]
1819
************************************************************************************************************************

docs/soundjs_docs-NEXT.zip

-772 Bytes
Binary file not shown.

lib/flashaudioplugin-NEXT.combined.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,6 @@ this.createjs = this.createjs || {};
16011601
* @type String
16021602
* @static
16031603
**/
1604-
s.buildDate = /*=date*/"Tue, 24 Feb 2015 23:16:21 GMT"; // injected by build process
1604+
s.buildDate = /*=date*/"Wed, 25 Feb 2015 18:08:25 GMT"; // injected by build process
16051605

16061606
})();

lib/flashaudioplugin-NEXT.min.js

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

lib/soundjs-NEXT.combined.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ this.createjs = this.createjs || {};
3030
* @type String
3131
* @static
3232
**/
33-
s.buildDate = /*=date*/"Tue, 24 Feb 2015 23:16:21 GMT"; // injected by build process
33+
s.buildDate = /*=date*/"Wed, 25 Feb 2015 18:08:25 GMT"; // injected by build process
3434

3535
})();
3636

@@ -3850,7 +3850,7 @@ this.createjs = this.createjs || {};
38503850
loadItem.type = "sound";
38513851

38523852
var data = loadItem.data;
3853-
var numChannels = s.activePlugin.defaultNumChannels || null;
3853+
var numChannels = null;
38543854
if (data != null) {
38553855
if (!isNaN(data.channels)) {
38563856
numChannels = parseInt(data.channels);
@@ -3867,7 +3867,7 @@ this.createjs = this.createjs || {};
38673867
}
38683868
}
38693869
if (loadItem.id != null) {s._idHash[loadItem.id] = {src: loadItem.src}};
3870-
var loader = s.activePlugin.register(loadItem, numChannels); // Note only HTML audio uses numChannels
3870+
var loader = s.activePlugin.register(loadItem);
38713871

38723872
SoundChannel.create(loadItem.src, numChannels);
38733873

@@ -5780,11 +5780,10 @@ this.createjs = this.createjs || {};
57805780
* can use to assist with preloading.
57815781
* @method register
57825782
* @param {String} loadItem An Object containing the source of the audio
5783-
* @param {Number} instances The number of concurrently playing instances to allow for the channel at any time.
57845783
* Note that not every plugin will manage this value.
57855784
* @return {Object} A result object, containing a "tag" for preloading purposes.
57865785
*/
5787-
p.register = function (loadItem, instances) {
5786+
p.register = function (loadItem) {
57885787
var loader = this._loaders[loadItem.src];
57895788
if(loader && !loader.canceled) {return this._loaders[loadItem.src];} // already loading/loaded this, so don't load twice
57905789
// OJR potential issue that we won't be firing loaded event, might need to trigger if this is already loaded?
@@ -6693,6 +6692,7 @@ this.createjs = this.createjs || {};
66936692
* A hash lookup of if a base audio tag is available, indexed by the audio source
66946693
* @property _tagsUsed
66956694
* @type {{}}
6695+
* @protected
66966696
* @static
66976697
*/
66986698
s._tagUsed = {};
@@ -7105,9 +7105,8 @@ this.createjs = this.createjs || {};
71057105
* <h4>Known Browser and OS issues for HTML Audio</h4>
71067106
* <b>All browsers</b><br />
71077107
* Testing has shown in all browsers there is a limit to how many audio tag instances you are allowed. If you exceed
7108-
* this limit, you can expect to see unpredictable results. This will be seen as soon as you register sounds, as
7109-
* tags are precreated to allow Chrome to load them. Please use {{#crossLink "Sound.MAX_INSTANCES"}}{{/crossLink}} as
7110-
* a guide to how many total audio tags you can safely use in all browsers.
7108+
* this limit, you can expect to see unpredictable results. Please use {{#crossLink "Sound.MAX_INSTANCES"}}{{/crossLink}} as
7109+
* a guide to how many total audio tags you can safely use in all browsers. This issue is primarily limited to IE9.
71117110
*
71127111
* <b>IE html limitations</b><br />
71137112
* <ul><li>There is a delay in applying volume changes to tags that occurs once playback is started. So if you have
@@ -7116,7 +7115,7 @@ this.createjs = this.createjs || {};
71167115
* <li>MP3 encoding will not always work for audio tags if it's not default. We've found default encoding with
71177116
* 64kbps works.</li>
71187117
* <li>Occasionally very short samples will get cut off.</li>
7119-
* <li>There is a limit to how many audio tags you can load and play at once, which appears to be determined by
7118+
* <li>There is a limit to how many audio tags you can load or play at once, which appears to be determined by
71207119
* hardware and browser settings. See {{#crossLink "HTMLAudioPlugin.MAX_INSTANCES"}}{{/crossLink}} for a safe estimate.
71217120
* Note that audio sprites can be used as a solution to this issue.</li></ul>
71227121
*
@@ -7154,15 +7153,14 @@ this.createjs = this.createjs || {};
71547153

71557154
// Public Properties
71567155
/**
7157-
* The default number of instances to allow. Used by {{#crossLink "Sound"}}{{/crossLink}} when a source
7158-
* is registered using the {{#crossLink "Sound/register"}}{{/crossLink}} method. This is only used if
7159-
* a value is not provided.
7156+
* This is no longer needed as we are now using object pooling for tags.
71607157
*
71617158
* <b>NOTE this property only exists as a limitation of HTML audio.</b>
71627159
* @property defaultNumChannels
71637160
* @type {Number}
71647161
* @default 2
71657162
* @since 0.4.0
7163+
* @deprecated
71667164
*/
71677165
this.defaultNumChannels = 2;
71687166

@@ -7181,7 +7179,7 @@ this.createjs = this.createjs || {};
71817179

71827180
// Static Properties
71837181
/**
7184-
* The maximum number of instances that can be loaded and played. This is a browser limitation, primarily limited to IE9.
7182+
* The maximum number of instances that can be loaded or played. This is a browser limitation, primarily limited to IE9.
71857183
* The actual number varies from browser to browser (and is largely hardware dependant), but this is a safe estimate.
71867184
* Audio sprites work around this limitation.
71877185
* @property MAX_INSTANCES
@@ -7298,9 +7296,9 @@ this.createjs = this.createjs || {};
72987296

72997297

73007298
// public methods
7301-
p.register = function (loadItem, instances) {
7299+
p.register = function (loadItem) {
73027300
var tag = createjs.HTMLAudioTagPool.get(loadItem.src);
7303-
var loader = this.AbstractPlugin_register(loadItem, instances);
7301+
var loader = this.AbstractPlugin_register(loadItem);
73047302
loader.setTag(tag);
73057303

73067304
return loader;

lib/soundjs-NEXT.min.js

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

src/soundjs/AbstractPlugin.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ this.createjs = this.createjs || {};
141141
* can use to assist with preloading.
142142
* @method register
143143
* @param {String} loadItem An Object containing the source of the audio
144-
* @param {Number} instances The number of concurrently playing instances to allow for the channel at any time.
145144
* Note that not every plugin will manage this value.
146145
* @return {Object} A result object, containing a "tag" for preloading purposes.
147146
*/
148-
p.register = function (loadItem, instances) {
147+
p.register = function (loadItem) {
149148
var loader = this._loaders[loadItem.src];
150149
if(loader && !loader.canceled) {return this._loaders[loadItem.src];} // already loading/loaded this, so don't load twice
151150
// OJR potential issue that we won't be firing loaded event, might need to trigger if this is already loaded?

src/soundjs/Sound.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ this.createjs = this.createjs || {};
813813
loadItem.type = "sound";
814814

815815
var data = loadItem.data;
816-
var numChannels = s.activePlugin.defaultNumChannels || null;
816+
var numChannels = null;
817817
if (data != null) {
818818
if (!isNaN(data.channels)) {
819819
numChannels = parseInt(data.channels);
@@ -830,7 +830,7 @@ this.createjs = this.createjs || {};
830830
}
831831
}
832832
if (loadItem.id != null) {s._idHash[loadItem.id] = {src: loadItem.src}};
833-
var loader = s.activePlugin.register(loadItem, numChannels); // Note only HTML audio uses numChannels
833+
var loader = s.activePlugin.register(loadItem);
834834

835835
SoundChannel.create(loadItem.src, numChannels);
836836

src/soundjs/htmlaudio/HTMLAudioPlugin.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ this.createjs = this.createjs || {};
4646
* <h4>Known Browser and OS issues for HTML Audio</h4>
4747
* <b>All browsers</b><br />
4848
* Testing has shown in all browsers there is a limit to how many audio tag instances you are allowed. If you exceed
49-
* this limit, you can expect to see unpredictable results. This will be seen as soon as you register sounds, as
50-
* tags are precreated to allow Chrome to load them. Please use {{#crossLink "Sound.MAX_INSTANCES"}}{{/crossLink}} as
51-
* a guide to how many total audio tags you can safely use in all browsers.
49+
* this limit, you can expect to see unpredictable results. Please use {{#crossLink "Sound.MAX_INSTANCES"}}{{/crossLink}} as
50+
* a guide to how many total audio tags you can safely use in all browsers. This issue is primarily limited to IE9.
5251
*
5352
* <b>IE html limitations</b><br />
5453
* <ul><li>There is a delay in applying volume changes to tags that occurs once playback is started. So if you have
@@ -57,7 +56,7 @@ this.createjs = this.createjs || {};
5756
* <li>MP3 encoding will not always work for audio tags if it's not default. We've found default encoding with
5857
* 64kbps works.</li>
5958
* <li>Occasionally very short samples will get cut off.</li>
60-
* <li>There is a limit to how many audio tags you can load and play at once, which appears to be determined by
59+
* <li>There is a limit to how many audio tags you can load or play at once, which appears to be determined by
6160
* hardware and browser settings. See {{#crossLink "HTMLAudioPlugin.MAX_INSTANCES"}}{{/crossLink}} for a safe estimate.
6261
* Note that audio sprites can be used as a solution to this issue.</li></ul>
6362
*
@@ -95,15 +94,14 @@ this.createjs = this.createjs || {};
9594

9695
// Public Properties
9796
/**
98-
* The default number of instances to allow. Used by {{#crossLink "Sound"}}{{/crossLink}} when a source
99-
* is registered using the {{#crossLink "Sound/register"}}{{/crossLink}} method. This is only used if
100-
* a value is not provided.
97+
* This is no longer needed as we are now using object pooling for tags.
10198
*
10299
* <b>NOTE this property only exists as a limitation of HTML audio.</b>
103100
* @property defaultNumChannels
104101
* @type {Number}
105102
* @default 2
106103
* @since 0.4.0
104+
* @deprecated
107105
*/
108106
this.defaultNumChannels = 2;
109107

@@ -122,7 +120,7 @@ this.createjs = this.createjs || {};
122120

123121
// Static Properties
124122
/**
125-
* The maximum number of instances that can be loaded and played. This is a browser limitation, primarily limited to IE9.
123+
* The maximum number of instances that can be loaded or played. This is a browser limitation, primarily limited to IE9.
126124
* The actual number varies from browser to browser (and is largely hardware dependant), but this is a safe estimate.
127125
* Audio sprites work around this limitation.
128126
* @property MAX_INSTANCES
@@ -239,9 +237,9 @@ this.createjs = this.createjs || {};
239237

240238

241239
// public methods
242-
p.register = function (loadItem, instances) {
240+
p.register = function (loadItem) {
243241
var tag = createjs.HTMLAudioTagPool.get(loadItem.src);
244-
var loader = this.AbstractPlugin_register(loadItem, instances);
242+
var loader = this.AbstractPlugin_register(loadItem);
245243
loader.setTag(tag);
246244

247245
return loader;

0 commit comments

Comments
 (0)