Explorar o código

Improved sound streaming docs (#536)

* Improved sound streaming docs

* Update .wordlist.txt
Björn Ritzl hai 4 meses
pai
achega
5ac3e964b1
Modificáronse 3 ficheiros con 488 adicións e 505 borrados
  1. 468 468
      .wordlist.txt
  2. 2 2
      docs/en/manuals/project-settings.md
  3. 18 35
      docs/en/manuals/sound-streaming.md

+ 468 - 468
.wordlist.txt

@@ -1,508 +1,508 @@
-Defold’s
-Defold's
-Git's
-Lua's
-Defold
-defolding
-colorslide
-readme
-esc
-cmd
-ctrl
-shift
-alt
-dmg
-TestFlight
-Nakama
-Colyseus
-PlayFab
-Steamworks
-GameKit
-GameAnalytics
-DevNet
-Middleware
-Ogg
-Vorbis
-FSAA
-GLFW
-glTF
-glb
-WAV
-NVDA
-PNG
-TCP
-UDP
-DNS
-SSL
-TLS
-WebSocket
-CORS
-IAM
+"ProFi"
+aab
+AABB
+ABI
+accelerometer
 ACL
-PEM
-IPv
-ZeroBrane
-ZeroBrane's
-RPG
-UHD
-NPC
-URI
-CDN
-JIT
+AConvert
+ActionScript
+adaptively
+adb
+addr
+admob
+Adoptium
+Adreno
+alt
+Andrioli
+androideabi
+AndroidManifest
+AndroidX
+AngelCode
+animationset
+anisotropic
+anisotropy
+Antialias
+antialiased
+apis
+apk
+APK's
+APKs
+apkx
+AppStore
+armeabi
 ASTC
-UASTC
-LZ
-LZ4
-GCM
-OpenType
-TrueType
-OTF
-TTF
-BMFont
-PSNR
-RMS
-WEBP
-GPU
-GPUs
-UDID
-UV
-UVs
-UI
-UIs
-GUI
-GUIs
-ABI
-STL
+async
+atomics
+autocompletion
+autoplay
+awterror
+backbuffer
+backend
 BasisU
-Cubemaps
-Adreno
-Tegra
-texel
-texels
-rgb
-rgba
-mipmap
-mipmapping
-skyboxes
+billboarding
+bitmask
+BitOp
+Björn
+blockfactory
+blocky
+BMFont
+BMFonts
+bmGlyph
+bodypart
+booleans
+breakpoint
+builtins
+bundler
+bundletool
+bytecode
+bytecode
+callout
+callstack
+CCD
+CDN
+Celtoys
+checkboxes
+checksums
+childed
+childing
+CLI
+CloudFlare
+cmd
+CocoaPods
+CodeAndWeb
+codebase
+codesign
+collada
+collectionfactory
+colorslide
+Colyseus
+Commonmark
+config
+ConfigFile
+configurability
+coroutine
+coroutines
+CORS
+CPM
+cryptographic
+cryptographically
+ctrl
 cubemap
+Cubemaps
 cubemaps
-renderer
-accelerometer
-unscaled
-flipbook
-quaternion
-quaternions
-vmath
+customizable
+customizations
+cutscene
+cutscenes
+dae
+deadzone
+debuggable
+decrypt
+DefNet
+Defold
+Defold's
+defolding
+Defold’s
+deformable
+DefSave
+deltaDNA
+desaturates
+designator
+DevNet
 dialogs
+dirs
+distributable
+dmengine
+dmg
+dmSDK
+DNS
+dotnet
+DotNet
+dropdown
+dSYM
+EDN
+EFIGS
+emscripten
+enum
+esc
+excitemike
+exe
+ffmpeg
+Fi
+filesystem
+filetype
+flatpak
+flatseal
+flipbook
+FMOD
+FMOS
+fov
+framebuffer
+framerate
+frontend
+FSAA
+Fullscreen
+FX
+GameAnalytics
+Gameboy
+GameKit
+gameobject
+gamepad
 gamepads
-lookups
-integrations
+gameplay
+GAPID
+GCM
+gdb
+gdbserver
+gdc
+getter
+Git's
 github
 gitlab
-https
-Lua
-moltenvk
 GL
+glb
+GLFW
+globals
 GLSL
-OpenGL
-OpenGLES
-vulkan
-WebGL
-WebGPU
-macOS
-OSX
-sidenote
-config
-configurability
-awterror
-scroller
-platformer
-Rodrigo
-Monteiro
-Andrioli
-Ragnar
-Svensson
-Sergey
-Lerg
-Klayton
-Kowalski
-Ierusalimschy
-Rosen
-Wolfire
-CodeAndWeb
+glTF
+glyphs
 goeshard
-solvability
-tilemap
-walkthrough
-leaderboard
-leaderboards
-excitemike
-thrusted
-playfield
-jitter
-normals
-tilesource
-collectionfactory
-apis
-init
-uncompress
-randomizer
-playtesting
-gameplay
-bodypart
-gameobject
-tilemaps
-platformers
-blockfactory
-subfolder
-spinescene
-lifecycle
-subfolder
-symbolicate
-symbolication
-callstack
-backbuffer
-framerate
-namespace
-namespaces
-shadertoy
-shaders
-shader
-builtins
-viewport
-keyframe
-keyframes
-animationset
-dae
-vroom
-slerp
-pkix
-homebrew
-xcode
-flatpak
-flatseal
-qtile
-javafx
-idfa
-sha
-nativeaot
-admob
-dotnet
-sketchup
-collada
+GPU
+GPUs
+Gradle
+Grafana
+GUI
+GUIs
 haxe
-vscode
-luajit
-emscripten
-wasm
-js
-indexeddb
-pprint
-webaudio
-khronos
-gamepad
-webpage
-zlib
-libffi
+HD
+hercule
 hidpi
-particlefx
-json
-spinejson
+Hiero
+homebrew
+HoRNDIS
+Hotspot
+https
 hxdefold
-transpiling
-transcoding
-lossy
-mipmaps
-codesign
-profiler
-filetype
-filesystem
-subfolders
-subdirectories
-radeon
-zig
-windbg
-dmSDK
-SDK
-SDKs
-NDK
-gdb
-gdbserver
-lldb
-adb
-debuggable
-dmengine
-libdmengine
-exe
-apk
-apkx
-APK's
-APKs
-aab
-androideabi
-armeabi
-addr
-AndroidX
-AndroidManifest
-mobileprovision
-AppStore
-codebase
-WebView
-WebViews
-cryptographic
-desaturates
-programmatically
+IAM
+IAP
+ico
+ICOConvert
+iconified
+idfa
+Ierusalimschy
+ImageMagick
+ImageView
+imageview
+impactful
+Incentivized
+indexeddb
+INI
+init
+initializer
+instantiation
+integrations
 intialize
-performant
-FX
-transcluded
-transclusion
-whitespace
-scriptable
-SL
-transcode
-transcoded
-transcoder
-transpiler
-transpilers
-toolset
-templating
-getter
-timestep
-dropdown
-backend
-frontend
+IPv
+IronSource
+jamesramsay
+javafx
+JIT
+jitter
+jobfolder
+js
+json
+JVM
+kerning
+keyable
+keyframe
+keyframes
+keymap
+keypress
+keypresses
+keystore
+khronos
+KiB
+Klayton
+Kowalski
+LargeXxxhdpi
+leaderboard
+leaderboards
+Lerg
+lexically
+LFS
+libdmengine
+libffi
+lifecycle
+linkers
 liveupdate
-glyphs
-templated
-Wi-Fi
-Wi
-Fi
-Pro
-profi
-ProFi
-"ProFi"
+lldb
 localhost
-Remotery
-Celtoys
-linkers
-yml
-yaml
-Winsdk
-TinyHTTP
-PSD
-Protools
-undoable
-VM
+Localizations
+lookups
+loopcount
+lossy
 LSP
-tooltip
-tooltips
-submenu
-rebundle
-booleans
-userdata
-checksums
-CLI
-Grafana
-VictoriaMetrics
-KiB
-WebAssembly
-CocoaPods
-Voxelization
-voxel
-procedurally
-deformable
-autoplay
-keystore
-vsync
-EFIGS
-EDN
+Lua
+Lua's
+Luacheck
+luaj
+luajit
+LuaSocket
+LZ
+LZ4
+macOS
+mathematic
+Mbed
+metamethods
+metatables
+Middleware
+mille
+minification
+minifying
+minimap
+mipmap
+mipmapping
+mipmaps
+mobileprovision
+mockup
+moltenvk
+Monteiro
+movieclip
+mutex
+Nakama
+namespace
+namespaces
+nativeaot
+NativeAOT
+natively
+NDK
+NES
+normals
+NPC
+NVDA
+obfuscator
+Ogg
+OpenGL
+OpenGLES
+OpenJDK
+OpenType
+OSX
+OTF
+particlefx
+PEM
+performant
+Phaser
+pixelated
+pkix
+platformer
+platformers
+PlayFab
+playfield
+playtesting
+plist
+PNG
+Poki
+PowerManager
+pprint
+pragma
 preallocate
 preallocated
-premultiply
-premultiplied
+prebaked
 prebuild
 prebuilt
-preselect
-prehash
-prebaked
-prerendered
-prepending
 preconfigured
+prehash
 preload
-preprocessor
+premultiplied
+premultiply
+prepending
 preprocessing
+preprocessor
+prerendered
+preselect
 prewarm
-reconfiguring
-checkboxes
-Sur
-NativeAOT
-DotNet
-ImageView
-imageview
-uncheck
+Pro
+procedurally
+profi
+ProFi
+profiler
 profilers
-JVM
-luaj
-impactful
-Localizations
-keymap
+programmatically
+ProGuard
+protobuf
+Protools
+PSD
+PSNR
+qtile
+quaternion
+quaternions
+radeon
+Ragnar
+randomizer
+rasterization
+rasterized
+raycast
+reactively
+readme
+rebundle
+reconfiguring
 reindent
-breakpoint
-metamethods
-metatables
+Remotery
+renderer
+Rendy
+repo
+Revolute
+rgb
+rgba
+Ritzl
+RMS
+Rodrigo
+Rosen
+RPG
+scriptable
+scroller
+SD
+SDK
+SDKs
+Sergey
+sha
+shader
+shaders
+shadertoy
+shift
+Shoebox
+Shorthands
+sidenote
+sketchup
+skyboxes
+SL
+slerp
+solvability
+Sovapps
+spawner
+spinejson
+spinescene
+SPIR
+src
+SSBOs
+SSL
 Stateful
-unloader
-PowerManager
-WakeLocks
-bundletool
-DefNet
-LuaSocket
-Revolute
-Poki
-Tilesetter
+Steamworks
+STL
+stylesheet
+stylesheets
+subdirectories
+subfolder
+subfolder
+subfolders
+submenu
+Subpixels
+Sur
+Svensson
+symbolicate
+symbolicated
+symbolication
+TCP
+Tegra
+templated
+templating
+Templatized
+TestFlight
+texel
+texels
+thrusted
+Tilegrid
+tilemap
+tilemaps
 tileset
 tilesets
+Tilesetter
+tilesource
 tilesource
 tilesources
-Shorthands
-Xbox
-mutex
-ConfigFile
-UUID
-AABB
-jobfolder
-IAP
-INI
-Fullscreen
-ico
-GAPID
-LFS
-FMOS
-childed
-childing
-async
-protobuf
-unlockable
-customizations
-Templatized
-minimap
-designator
-plist
-LargeXxxhdpi
-Subpixels
-minification
-minifying
-iconified
-dirs
-txt
-initializer
-enum
-DefSave
-FMOD
-bundler
-CloudFlare
+timestep
+TinyHTTP
+TLS
+toolset
+tooltip
+tooltips
+transcluded
+transcluder
+transclusion
+transcode
+transcoded
+transcoder
+transcoding
+transpile
+transpiler
+transpilers
+transpiling
+TrueType
+TTF
 tweening
 tweens
-cutscene
-cutscenes
-instantiation
-movieclip
-ActionScript
-CCD
-ImageMagick
-AConvert
-ICOConvert
-videoplayer
-ProGuard
-Gradle
-src
-customizable
-OpenJDK
-Adoptium
-distributable
-mockup
-HoRNDIS
-Hotspot
-keyable
-IronSource
-CPM
-Incentivized
-mille
-Vararg
-coroutine
-coroutines
-lexically
-globals
-mathematic
-BitOp
-bitmask
-bytecode
-videogame
-deadzone
-gdc
-raycast
-Gameboy
-NES
+txt
+UASTC
+UDID
+UDP
+UHD
+UI
+UIs
+uncheck
+uncompress
+undoable
+unloader
+unlockable
+unscaled
+unstripped
 upscaled
-adaptively
-HD
-SD
-stylesheet
-stylesheets
-anisotropic
-anisotropy
-billboarding
-Commonmark
-callout
-repo
-autocompletion
-Luacheck
-natively
-transpile
-cryptographically
-decrypt
-bytecode
-obfuscator
-framebuffer
-rasterized
-rasterization
-pragma
-SSBOs
-atomics
+upscaling
+URI
+userdata
+UUID
+UV
+UVs
+Vararg
 varyings
-SPIR
-Tilegrid
-spawner
-keypress
-keypresses
+VictoriaMetrics
+videogame
+videoplayer
+viewport
+VM
+vmath
+Vorbis
+voxel
+Voxelization
+vroom
+vscode
+vsync
+vulkan
+WakeLocks
+walkthrough
 WASD
-Rendy
-Björn
-Ritzl
-fov
-loopcount
-unstripped
-kerning
-antialiased
-reactively
-deltaDNA
-hercule
-jamesramsay
-transcluder
-Mbed
-blocky
-pixelated
-upscaling
-bmGlyph
-Sovapps
-Hiero
-Shoebox
-AngelCode
-Phaser
-BMFonts
-Antialias
-dSYM
+wasm
+WAV
+WebAssembly
+webaudio
+WebGL
+WebGPU
+WEBP
+webpage
+WebSocket
+WebView
+WebViews
 wget
-symbolicated
-
+whitespace
+Wi
+Wi-Fi
+windbg
+Winsdk
+Wolfire
+Xbox
+xcode
+yaml
+yml
+ZeroBrane
+ZeroBrane's
+zig
+zlib

+ 2 - 2
docs/en/manuals/project-settings.md

@@ -360,10 +360,10 @@ This number should be larger than the number of loaded sound files times the str
 Otherwise, you risk evicting new chunks each frame.
 
 #### Stream Chunk Size
-The size of each streamed chunk. `16384` bytes by default.
+The size of each streamed chunk, `16384` bytes by default.
 
 #### Stream Preload Size
-Determines the size of the initial chunk for sound files read from the archive.
+Determines the size of the initial chunk for sound files read from the archive, `16384` bytes by default.
 
 ---
 

+ 18 - 35
docs/en/manuals/sound-streaming.md

@@ -7,22 +7,19 @@ brief: This manual explains how to stream sounds into the Defold game engine
 
 While the default behaviour is to load sound data in full, it may also be beneficial to load the data in chunks, prior to their use. This is often called "streaming".
 
-One benefit is that the runtime memory is kept low.
-
-Another benefit is that, if you are streaming content from e.g. a http url, you can update the content at any time, and also avoid the initial download.
+One benefit of sound streaming is that less runtime memory is required, another is if you are streaming content from e.g. a http url, you can update the content at any time, and also avoid the initial download.
 
 ### Example
 
-There is an example project showcasing this setup: https://github.com/defold/example-sound-streaming
+There is an example project showcasing this setup: [https://github.com/defold/example-sound-streaming](https://github.com/defold/example-sound-streaming)
 
 ## How to enable streaming sounds
 
 ### Easy way
 
-The simplest way to use sound streaming, is by setting the `sound.stream_enabled` to true.
-By simply switching on this flag, your project will start streaming the sounds.
+The simplest way to use sound streaming, is by enabling the [`sound.stream_enabled` setting](https://defold.com/manuals/project-settings/#stream-enabled) in *game.project*. When this option is enabled the engine will start streaming the sounds.
 
-Note: If you have lots of sound files loaded at the same time, you may need to up the `sound.stream_cache_size` value.
+Note: If you have lots of sound files loaded at the same time, you may need to increase the `sound.stream_cache_size` value (see below).
 
 ### Runtime resources
 
@@ -31,13 +28,16 @@ You can also create a new sound data resource, and set it to a sound component.
 You do this by:
 * Load the initial part of the sound file data
     * Note: This is the raw sound file, including the ogg/wav header
-* Calling [resource.create_sound_data()](/ref/resource/#resource.create_sound_data) to get a resource
-* Setting the resource to the sound component
+* Create a new sound data resource by calling [`resource.create_sound_data()`](/ref/resource/#resource.create_sound_data).
+* Set the new sound data resource to the sound component using [`go.set()`](/ref/go#go.set)
 
 Here is an excerpt from the example project, using a `http.request()` to get the initial sound file.
-Note that the web server you're loading content from has to support ranged requests.
 
-```Lua
+::: sidenote
+The web server you're loading content from has to support [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Range_requests).
+:::
+
+```lua
 local function parse_range(s)
     local _, _, rstart, rend, size = string.find(s, "(%d+)-(%d+)/(%d+)") -- "bytes 0-16383/103277"
     return rstart, rend, size
@@ -69,36 +69,19 @@ end
 
 ## Resource providers
 
-
-You can of course use other means to load the initial chunk of the sound file.
-The important thing to remember is that the rest of the chunks are loaded from the resource system and our resource providers.
+You can of course use other means to load the initial chunk of the sound file. The important thing to remember is that the rest of the chunks are loaded from the resource system and it's resource providers.
 
 In this example, we have added a new file provider by adding a live update mount, by calling using [liveupdate.add_mount()](/ref/liveupdate/#liveupdate.add_mount).
 
 
 ## Sound chunk cache
 
-You can control how much memory will be consumed by the sounds at runtime, by setting the size of the "sound chunk cache".
-Given this limit, the loaded sound data will never exceed this limit.
-
-Some things to note:
-
-* Sound files smaller than the sound chunk size, aren't streamed.
-* If a new chunk doesn't fit into the cache, the oldest chunk is evicted
-* If the cache is too small, chunks may get evicted the same frame, and the sound won't play properly.
-
-The initial chunk of each sound file cannot be evicted, so they will occupy the cache as long as the resources are loaded.
-You can also control the size of each sound chunk. This may help you get the sound cache size down even further if you have many sound files loaded at the same time.
-
-## Configuration
-
-Currently, the streaming is enabled on all sound resources.
-We may improve upon this in the future, allowing settings on individual sound files.
+The amount of memory consumed by the sounds at runtime is controlled by the [`sound.stream_cache_size` setting](https://defold.com/manuals/project-settings/#stream-cache-size) in *game.project*. Given this limit, the loaded sound data will never exceed this limit.
 
-The game project supports these settings:
+The initial chunk of each sound file cannot be evicted and they will occupy the cache for as long as the resources are loaded. The size of the initial chunk is controlled by the [`sound.stream_preload_size` setting](https://defold.com/manuals/project-settings/#stream-preload-size) in *game.project*.
 
-* `sound.stream_enabled` (default 0) - If enabled, enables streaming of all sound files
-* `sound.stream_cache_size` (default 2097152 bytes) - The max size of the cache containing _all_ chunks.
-* `sound.stream_chunk_size` (default 16384 bytes) - Determines size of each chunk that is loaded from a file at a time
-* `sound.stream_preload_size` (default 16384 bytes) - Determines size of initial chunk read from each found file in the archive
+You can also control the size of each sound chunk by changing the [`sound.stream_chunk_size` setting](https://defold.com/manuals/project-settings/#stream-chunk-size) in *game.project*. This may help you get the sound cache size down even further if you have many sound files loaded at the same time. Sound files smaller than the sound chunk size, aren't streamed and if a new chunk doesn't fit into the cache, the oldest chunk is evicted
 
+::: important
+The total size of the sound chunk cache should be larger than the number of loaded sound files times the stream chunk size. Otherwise, you risk evicting new chunks each frame and sounds won't play properly
+:::