@quenty/sounds 3.7.1 → 3.7.2-canary.247.1597949.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 +9 -1
- package/package.json +4 -4
- package/src/Shared/SoundUtils.lua +20 -20
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.7.
|
|
6
|
+
## [3.7.2-canary.247.1597949.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.7.1...@quenty/sounds@3.7.2-canary.247.1597949.0) (2022-01-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/sounds
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.7.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.7.0...@quenty/sounds@3.7.1) (2022-01-16)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/sounds
|
|
9
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/sounds",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2-canary.247.1597949.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": "
|
|
30
|
-
"@quenty/promise": "
|
|
29
|
+
"@quenty/loader": "3.3.1-canary.247.1597949.0",
|
|
30
|
+
"@quenty/promise": "3.5.2-canary.247.1597949.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "159794913fb32aedaf48d2a2d7808d50449f4c01"
|
|
36
36
|
}
|
|
@@ -13,21 +13,27 @@ local SoundService = game:GetService("SoundService")
|
|
|
13
13
|
local SoundUtils = {}
|
|
14
14
|
|
|
15
15
|
--[=[
|
|
16
|
-
Plays back a template given
|
|
16
|
+
Plays back a template given asset id.
|
|
17
|
+
|
|
18
|
+
```lua
|
|
19
|
+
SoundUtils.playFromId("rbxassetid://4255432837") -- Plays a wooshing sound
|
|
20
|
+
```
|
|
17
21
|
|
|
18
22
|
:::tip
|
|
19
23
|
The sound will be automatically cleaned up after the sound is played.
|
|
20
24
|
:::
|
|
21
25
|
|
|
22
|
-
@param
|
|
23
|
-
@param templateName string
|
|
26
|
+
@param id string | number
|
|
24
27
|
@return Sound
|
|
25
28
|
]=]
|
|
26
|
-
function SoundUtils.
|
|
27
|
-
|
|
28
|
-
assert(type(
|
|
29
|
+
function SoundUtils.playFromId(id)
|
|
30
|
+
local soundId = SoundUtils.toRbxAssetId(id)
|
|
31
|
+
assert(type(soundId) == "string", "Bad id")
|
|
29
32
|
|
|
30
|
-
local sound =
|
|
33
|
+
local sound = Instance.new("Sound")
|
|
34
|
+
sound.Name = ("Sound_%s"):format(soundId)
|
|
35
|
+
sound.SoundId = soundId
|
|
36
|
+
sound.Volume = 0.25
|
|
31
37
|
sound.Archivable = false
|
|
32
38
|
|
|
33
39
|
SoundService:PlayLocalSound(sound)
|
|
@@ -40,27 +46,21 @@ function SoundUtils.playTemplate(templates, templateName)
|
|
|
40
46
|
end
|
|
41
47
|
|
|
42
48
|
--[=[
|
|
43
|
-
Plays back a template given
|
|
44
|
-
|
|
45
|
-
```lua
|
|
46
|
-
SoundUtils.playFromId("rbxassetid://4255432837") -- Plays a wooshing sound
|
|
47
|
-
```
|
|
49
|
+
Plays back a template given the templateName.
|
|
48
50
|
|
|
49
51
|
:::tip
|
|
50
52
|
The sound will be automatically cleaned up after the sound is played.
|
|
51
53
|
:::
|
|
52
54
|
|
|
53
|
-
@param
|
|
55
|
+
@param templates TemplateProvider
|
|
56
|
+
@param templateName string
|
|
54
57
|
@return Sound
|
|
55
58
|
]=]
|
|
56
|
-
function SoundUtils.
|
|
57
|
-
|
|
58
|
-
assert(type(
|
|
59
|
+
function SoundUtils.playTemplate(templates, templateName)
|
|
60
|
+
assert(type(templates) == "table", "Bad templates")
|
|
61
|
+
assert(type(templateName) == "string", "Bad templateName")
|
|
59
62
|
|
|
60
|
-
local sound =
|
|
61
|
-
sound.Name = ("Sound_%s"):format(soundId)
|
|
62
|
-
sound.SoundId = soundId
|
|
63
|
-
sound.Volume = 0.25
|
|
63
|
+
local sound = templates:Clone(templateName)
|
|
64
64
|
sound.Archivable = false
|
|
65
65
|
|
|
66
66
|
SoundService:PlayLocalSound(sound)
|