Commit graph

68 commits

Author SHA1 Message Date
photonstorm
988290631f When setting a global volume for the SoundManager it would previously incorrectly calculate the volumes of AudioTag based Sound objects that were not played at volume 1. The new approach uses Sound.updateGlobalVolume which adjusts the Sound volume to be a percentage of the global volume. So if the global volume is 0.5 and the Sound volume is 0.5, the Sound will play with an actual volume of 0.25 (thanks @VitaZheltyakov #2325) 2016-04-06 01:19:32 +01:00
Richard Davey
71056ccb69 Merge pull request #2371 from stoneman1/dev
Fixed video for future
2016-04-06 01:08:22 +01:00
photonstorm
f40cfbe2ae 2015 - 2016. 2016-04-04 22:16:16 +01:00
Stoneman1
4a29d5102d Fixes issue #2325 2016-03-02 11:57:41 +02:00
photonstorm
15d952171c SoundManager.destroy doesn't close the context if it's being stored in PhaserGlobal (thanks @brianbunch #2356) 2016-02-26 13:31:45 +00:00
photonstorm
cc3a07bada SoundManager.close now validates that context.close is a valid function before calling it (thanks @brianbunch #2355) 2016-02-26 13:29:35 +00:00
Stoneman1
62f0a52544 Fixed issue with IE crashing on this.context.close() in SoundManager.js (There was no check if context exists) 2016-02-24 13:08:37 +02:00
Richard Davey
332fb6fe68 Fixed window global check. 2016-02-09 11:41:24 +00:00
Richard Davey
0610ddd15f SoundManager.setTouchLock is no longer set if SoundManager.noAudio is true, or if the PhaserGlobal setting disableAudio is true (thanks @bcjordan #2206) 2016-02-03 23:23:36 +00:00
Richard Davey
e7820dbe85 SoundManager.destroy now calls AudioContext.close (thanks @stoneman1 #2237) 2016-02-02 01:08:35 +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
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
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
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
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +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
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
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
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
photonstorm
96fd0ade74 JSDoc fixes. 2014-10-21 22:43:42 +01:00
Richard Davey
01fd3df434 AudioSprite support is now built into the Loader and SoundManager. AudioSprites are like sprite sheets, only they consist of a selection of audio files and markers in a json configuration. You can find more details at https://github.com/tonistiigi/audiosprite (thanks @codevinsky #1205)
Fixed AudioSprite jsdoc, casing and formatting issues.
2014-09-23 22:15:09 +01:00
Jeremy Dowell
7cce1366f2 jshint cleanup 2014-09-23 10:25:49 -05:00
Jeremy Dowell
dd0d1729ad Phaser.AudioSprite
AudioSprite implementation for phaser.

Loads audio sprites based on the file format created with: https://github.com/tonistiigi/audiosprite
2014-09-23 10:21:29 -05:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
photonstorm
26a55bd202 SoundManager.destroy is a new method that will destroy all current sounds and reset any callbacks.
StateManager.clearCurrentState now handles the process of clearing down the current state and is now called if the Game is destroyed.
Game.destroy now clears the current state, activating its shutdown callback if it had one. It also now destroys the SoundManager, stopping any currently running sounds (#1092)
2014-08-29 11:37:47 +01:00
photonstorm
eee1183a6a Forces use of a Canvas Renderer under CocoonJS automatically.
The SoundManager no longer requires a touch to unlock it, defaults to unlocked.
2014-05-29 23:17:18 +01:00
photonstorm
fd9d454bc6 Documentation updates. 2014-05-01 02:38:12 +01:00
photonstorm
add6b3966c jshint fix 2014-04-28 21:22:11 +01:00
photonstorm
a5cbd8f2a6 Fixed an issue where Sounds that had been paused via game code would un-mute if the game paused and resumed. 2014-04-28 20:30:47 +01:00
photonstorm
838027a93b Timer.timeCap is a new setting allowing your Timers to protect against unexpectedly large delta timers. 2014-04-28 13:22:29 +01:00
photonstorm
de17263472 jshint fix 2014-04-01 20:57:52 +01:00
photonstorm
4d06298e64 Fixed silly SoundManager bug :) 2014-04-01 19:51:48 +01:00
photonstorm
03b80887f2 SoundManager.removeByKey(key) will remove all sounds from the SoundManager that have a key matching the given value. 2014-04-01 03:42:30 +01:00
photonstorm
3728f25d68 SoundManager.remove(sound) now lets you remove a sound from the SoundManager, destroying it in the process.
Sound.destroy will remove a sound and all local references it holds, optionally removing itself from the SoundManager as well.
2014-04-01 03:38:13 +01:00
photonstorm
3f8911d95f SoundManager.boot will check to see if the AudioContext was created before carrying on (thanks @keyle, fix #669) 2014-03-31 11:22:44 +01:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
d0fa50f014 Fixed issue stopping SoundManager.volume from working correctly on a global volume basis (fix # 488) 2014-02-26 14:40:55 +00:00
photonstorm
cc06a62b90 Pausing the game will now mute audio and resuming will un-mute, unless it was muted via the game (fixes #439) 2014-02-25 03:12:12 +00:00
photonstorm
ea4873e286 SoundManager.play() does not do anything with destroyOnComplete (fix #333) 2014-02-21 23:55:11 +00:00