Commit graph

394 commits

Author SHA1 Message Date
Pavle Goloskokovic
1c1e75ac85 Defining rate property in BaseSound class so it can be used in both Web Audio and HTML5 Audio implementations 2017-11-27 17:35:09 +01:00
Pavle Goloskokovic
27ad50d276 Setting _detune field in BaseSound class so it can be used in both Web Audio and HTML5 Audio implementations 2017-11-27 17:34:27 +01:00
Pavle Goloskokovic
92ac9d41c5 Setting _rate field in BaseSound class so it can be used in both Web Audio and HTML5 Audio implementations 2017-11-27 17:33:37 +01:00
Pavle Goloskokovic
cf46145d7c Calling super method in setRate method of WebAudioSound class, setting returned value to source playback rate audio param and returning the same value to match method signature 2017-11-27 17:32:16 +01:00
Pavle Goloskokovic
f389176362 Added setRate method to BaseSound class that contains logic for applying rate and detune settings to sound so it can be reused in both Web Audio and HTML5 Audio implementations 2017-11-27 17:30:55 +01:00
Pavle Goloskokovic
881474b7cd Added a TODO to take into account playback rate when pausing and resuming sound 2017-11-27 16:50:45 +01:00
Pavle Goloskokovic
ffc205b400 Calling setRate method on all sound objects when updating global detune value 2017-11-27 16:50:05 +01:00
Pavle Goloskokovic
c57f692c85 Calling setRate method on all sound objects when updating global rate value 2017-11-27 16:49:28 +01:00
Pavle Goloskokovic
9fffd57ad3 Moved sound source not null check from properties' setter methods to setRate method 2017-11-27 16:48:20 +01:00
Pavle Goloskokovic
db06b3d742 Calling setRate in WebAudioSound detune property's setter method 2017-11-27 16:46:42 +01:00
Pavle Goloskokovic
074c60c270 Calling setRate in WebAudioSound rate property's setter method 2017-11-27 16:45:58 +01:00
Pavle Goloskokovic
1fddd3de2a Added setRate method to WebAudioSound class that calculates and sets playback rate based on sound's and manager's detune and rate values 2017-11-27 16:44:23 +01:00
Pavle Goloskokovic
d13fae2260 Preventing negative values for source start call 2017-11-26 18:12:55 +01:00
Pavle Goloskokovic
93ac04329b Updated WebAudioSound update method docs and signature 2017-11-26 17:25:01 +01:00
Pavle Goloskokovic
66dcd9f02f Resetting hasEnded in update method 2017-11-26 17:07:56 +01:00
Pavle Goloskokovic
0a078d26f6 Setting hasEnded when sound ends 2017-11-26 17:07:05 +01:00
Pavle Goloskokovic
f0bc96e68f Checking hasEnded on update in order to call stop method 2017-11-26 17:05:24 +01:00
Pavle Goloskokovic
84e6459b59 Added hasEnded property to WebAudioSound class 2017-11-26 17:03:36 +01:00
Pavle Goloskokovic
94e834fa96 Updating all sounds on sound manager update 2017-11-26 16:59:12 +01:00
Pavle Goloskokovic
ceeef0368c Added a todo to fix race condition 2017-11-26 16:41:46 +01:00
Pavle Goloskokovic
2995b7eaf6 Added short logic explanation for onended event handler 2017-11-26 16:37:03 +01:00
Pavle Goloskokovic
e13b829ab1 Removed redundant check in onended handler and reverted setting source to null before calling stop() on it since it does not invoke onended event handler immediately 2017-11-26 16:35:13 +01:00
Pavle Goloskokovic
007a565700 Just checking for null sound reference isn't enough since because calling play() on already playing sound is not covered by that condition 2017-11-26 16:31:06 +01:00
Pavle Goloskokovic
aab5150016 Setting source to null before calling stop on it to determine if onended event was fired when sound ended or when it was stopped by user 2017-11-26 16:28:54 +01:00
Pavle Goloskokovic
04eb680d52 Checking if source is null before stopping sound on ended handler because it is called also when stop() method is called on it 2017-11-26 16:27:39 +01:00
Pavle Goloskokovic
1808fab27e Calling stop method when sound ends 2017-11-26 16:24:49 +01:00
Pavle Goloskokovic
53dbf050d4 Marked a few methods as private 2017-11-26 16:19:56 +01:00
Pavle Goloskokovic
762c6cb147 Updated a TODO 2017-11-23 13:55:27 +01:00
Pavle Goloskokovic
266ebc4925 Taking into account marker start time on resuming sound 2017-11-23 13:55:08 +01:00
Pavle Goloskokovic
d369d46e35 Taking into account marker start time if marker is currently played 2017-11-23 13:53:57 +01:00
Pavle Goloskokovic
0ded9af3a9 Resetting current marker if no marker name is provided to play method 2017-11-23 13:52:03 +01:00
Pavle Goloskokovic
5f55931d22 Completed a TODO by setting BaseSound update method to NOOP 2017-11-23 13:19:22 +01:00
Pavle Goloskokovic
a2ceff63f1 Returning marker/null instead of boolean in removeMarker 2017-11-23 13:14:41 +01:00
Pavle Goloskokovic
b3337b6c51 Added validation for non existing marker in removeMarker method 2017-11-23 13:13:25 +01:00
Pavle Goloskokovic
c48f51de35 Setting marker to null on removeMarker call 2017-11-23 13:12:21 +01:00
Pavle Goloskokovic
9d8afee78f Added validation for non existing marker to updateMarker method 2017-11-23 12:56:32 +01:00
Pavle Goloskokovic
0e97a18553 Added validation for invalid marker name to updateMarker method 2017-11-23 12:56:06 +01:00
Pavle Goloskokovic
42735ee09f Added validation for when no marker is provided to updateMarker method 2017-11-23 12:55:22 +01:00
Pavle Goloskokovic
17d39f7bab Merging provided marker with existing marker in updateMarker method 2017-11-23 12:54:47 +01:00
Pavle Goloskokovic
8a4e439b55 Updated logging for addMarker method of BaseSound class 2017-11-23 12:52:19 +01:00
Pavle Goloskokovic
6c38853a6f Added update marker method to BaseSound class 2017-11-23 12:41:41 +01:00
Pavle Goloskokovic
76a32e20c6 Fixed return values for addMarker method 2017-11-23 12:37:10 +01:00
Pavle Goloskokovic
1e213e6d86 Added validation for existing marker 2017-11-23 12:35:55 +01:00
Pavle Goloskokovic
de5689b129 Added validation for marker name 2017-11-23 12:34:43 +01:00
Pavle Goloskokovic
2bcffe6f2f Merging provided marker with object with default values 2017-11-23 12:33:56 +01:00
Pavle Goloskokovic
40b4dc2e6e Adding validation and error handling if no marker is passed 2017-11-23 12:31:34 +01:00
Pavle Goloskokovic
084d309efb Adding market to markers array in addMarker method 2017-11-23 12:30:24 +01:00
Pavle Goloskokovic
c1b0bc4ee7 Added a TODO for scheduled playback 2017-11-22 18:07:08 +01:00
Pavle Goloskokovic
068fc6d1c9 Renamed 'marker' param of play method to 'markerName' to avoid any confusion for WebAudioSound 2017-11-22 18:06:21 +01:00
Pavle Goloskokovic
d367dc1a85 Renamed 'marker' param of play method to 'markerName' to avoid any confusion for BaseSound 2017-11-22 18:05:18 +01:00
Pavle Goloskokovic
8e912ab877 Updated currentMarker property to hold reference to marker object instead it's name 2017-11-22 18:03:44 +01:00
Pavle Goloskokovic
55e5041ef8 Setting correct duration value when calling play on BaseSound class 2017-11-22 18:00:53 +01:00
Pavle Goloskokovic
de0aefba7e Added default value for config in WebAudioSound constructor 2017-11-22 17:58:05 +01:00
Pavle Goloskokovic
9a143694d1 Using duration property instead of config duration setting in WebAudioSound 2017-11-22 17:56:55 +01:00
Pavle Goloskokovic
92abe3f678 Remove completed TODO 2017-11-22 17:54:38 +01:00
Pavle Goloskokovic
ffe4e49512 Setting duration and totalDuration properties in WebAudioSound constructor 2017-11-22 17:54:00 +01:00
Pavle Goloskokovic
90d2e8cf03 Removed setting duration setting in config for WebAudioSound 2017-11-22 17:51:10 +01:00
Pavle Goloskokovic
1296dd737d Added totalDuration property to BaseSound class 2017-11-22 17:48:10 +01:00
Pavle Goloskokovic
f932e315d6 Added duration property to BaseSound class 2017-11-22 17:47:18 +01:00
Pavle Goloskokovic
7442ab5bc8 Removed duration setting from sound config 2017-11-22 17:45:57 +01:00
Pavle Goloskokovic
cd43f0095c fixed deprecation issues with AudioParam for WebAudioSoundManager 2017-11-21 19:47:43 +01:00
Pavle Goloskokovic
1f32f04036 fixed deprecation issues with AudioParam for WebAudioSound 2017-11-21 19:47:27 +01:00
Pavle Goloskokovic
658e8c0ee6 implemented onBlur and onFocus methods for WebAudioSoundManager 2017-11-21 18:09:30 +01:00
Pavle Goloskokovic
ab9a9c951f bound onBlur and onFocus methods to corresponding game events 2017-11-21 18:06:18 +01:00
Pavle Goloskokovic
dd824c4a79 added onBlur and onFocus methods to BaseSoundManager 2017-11-21 18:04:54 +01:00
Pavle Goloskokovic
f00421f112 changed muteOnPause flag to be pauseOnBlur for BaseSoundManager 2017-11-21 18:02:24 +01:00
Pavle Goloskokovic
526df860d9 added method for unlocking audio context on mobile devices 2017-11-21 15:43:10 +01:00
Pavle Goloskokovic
cafa91005f updated description for detune setting and added a check to see if it's available, webkit implementation does not support it 2017-11-20 14:54:33 +01:00
Pavle Goloskokovic
82083897aa updated source stopping logic for WebAudioSound class 2017-11-17 18:38:23 +01:00
Pavle Goloskokovic
6897d6567b updated checks in playback control methods for BaseSound class 2017-11-17 18:37:49 +01:00
Pavle Goloskokovic
6577a232a1 adding flag to WebAudioSoundManager indicating if Web Audio implementation is webkit or standards based 2017-11-17 17:30:29 +01:00
Pavle Goloskokovic
9098b806b2 added checks to playback control methods for WebAudioSound 2017-11-17 17:17:06 +01:00
Pavle Goloskokovic
40c4b9f6e5 added checks to playback control methods for BaseSound class 2017-11-17 17:16:06 +01:00
Pavle Goloskokovic
720d2a9665 moved source buffer stopping and removing to separate method for reuse 2017-11-17 17:07:04 +01:00
Pavle Goloskokovic
a6fcb4cf53 added a couple of TODOs 2017-11-17 17:02:11 +01:00
Pavle Goloskokovic
478656df98 moved source buffer creation and starting to separate method for reuse 2017-11-17 17:01:12 +01:00
Pavle Goloskokovic
e6f17744b6 handling source buffer on method calls for WebAudioSound 2017-11-17 16:16:01 +01:00
Pavle Goloskokovic
7b90fc7f90 updating pausedTime value on method calls for WebAudioSound 2017-11-17 15:42:22 +01:00
Pavle Goloskokovic
f7f5bebd72 added pausedTime field to WebAudioSound class 2017-11-17 15:33:42 +01:00
Pavle Goloskokovic
f1a15571ff setting startTime to context current time on play for WebAudioSound 2017-11-17 15:29:49 +01:00
Pavle Goloskokovic
7f0930eec0 stopping source buffer if sound is already playing on play for WebAudioSound 2017-11-17 15:28:27 +01:00
Pavle Goloskokovic
ead02ec186 added super calls to pause and resume methods for WebAudioSound 2017-11-17 15:23:52 +01:00
Pavle Goloskokovic
d1fcc39fd3 setting playback flags to correct values on resume call for BaseSound 2017-11-17 15:18:51 +01:00
Pavle Goloskokovic
1d7d488e68 setting playback flags to correct values on pause call for BaseSound 2017-11-17 15:16:25 +01:00
Pavle Goloskokovic
c5436c7fcc setting playback flags to correct values on play call for BaseSound 2017-11-17 15:14:57 +01:00
Pavle Goloskokovic
a9692ce2dd stopping source and resetting fields on stop call for WebAudioSound 2017-11-17 15:05:17 +01:00
Pavle Goloskokovic
38a8ce378d resetting flags on stop call for BaseSound 2017-11-17 15:03:59 +01:00
Pavle Goloskokovic
0d1fb8a15e added startTime field to WebAudioSound class 2017-11-17 14:57:57 +01:00
Pavle Goloskokovic
7a4939d435 added isPaused field to BaseSound class 2017-11-17 14:51:23 +01:00
Pavle Goloskokovic
0eca17520c updated references in sound folder index.js 2017-11-17 14:18:22 +01:00
Pavle Goloskokovic
3828540ba4 moved web audio implementations into separate folder 2017-11-17 14:17:59 +01:00
Pavle Goloskokovic
f318aa7450 defined detune property on WebAudioSound prototype 2017-11-16 17:25:06 +01:00
Pavle Goloskokovic
e456ee716b defined detune property on WebAudioSoundManager prototype 2017-11-16 17:24:20 +01:00
Pavle Goloskokovic
7d7d8a7c75 added _rate field to actually hold that value to WebAudioSoundManager 2017-11-16 17:23:26 +01:00
Pavle Goloskokovic
52cbffcf2e added detune field to BaseSoundManager 2017-11-16 17:21:49 +01:00
Pavle Goloskokovic
8ede77ddce setting detune value when applying config 2017-11-16 17:21:00 +01:00
Pavle Goloskokovic
3a8c665fd6 added detune field for BaseSound class 2017-11-16 16:41:48 +01:00
Pavle Goloskokovic
a4b7eb0fe5 added duration description 2017-11-16 16:30:31 +01:00
Pavle Goloskokovic
dd17f6083f moved sounds array declaration above other properties 2017-11-16 16:04:07 +01:00
Pavle Goloskokovic
372983a7e4 defined rate property on WebAudioSoundManager prototype
and _rate field to actually hold that value
2017-11-16 15:44:56 +01:00
Pavle Goloskokovic
716a1d4652 updated field descriptions for BaseSoundManager class 2017-11-16 15:23:35 +01:00
Pavle Goloskokovic
e38adfed79 updated description for rate property for BaseSound class
setting rate value when applying config
2017-11-16 15:23:04 +01:00
Pavle Goloskokovic
15367e813d defined rate property on WebAudioSound prototype 2017-11-16 15:21:57 +01:00
Pavle Goloskokovic
e7177c5731 handling the case when only config object is passed to the play method 2017-11-16 14:54:08 +01:00
Pavle Goloskokovic
5796cd4bc8 moved setting current config reference before setting default values in BaseSound class 2017-11-16 14:29:28 +01:00
Pavle Goloskokovic
77880d1352 added missing methods to WebAudioSound class 2017-11-16 14:23:04 +01:00
Pavle Goloskokovic
872d93b788 moved validation ad marker logic from WebAudioSound class play method to BaseSound class play method 2017-11-16 14:19:04 +01:00
Pavle Goloskokovic
25bd3816c7 added applyConfig method to BaseSound class and calling it inside of WebAudioSound class play method 2017-11-16 13:32:35 +01:00
Pavle Goloskokovic
928487f7b1 setting current config value in property setters for WebAudioSound class 2017-11-16 13:09:43 +01:00
Pavle Goloskokovic
165ce9011b updated logic for using correct config when playing sound for WebAudioSound class 2017-11-15 18:12:11 +01:00
Pavle Goloskokovic
05d131236c reversed the order of mute and volume logic to make code more consistent for WebAudioSoundManager class 2017-11-15 17:49:23 +01:00
Pavle Goloskokovic
18aa1653eb reversed the order of mute and volume logic to make code more consistent for WebAudioSound class 2017-11-15 17:37:22 +01:00
Pavle Goloskokovic
0363116383 updated BaseSound fields docs
updated sound config initialization
2017-11-15 17:26:20 +01:00
Pavle Goloskokovic
f11dcf3979 added source field for WebAudioSound class 2017-11-15 16:55:13 +01:00
Pavle Goloskokovic
2d91fe2d14 defined mute property on WebAudioSound prototype 2017-11-15 16:14:04 +01:00
Pavle Goloskokovic
049dd4aada properly connect nodes for WebAudioSound class 2017-11-15 16:03:40 +01:00
Pavle Goloskokovic
9381ab0305 added muteNode field for WebAudioSound class 2017-11-15 16:02:11 +01:00
Pavle Goloskokovic
18ca26e50b defined volume property on WebAudioSound prototype
connected properly WebAudioSound nodes
2017-11-15 15:58:38 +01:00
Pavle Goloskokovic
c4f09de225 added volumeNode field for WebAudioSound class 2017-11-15 15:42:37 +01:00
Pavle Goloskokovic
6811ba56a5 defined mute property on WebAudioSoundManager prototype 2017-11-15 15:31:24 +01:00
Pavle Goloskokovic
7a3b288219 added masterMuteNode field for WebAudioSoundManager class 2017-11-15 15:20:01 +01:00
Pavle Goloskokovic
e5a5ee847f defined volume property on WebAudioSoundManager prototype 2017-11-15 15:11:37 +01:00
Pavle Goloskokovic
3820e75a5a added destination property to WebAudioSoundManager class
setting destination to be master volume node and connecting mater volume node to context destination
connecting individual sounds to manager destination node instead of context destination
2017-11-15 14:46:12 +01:00
Pavle Goloskokovic
031f40999e added masterVolumeNode to WebAudioSoundManager class 2017-11-15 14:38:45 +01:00
Pavle Goloskokovic
70a07ed793 fixed reference issue
added default value for WebAudioSound constructor config
2017-11-14 20:09:44 +01:00
Pavle Goloskokovic
2ad39a9a47 added play method to WebAudioSound class 2017-11-14 19:35:18 +01:00
Pavle Goloskokovic
57c602de7f added audio buffer property to WebAudioSound class
printing error if audio with provided key is not present in cache
updating config duration property based on audio buffer duration
2017-11-14 19:30:51 +01:00
Pavle Goloskokovic
cae01aacf1 added add method to WebAudioSoundManager class, put super constructor call at the top 2017-11-14 17:35:44 +01:00
Pavle Goloskokovic
ca1b81ae12 added sounds array initialisation 2017-11-14 17:21:58 +01:00
Pavle Goloskokovic
8bc6979c73 swapped properties initialization and base constructor call 2017-11-14 16:49:01 +01:00
Pavle Goloskokovic
98b51cea3d added WebAudioSound class 2017-11-14 16:27:22 +01:00
Pavle Goloskokovic
ced54044e9 added return value to BaseSound addMarker method 2017-11-14 16:26:52 +01:00
Pavle Goloskokovic
b5db604ae6 added BaseSound class 2017-11-14 16:00:24 +01:00
Pavle Goloskokovic
d43eb0de50 added basic methods and properties to the BaseSoundManager class 2017-11-13 19:39:32 +01:00
Pavle Goloskokovic
0fe8757054 moved create method meant for instantiating global sound manager object form BaseSoundManager class to dedicated SoundManagerCreator class
moved setting local game reference from WebAudioSoundManager class to BaseSoundManager class constructor
fixed bug with audio context creation condition in WebAudioSoundManager class
2017-11-10 19:05:26 +01:00
Pavle Goloskokovic
0b348f83ec updated conditional logic for choosing correct sound manager and audio files implementation 2017-11-10 13:36:13 +01:00
Pavle Goloskokovic
24dfdb1e54 renamed SoundManager class to BaseSoundManager 2017-11-10 13:05:29 +01:00
Pavle Goloskokovic
73aa864914 added WebAudioSoundManager class 2017-11-10 12:55:32 +01:00
Pavle Goloskokovic
2dff3dd1be added SoundManager class 2017-11-09 14:37:41 +01:00
photonstorm
f79db37cda Updated to new class structure, fixed lots of ESLint errors and moved EarCut into the geom folder and used the un-minified and latest version. 2017-07-04 14:48:18 +01:00
Richard Davey
5fff7c4c55 Removed console.log and fixed Wrap function. 2017-06-17 04:15:02 +01:00
photonstorm
8264351f75 Renamed GetObjectValue to GetValue and replaced through-out entire codebase. More consistent now with GetAdvancedValue, etc. 2017-04-26 16:03:22 +01:00
Richard Davey
7999f72d81 Moved GetObjectValue into utils/object 2017-02-04 05:39:37 +00:00
photonstorm
36825cd487 Added new Dynamic FX Generator.
Added AudioContext polyfill.
Added start of ROADMAP.
2017-01-11 04:38:15 +00:00