@quenty/sounds 3.5.1-canary.238.2c4d310.0 → 3.5.2-canary.241.f6a9a6a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [3.5.1-canary.238.2c4d310.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.5.0...@quenty/sounds@3.5.1-canary.238.2c4d310.0) (2021-12-29)
6
+ ## [3.5.2-canary.241.f6a9a6a.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.5.1...@quenty/sounds@3.5.2-canary.241.f6a9a6a.0) (2022-01-03)
7
+
8
+ **Note:** Version bump only for package @quenty/sounds
9
+
10
+
11
+
12
+
13
+
14
+ ## [3.5.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.5.0...@quenty/sounds@3.5.1) (2021-12-30)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/sounds
9
17
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ## SoundPromiseUtils
2
2
  <div align="center">
3
3
  <a href="http://quenty.github.io/NevermoreEngine/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
7
  <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
@@ -13,15 +13,9 @@
13
13
 
14
14
  Utility functions involving sounds and their state
15
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/SoundUtils">View docs →</a></div>
17
+
16
18
  ## Installation
17
19
  ```
18
20
  npm install @quenty/soundpromiseutils --save
19
- ```
20
-
21
- ## Usage
22
- Usage is designed to be simple.
23
-
24
- ### `SoundPromiseUtils.promiseLoaded(sound)`
25
-
26
- ### `SoundPromiseUtils.promiseAllSoundsLoaded(sounds)`
27
-
21
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/sounds",
3
- "version": "3.5.1-canary.238.2c4d310.0",
3
+ "version": "3.5.2-canary.241.f6a9a6a.0",
4
4
  "description": "Utility functions involving sounds and their state",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,11 +26,11 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/loader": "3.1.2-canary.238.2c4d310.0",
30
- "@quenty/promise": "3.3.1-canary.238.2c4d310.0"
29
+ "@quenty/loader": "3.1.3-canary.241.f6a9a6a.0",
30
+ "@quenty/promise": "3.3.2-canary.241.f6a9a6a.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "2c4d310b84afd0570d89667dc5d4aa69a0ef304a"
35
+ "gitHead": "f6a9a6aa7c5f61f5a686faf305359828d8912fc0"
36
36
  }
@@ -10,6 +10,11 @@ local PromiseUtils = require("PromiseUtils")
10
10
 
11
11
  local SoundPromiseUtils = {}
12
12
 
13
+ --[=[
14
+ Promises that a sound is loaded
15
+ @param sound Sound
16
+ @return Promise
17
+ ]=]
13
18
  function SoundPromiseUtils.promiseLoaded(sound)
14
19
  if sound.IsLoaded then
15
20
  return Promise.resolved()
@@ -32,6 +37,11 @@ function SoundPromiseUtils.promiseLoaded(sound)
32
37
  return promise
33
38
  end
34
39
 
40
+ --[=[
41
+ Promises that all sounds are loaded
42
+ @param sounds { Sound }
43
+ @return Promise
44
+ ]=]
35
45
  function SoundPromiseUtils.promiseAllSoundsLoaded(sounds)
36
46
  local promises = {}
37
47
  for _, sound in pairs(sounds) do
@@ -1,5 +1,10 @@
1
1
  --[=[
2
- Helps play sounds on the client
2
+ Helps plays back sounds in the Roblox engine.
3
+
4
+ ```lua
5
+ SoundUtils.playFromId("rbxassetid://4255432837") -- Plays a wooshing sound
6
+ ```
7
+
3
8
  @class SoundUtils
4
9
  ]=]
5
10
 
@@ -7,6 +12,17 @@ local SoundService = game:GetService("SoundService")
7
12
 
8
13
  local SoundUtils = {}
9
14
 
15
+ --[=[
16
+ Plays back a template given the templateName.
17
+
18
+ :::tip
19
+ The sound will be automatically cleaned up after the sound is played.
20
+ :::
21
+
22
+ @param templates TemplateProvider
23
+ @param templateName string
24
+ @return Sound
25
+ ]=]
10
26
  function SoundUtils.playTemplate(templates, templateName)
11
27
  assert(type(templates) == "table", "Bad templates")
12
28
  assert(type(templateName) == "string", "Bad templateName")
@@ -23,6 +39,20 @@ function SoundUtils.playTemplate(templates, templateName)
23
39
  return sound
24
40
  end
25
41
 
42
+ --[=[
43
+ Plays back a template given asset id.
44
+
45
+ ```lua
46
+ SoundUtils.playFromId("rbxassetid://4255432837") -- Plays a wooshing sound
47
+ ```
48
+
49
+ :::tip
50
+ The sound will be automatically cleaned up after the sound is played.
51
+ :::
52
+
53
+ @param id string | number
54
+ @return Sound
55
+ ]=]
26
56
  function SoundUtils.playFromId(id)
27
57
  local soundId = SoundUtils.toRbxAssetId(id)
28
58
  assert(type(soundId) == "string", "Bad id")
@@ -42,6 +72,11 @@ function SoundUtils.playFromId(id)
42
72
  return sound
43
73
  end
44
74
 
75
+ --[=[
76
+ Converts a string or number to a string for playback.
77
+ @param id string | number
78
+ @return string
79
+ ]=]
45
80
  function SoundUtils.toRbxAssetId(id)
46
81
  if type(id) == "number" then
47
82
  return ("rbxassetid://%d"):format(id)
@@ -50,6 +85,18 @@ function SoundUtils.toRbxAssetId(id)
50
85
  end
51
86
  end
52
87
 
88
+ --[=[
89
+ Plays back a sound template in a specific parent.
90
+
91
+ :::tip
92
+ The sound will be automatically cleaned up after the sound is played.
93
+ :::
94
+
95
+ @param templates TemplateProvider
96
+ @param templateName string
97
+ @param parent Instance
98
+ @return Sound
99
+ ]=]
53
100
  function SoundUtils.playTemplateInParent(templates, templateName, parent)
54
101
  local sound = templates:Clone(templateName)
55
102
  sound.Archivable = false
@@ -64,5 +111,4 @@ function SoundUtils.playTemplateInParent(templates, templateName, parent)
64
111
  return sound
65
112
  end
66
113
 
67
-
68
114
  return SoundUtils