@quenty/soundplayer 7.0.0 → 7.1.0-canary.453.b43d54e.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,17 @@
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
+ # [7.1.0-canary.453.b43d54e.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@7.0.0...@quenty/soundplayer@7.1.0-canary.453.b43d54e.0) (2024-03-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add suport for soundplayer ([b4fc6a5](https://github.com/Quenty/NevermoreEngine/commit/b4fc6a5d7cfc49eee49f82157a434197fdf1ba51))
12
+
13
+
14
+
15
+
16
+
6
17
  # [7.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@6.0.0...@quenty/soundplayer@7.0.0) (2024-02-14)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/soundplayer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/soundplayer",
3
- "version": "7.0.0",
3
+ "version": "7.1.0-canary.453.b43d54e.0",
4
4
  "description": "Sound playback helper",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,28 +25,28 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/adorneeutils": "^3.1.0",
29
- "@quenty/baseobject": "^10.0.0",
30
- "@quenty/blend": "^12.0.0",
31
- "@quenty/brio": "^14.0.0",
32
- "@quenty/instanceutils": "^13.0.0",
33
- "@quenty/loader": "^10.0.0",
34
- "@quenty/maid": "^3.0.0",
35
- "@quenty/numberrangeutils": "^3.0.0",
36
- "@quenty/promise": "^10.0.0",
37
- "@quenty/promisemaid": "^5.0.0",
38
- "@quenty/randomutils": "^6.0.0",
39
- "@quenty/rbxasset": "^5.0.0",
40
- "@quenty/rx": "^13.0.0",
41
- "@quenty/signal": "^7.0.0",
42
- "@quenty/sounds": "^10.0.0",
43
- "@quenty/table": "^3.4.0",
44
- "@quenty/transitionmodel": "^7.0.0",
45
- "@quenty/valueobject": "^13.0.0",
28
+ "@quenty/adorneeutils": "3.1.0",
29
+ "@quenty/baseobject": "10.1.0-canary.453.b43d54e.0",
30
+ "@quenty/blend": "12.1.0-canary.453.b43d54e.0",
31
+ "@quenty/brio": "14.1.0-canary.453.b43d54e.0",
32
+ "@quenty/instanceutils": "13.1.0-canary.453.b43d54e.0",
33
+ "@quenty/loader": "10.1.0-canary.453.b43d54e.0",
34
+ "@quenty/maid": "3.1.0-canary.453.b43d54e.0",
35
+ "@quenty/numberrangeutils": "3.0.0",
36
+ "@quenty/promise": "10.1.0-canary.453.b43d54e.0",
37
+ "@quenty/promisemaid": "5.1.0-canary.453.b43d54e.0",
38
+ "@quenty/randomutils": "6.1.0-canary.453.b43d54e.0",
39
+ "@quenty/rbxasset": "5.1.0-canary.453.b43d54e.0",
40
+ "@quenty/rx": "13.1.0-canary.453.b43d54e.0",
41
+ "@quenty/signal": "7.1.0-canary.453.b43d54e.0",
42
+ "@quenty/sounds": "10.1.0-canary.453.b43d54e.0",
43
+ "@quenty/table": "3.4.0",
44
+ "@quenty/transitionmodel": "7.1.0-canary.453.b43d54e.0",
45
+ "@quenty/valueobject": "13.1.0-canary.453.b43d54e.0",
46
46
  "@quentystudios/t": "^3.0.0"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "63f949a67b77d3edc98b358cace163da8c789e9f"
51
+ "gitHead": "b43d54ea4edccf33def7e8d60c97d9dbec694379"
52
52
  }
@@ -19,20 +19,13 @@ LayeredLoopedSoundPlayer.__index = LayeredLoopedSoundPlayer
19
19
  function LayeredLoopedSoundPlayer.new(soundParent)
20
20
  local self = setmetatable(SpringTransitionModel.new(), LayeredLoopedSoundPlayer)
21
21
 
22
- self._soundParent = ValueObject.new(nil)
23
- self._maid:GiveTask(self._soundParent)
22
+ self._layerMaid = self._maid:Add(Maid.new())
24
23
 
25
- self._bpm = ValueObject.new(nil)
26
- self._maid:GiveTask(self._bpm)
27
-
28
- self._defaultCrossFadeTime = ValueObject.new(0.5, "number")
29
- self._maid:GiveTask(self._defaultCrossFadeTime)
30
-
31
- self._layerMaid = Maid.new()
32
- self._maid:GiveTask(self._layerMaid)
33
-
34
- self._volumeMultiplier = ValueObject.new(1, "number")
35
- self._maid:GiveTask(self._volumeMultiplier)
24
+ self._soundParent = self._maid:Add(ValueObject.new(nil))
25
+ self._soundGroup = self._maid:Add(ValueObject.new(nil))
26
+ self._bpm = self._maid:Add(ValueObject.new(nil))
27
+ self._defaultCrossFadeTime = self._maid:Add(ValueObject.new(0.5, "number"))
28
+ self._volumeMultiplier = self._maid:Add(ValueObject.new(1, "number"))
36
29
 
37
30
  self._layers = {}
38
31
 
@@ -58,9 +51,15 @@ function LayeredLoopedSoundPlayer:SetBPM(bpm)
58
51
  end
59
52
 
60
53
  function LayeredLoopedSoundPlayer:SetSoundParent(soundParent)
54
+ assert(typeof(soundParent) == "Instance" or soundParent == nil, "Bad soundParent")
55
+
61
56
  self._soundParent.Value = soundParent
62
57
  end
63
58
 
59
+ function LayeredLoopedSoundPlayer:SetSoundGroup(soundGroup)
60
+ return self._soundGroup:Mount(soundGroup)
61
+ end
62
+
64
63
  function LayeredLoopedSoundPlayer:Swap(layerId, soundId, scheduleOptions)
65
64
  assert(type(layerId) == "string", 'Bad layerId')
66
65
  assert(SoundUtils.isConvertableToRbxAsset(soundId) or soundId == nil, "Bad soundId")
@@ -119,9 +118,12 @@ function LayeredLoopedSoundPlayer:_getOrCreateLayer(layerId)
119
118
 
120
119
  local maid = Maid.new()
121
120
 
122
- local layer = LoopedSoundPlayer.new()
121
+ local layer = maid:Add(LoopedSoundPlayer.new())
123
122
  layer:SetDoSyncSoundPlayback(true)
124
- maid:GiveTask(layer)
123
+
124
+ maid:GiveTask(self._soundGroup:Observe():Subscribe(function(soundGroup)
125
+ layer:SetSoundGroup(soundGroup)
126
+ end))
125
127
 
126
128
  maid:GiveTask(layer:SetCrossFadeTime(self._defaultCrossFadeTime:Observe()))
127
129
 
@@ -30,16 +30,14 @@ function LoopedSoundPlayer.new(soundId, soundParent)
30
30
 
31
31
  local self = setmetatable(SpringTransitionModel.new(), LoopedSoundPlayer)
32
32
 
33
- self._currentSoundLooped = Signal.new()
34
- self._maid:GiveTask(self._currentSoundLooped)
35
-
36
- self._currentSoundLoopedAfterDelay = Signal.new()
37
- self._maid:GiveTask(self._currentSoundLoopedAfterDelay)
33
+ self._currentSoundLooped = self._maid:Add(Signal.new())
34
+ self._currentSoundLoopedAfterDelay = self._maid:Add(Signal.new())
38
35
 
39
36
  self:SetSpeed(10)
40
37
 
41
38
  self._bpm = self._maid:Add(ValueObject.new(nil))
42
39
  self._soundParent = self._maid:Add(ValueObject.new(nil))
40
+ self._soundGroup = self._maid:Add(ValueObject.new(nil))
43
41
  self._crossFadeTime = self._maid:Add(ValueObject.new(0.5, "number"))
44
42
  self._volumeMultiplier = self._maid:Add(ValueObject.new(1, "number"))
45
43
  self._doSyncSoundPlayback = self._maid:Add(ValueObject.new(false, "boolean"))
@@ -70,6 +68,10 @@ function LoopedSoundPlayer:SetVolumeMultiplier(volume)
70
68
  self._volumeMultiplier.Value = volume
71
69
  end
72
70
 
71
+ function LoopedSoundPlayer:SetSoundGroup(soundGroup)
72
+ return self._soundGroup:Mount(soundGroup)
73
+ end
74
+
73
75
  function LoopedSoundPlayer:SetBPM(bpm)
74
76
  assert(type(bpm) == "number" or bpm == nil, "Bad bpm")
75
77
 
@@ -118,9 +120,12 @@ function LoopedSoundPlayer:_renderSoundPlayer(soundId)
118
120
  local maid = Maid.new()
119
121
 
120
122
  local renderMaid = Maid.new()
121
- local soundPlayer = SimpleLoopedSoundPlayer.new(soundId)
123
+ local soundPlayer = renderMaid:Add(SimpleLoopedSoundPlayer.new(soundId))
122
124
  soundPlayer:SetTransitionTime(self._crossFadeTime)
123
- renderMaid:GiveTask(soundPlayer)
125
+
126
+ renderMaid:GiveTask(self._soundGroup:Observe():Subscribe(function(soundGroup)
127
+ soundPlayer:SetSoundGroup(soundGroup)
128
+ end))
124
129
 
125
130
  renderMaid:GiveTask(Rx.combineLatest({
126
131
  bpm = self._bpm:Observe();
@@ -15,12 +15,11 @@ return function(target)
15
15
 
16
16
  local ORIGINAL = nil --"rbxassetid://14477435416"
17
17
 
18
- local loopedSoundPlayer = LoopedSoundPlayer.new(ORIGINAL, target)
18
+ local loopedSoundPlayer = maid:Add(LoopedSoundPlayer.new(ORIGINAL, target))
19
19
  loopedSoundPlayer:SetDoSyncSoundPlayback(true)
20
20
  loopedSoundPlayer:SetCrossFadeTime(2)
21
21
  loopedSoundPlayer:SetVolumeMultiplier(0.25)
22
22
  loopedSoundPlayer:SetSoundParent(target)
23
- maid:GiveTask(loopedSoundPlayer)
24
23
 
25
24
  local OPTIONS = {
26
25
  "rbxassetid://14477453689";
@@ -18,15 +18,13 @@ SimpleLoopedSoundPlayer.__index = SimpleLoopedSoundPlayer
18
18
  function SimpleLoopedSoundPlayer.new(soundId)
19
19
  local self = setmetatable(TimedTransitionModel.new(), SimpleLoopedSoundPlayer)
20
20
 
21
- self.Sound = SoundUtils.createSoundFromId(soundId)
21
+ self.Sound = self._maid:Add(SoundUtils.createSoundFromId(soundId))
22
22
  self.Sound.Looped = true
23
23
  self.Sound.Archivable = false
24
- self._maid:GiveTask(self.Sound)
25
24
 
26
25
  self:SetTransitionTime(1)
27
26
 
28
- self._volumeMultiplier = ValueObject.new(1, "number")
29
- self._maid:GiveTask(self._volumeMultiplier)
27
+ self._volumeMultiplier = self._maid:Add(ValueObject.new(1, "number"))
30
28
 
31
29
  self._maxVolume = self.Sound.Volume
32
30
 
@@ -46,6 +44,12 @@ function SimpleLoopedSoundPlayer.new(soundId)
46
44
  return self
47
45
  end
48
46
 
47
+ function SimpleLoopedSoundPlayer:SetSoundGroup(soundGroup)
48
+ assert(typeof(soundGroup) == "Instance" or soundGroup == nil, "Bad soundGroup")
49
+
50
+ self.Sound.SoundGroup = soundGroup
51
+ end
52
+
49
53
  function SimpleLoopedSoundPlayer:SetVolumeMultiplier(volume)
50
54
  self._volumeMultiplier.Value = volume
51
55
  end
@@ -11,9 +11,8 @@ local Blend = require("Blend")
11
11
  return function(target)
12
12
  local maid = Maid.new()
13
13
 
14
- local simpleLoopedSoundPlayer = SimpleLoopedSoundPlayer.new("rbxassetid://14477453689")
14
+ local simpleLoopedSoundPlayer = maid:Add(SimpleLoopedSoundPlayer.new("rbxassetid://14477453689"))
15
15
  simpleLoopedSoundPlayer:SetTransitionTime(1)
16
- maid:GiveTask(simpleLoopedSoundPlayer)
17
16
 
18
17
  simpleLoopedSoundPlayer.Sound.Parent = target
19
18