Commit bcdeaad
committed
Add an ability to preload a sound file without decoding
PR #2006 made the preloaded sounds be decoded right away,
bringing back old memory consumption issues from before #431.
For games that want to download all their assets during
the loading screen, but don't want to actually decode all sounds
right away because of memory consumption concerns, being able to
dynamically load/unload Howler objects via events is not enough,
as the application may already go out-of-memory during loading,
and not doing that will cause the game to download additional
assets during gameplay. This change adds a new property,
"preloadInCache", which makes GDJS request the sound asset via XHR.
This puts the file into browser cache, so it can be reasonably
expected to be decoded later without issuing network requests.
While at it, add user visible descriptions for all preload options.1 parent 70226f4 commit bcdeaad
File tree
4 files changed
+52
-15
lines changed- Core/GDCore/Project
- GDJS/Runtime
- howler-sound-manager
- types
4 files changed
+52
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
| |||
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
| 208 | + | |
| 209 | + | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
266 | 276 | | |
267 | 277 | | |
268 | 278 | | |
269 | 279 | | |
| 280 | + | |
270 | 281 | | |
271 | 282 | | |
272 | 283 | | |
| |||
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
814 | 810 | | |
815 | | - | |
| 811 | + | |
| 812 | + | |
816 | 813 | | |
| 814 | + | |
| 815 | + | |
817 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
818 | 821 | | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
823 | 840 | | |
824 | 841 | | |
825 | 842 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
| |||
0 commit comments