@quenty/sounds 3.2.2 → 3.4.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,6 +3,28 @@
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.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.3.0...@quenty/sounds@3.4.0) (2021-12-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add SoundUtils.playFromId(id) ([71b5c5b](https://github.com/Quenty/NevermoreEngine/commit/71b5c5b007fc4229b9c10adcbb20ad0c87227550))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.2.2...@quenty/sounds@3.3.0) (2021-11-20)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [3.2.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sounds@3.2.1...@quenty/sounds@3.2.2) (2021-10-30)
7
29
 
8
30
  **Note:** Version bump only for package @quenty/sounds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/sounds",
3
- "version": "3.2.2",
3
+ "version": "3.4.0",
4
4
  "description": "Utility functions involving sounds and their state",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,10 +27,10 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@quenty/loader": "^3.1.1",
30
- "@quenty/promise": "^3.1.2"
30
+ "@quenty/promise": "^3.2.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "e9cd4223c7fda7c852db9743ef844baa19cacb13"
35
+ "gitHead": "8a33939501e25cf227e96f7eb0d1a23b86f10f3c"
36
36
  }
@@ -15,13 +15,40 @@ function SoundUtils.playTemplate(templates, templateName)
15
15
 
16
16
  SoundService:PlayLocalSound(sound)
17
17
 
18
- delay(sound.TimeLength + 0.05, function()
18
+ task.delay(sound.TimeLength + 0.05, function()
19
19
  sound:Destroy()
20
20
  end)
21
21
 
22
22
  return sound
23
23
  end
24
24
 
25
+ function SoundUtils.playFromId(id)
26
+ local soundId = SoundUtils.toRbxAssetId(id)
27
+ assert(type(soundId) == "string", "Bad id")
28
+
29
+ local sound = Instance.new("Sound")
30
+ sound.Name = ("Sound_%s"):format(soundId)
31
+ sound.SoundId = soundId
32
+ sound.Volume = 0.25
33
+ sound.Archivable = false
34
+
35
+ SoundService:PlayLocalSound(sound)
36
+
37
+ task.delay(sound.TimeLength + 0.05, function()
38
+ sound:Destroy()
39
+ end)
40
+
41
+ return sound
42
+ end
43
+
44
+ function SoundUtils.toRbxAssetId(id)
45
+ if type(id) == "number" then
46
+ return ("rbxassetid://%d"):format(id)
47
+ else
48
+ return id
49
+ end
50
+ end
51
+
25
52
  function SoundUtils.playTemplateInParent(templates, templateName, parent)
26
53
  local sound = templates:Clone(templateName)
27
54
  sound.Archivable = false
@@ -29,7 +56,7 @@ function SoundUtils.playTemplateInParent(templates, templateName, parent)
29
56
 
30
57
  sound:Play()
31
58
 
32
- delay(sound.TimeLength + 0.05, function()
59
+ task.delay(sound.TimeLength + 0.05, function()
33
60
  sound:Destroy()
34
61
  end)
35
62
 
@@ -2,6 +2,6 @@
2
2
  "name": "node_modules",
3
3
  "globIgnorePaths": [ "**/.package-lock.json" ],
4
4
  "tree": {
5
- "$path": { "optional": "..\\node_modules" }
5
+ "$path": { "optional": "../node_modules" }
6
6
  }
7
7
  }