Richard Davey
425ee09047
Sound.onEndedHandler now sets Sound.currentTime to be Sound.durationMS (thanks @stoneman1 #2237 )
2016-02-02 01:08:45 +00:00
Richard Davey
e7820dbe85
SoundManager.destroy now calls AudioContext.close (thanks @stoneman1 #2237 )
2016-02-02 01:08:35 +00:00
photonstorm
172f972d8c
Pausing a Sound that used a Marker for playback would fire the onMarkerComplete
signal by mistake as well as stop the fadeTween. This Signal is now only dispatched if Sound.stop is called and the Sound isn't paused (thanks Corin)
2015-12-02 12:41:20 +00:00
photonstorm
f64fc42f3e
The SoundManager now detects if the browser is running under iOS9 and uses a touchend callback to unlock the audio subsystem. Previous versions of iOS (and Android) still use touchstart. This fixes Apple's screw-up with regard to changing the way Web Audio should be triggered in Mobile Safari. Thanks Apple (thanks @MyCatCarlos for the heads-up #2095 )
2015-09-22 11:46:58 +01:00
Pappa
12d24d3677
Fix for AudioBufferSourceNode listener memory leak.
...
In Chrome, the AudioBufferSourceNode onended listeners were never being garbage collected. This frees up the listener for collection.
2015-09-08 17:56:17 +01:00
photonstorm
a8934c392d
Phaser.Sound will now automatically check the Cache to see if the audio file it is using is still there or not. If not then it will automatically called Sound.destroy
on itself. If you do not desire this result then you should ensure that you undertake all house-keeping yourself, and properly destroy Sound objects _before_ calling Cache.removeSound
( #1946 )
2015-07-27 14:02:04 +01:00
photonstorm
f15fe6706c
All undefined argument checks were changed from if (typeof x === 'undefined')
to if (x === undefined)
removing the typeof check and saving some bytes across the codebase in the process.
2015-07-22 10:37:15 +01:00
photonstorm
8356aacaa8
Trying out new Text pivot and mute handling.
2015-06-24 19:57:40 +01:00
photonstorm
1ed33cb06c
Setting mute to false on Sound that was never muted caused its volume to be set to zero (thanks @brianbunch #1870 )
2015-06-24 15:54:25 +01:00
photonstorm
1990bce48b
Sound.restart and Sound.stop now properly disconnect the sound from the gainNode (or external node) before stopping it, allowing restart to work correctly (thanks @eofs #1796 )
2015-06-16 16:24:47 +01:00
photonstorm
ab8c98676e
Sound.resume wouldn't properly restart looped sounds in Chrome after being paused. Phaser now specifically handles the Chrome 42 bug and later fix (thanks @nkovacs #1820 )
2015-06-16 14:28:46 +01:00
photonstorm
1c1a2ac195
Volume should default to 1 if undefined OR null (as from an Audio Sprite)
2015-06-09 20:55:20 +01:00
photonstorm
621e51d949
Docs update about the lovely 48000 Hz music bug.
2015-05-23 03:37:04 +01:00
photonstorm
4cd374691a
Wrapped the decodeAudio in a try/catch.
2015-05-14 23:21:19 +01:00
photonstorm
766b110f99
SoundManager now uses the new Touch.addTouchLockCallback
methods to handle mobile device audio unlocking.
2015-05-05 16:25:16 +01:00
photonstorm
7178ff61c7
jsdoc fixes.
2015-05-05 14:00:29 +01:00
photonstorm
d98b984ad2
SoundManager.volume now has its input value clamped to ensure it's between 0 and 1 (inclusive)
2015-05-05 11:04:14 +01:00
photonstorm
36c7084e01
Adjusting property order.
2015-05-05 10:59:54 +01:00
photonstorm
adad60f8f4
SoundManager.onVolumeChange is a new signal that is dispatched whenever the global volume changes. The new volume is passed as the only parameter to your callback.
...
SoundManager.onMute is a new signal that is dispatched when the SoundManager is globally muted, either directly via game code or as a result of the game pausing.
SoundManager.onUnMute is a new signal that is dispatched when the SoundManager is globally un-muted, either directly via game code or as a result of the game resuming from a pause.
2015-05-05 10:58:43 +01:00
photonstorm
e6ab4884a6
Set usingWebAudio if using it :)
2015-04-21 02:07:47 +01:00
photonstorm
8476a0b87f
One ! too many #1746
2015-04-17 14:26:01 +01:00
photonstorm
59beae762d
The SoundManager didn't accurately detect devices or browser environments with no sound card present and would try to carry on using a null Web Audio context (thanks @englercj #1746 )
...
SoundManager.pauseAll, resumeAll and stopAll now checks if the SoundManager.noAudio is set and ignores the calls.
SoundManager.usingWebAudio is set to `false` by default (used to be `true`) and is only explicitly set if Web Audio is available and hasn't been disabled in the PhaserGlobal object.
SoundManager.touchLocked is now set to `false` should the device be using legacy Audio, avoiding the unlock call running without need.
2015-04-17 03:49:20 +01:00
photonstorm
96e313e768
If you paused a Sound object that is using audio markers and then resumed it, it wouldn't correctly calculate the resume duration - causing the sound to sometimes play into the marker that followed it (thanks @AnderbergE #1669 )
2015-03-24 14:43:35 +00:00
photonstorm
0a45223cd4
Resuming a sound needs the onended handler adding back in again.
2015-03-04 00:32:33 +00:00
photonstorm
a69e53f901
Copyright date change.
2015-02-25 03:36:23 +00:00
photonstorm
e93ded324f
Added missing class var.
2015-02-22 19:30:34 +00:00
photonstorm
ba08498e73
Fixed bug with the watch list not checking decode status by key properly.
2015-02-20 00:58:05 +00:00
photonstorm
72d1c13b6b
Fixed jshint error.
2015-02-18 14:54:19 +00:00
photonstorm
ef3cb1f31d
Sound in Web Audio now uses AudioContext.onended to trigger when it will stop playing instead of using a time based value. This is only used if the sound doesn't loop and isn't an audio sprite, but will give a much more accurate Sound.onStop
event. It also prevents short audio files from being cut off during playback ( #1471 ) and accounts for time spent decoding.
2015-02-18 11:25:17 +00:00
photonstorm
74bee324a5
Sound.fadeIn now supports fading from a marker, as well as the entire audio clip, so now works with audio sprites (thanks @vorrin #1413 )
2015-02-11 13:52:16 +00:00
photonstorm
dfee82834d
Sound.loop even when set for WebAudio wouldn't use the AudioContext loop property because Sound.start was being invoked with an offset and duration. Now if loop
is true and no marker is being used it will use the native Web Audio loop support ( #1431 )
...
SoundManager.setDecodedCallback lets you specify a list of Sound files, or keys, and a callback. Once all of the Sound files have finished decoding the callback will be invoked. The amount of time spent decoding depends on the codec used and file size. If all of the files given have already decoded the callback is triggered immediately.
Sound.loopFull is a new method that will start playback of the Sound and set it to loop in its entirety.
2015-02-11 05:17:53 +00:00
photonstorm
ac14edae94
Sound.stop and Sound.destroy now halt a fade tween if in effect.
2015-02-03 16:17:03 +00:00
photonstorm
d37ffe6a8f
Sound.fadeTween is now used for Sound.fadeIn and Sound.fadeOut audio tweens.
...
Sound.stop and Sound.destroy now halt a fade tween if in effect.
2015-01-28 17:18:32 +00:00
photonstorm
65f8820514
SoundManager.unlock checks for audio start
support and falls back to noteOn
if not found.
2015-01-06 13:50:15 +00:00
photonstorm
b22233a0bc
docs update and sound marker check.
2015-01-02 04:14:44 +00:00
photonstorm
fa40b3a7a9
Removed readyState check as it breaks overlapping sounds.
2014-12-18 11:14:45 +00:00
photonstorm
269af69da5
Added extra checks to Sound.play to stop it throwing DOM Exception Error 11 if the sound.readyState
wasn't set or the sound was invalid. Also wrapped stop()
call in a
try catch`.
2014-12-17 13:07:19 +00:00
photonstorm
d8fee414b8
Merge remote-tracking branch 'origin/dev'
2014-12-03 10:40:35 +00:00
photonstorm
40c490ce23
Phaser 2.2 Release Candidate 8 (newsletter build)
2014-11-17 14:14:50 +00:00
photonstorm
ff8a138081
jshint fix
2014-11-16 21:18:29 +00:00
photonstorm
5cd4225412
If you are reloading a Phaser Game on a page that never properly refreshes (such as in an AngularJS project) then you will quickly run out of AudioContext nodes. If this is the case create a global var called PhaserGlobal
on the window object before creating the game. The active AudioContext will then be saved to window.PhaserGlobal.audioContext
when the Phaser game is destroyed, and re-used when it starts again ( #1233 )
2014-11-16 21:05:31 +00:00
Sheepolution
266adf06d8
Removed an unnecessary if-statement.
...
Not sure if it had any purpose. Maybe to make it more clear?
Just a suggestion of something I noticed.
2014-11-10 23:28:20 +01:00
photonstorm
0a86a7ef51
Time.now can no longer be relied upon to contain a timestamp value. If the browser supports requestAnimationFrame then Time.now
will contain the high resolution timer value that rAf generates. Otherwise it will contain the value of Date.now. If you require the actual time value (in milliseconds) then please use Time.time
instead. Note that all Phaser sub-systems that used to rely on Time.now
have been updated, so if you have any code that extends these please be sure to check it.
2014-11-08 20:01:10 +00:00
photonstorm
96fd0ade74
JSDoc fixes.
2014-10-21 22:43:42 +01:00
photonstorm
2657de0daa
Sound.fadeTo allows you to fade the Sound to the given volume over the duration specified (thanks @nickryall #1225 )
2014-10-15 21:48:00 +01:00
Richard Davey
33ebc10570
Merge pull request #1225 from nickryall/dev
...
Phaser.Sound.fadeTo Method
2014-10-15 21:44:42 +01:00
Bobby Wilson
0482684dc8
changed all typeof comparisons from == to ===
2014-10-10 21:52:06 -06:00
nickryall
f5db1b070e
Phaser.Sound.fadeTo Method
2014-10-10 11:03:13 +13:00
photonstorm
506a091257
Sound.allowMultiple allows you to have multiple instances of a single Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels. But it allows for one Sound object to play overlapping times, useful for gun effects and similar ( #1220 )
2014-10-09 14:44:25 +01:00
photonstorm
9e29a58d89
Sound.fadeOut(duration) will fade the Sound to a volume of zero over the duration given. At the end of the fade the Sound will be stopped and Sound.onFadeComplete dispatched.
...
Sound.fadeIn(duration, loop) will start the Sound playing, or restart it if already playing, set its volume to zero and then increase the volume over the duration given until it reaches 1. At the end of the fade the Sound.onFadeComplete event is dispatched.
2014-09-24 06:51:39 +01:00