@quenty/soundplayer 7.20.0-canary.ae8d76d.0 → 7.20.1-canary.39d0eda.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 +10 -2
- package/package.json +18 -18
- package/src/Client/Loops/Layered/LayeredLoopedSoundPlayer.lua +14 -14
- package/src/Client/Loops/Layered/LayeredLoopedSoundPlayer.story.lua +76 -80
- package/src/Client/Loops/LoopedSoundPlayer.story.lua +55 -53
- package/src/Client/Loops/SimpleLoopedSoundPlayer.lua +7 -8
- package/src/Client/Loops/SimpleLoopedSoundPlayer.story.lua +25 -26
- package/src/Client/Schedule/SoundLoopScheduleUtils.lua +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,20 @@
|
|
|
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
|
-
|
|
6
|
+
## [7.20.1-canary.39d0eda.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@7.20.0...@quenty/soundplayer@7.20.1-canary.39d0eda.0) (2025-08-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/soundplayer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [7.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@7.19.3...@quenty/soundplayer@7.20.0) (2025-05-10)
|
|
7
15
|
|
|
8
16
|
|
|
9
17
|
### Features
|
|
10
18
|
|
|
11
|
-
* Add even more types ([
|
|
19
|
+
* Add even more types ([b31717d](https://github.com/Quenty/NevermoreEngine/commit/b31717d8c9f7620c457f5018a2affa760a65334a))
|
|
12
20
|
|
|
13
21
|
|
|
14
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/soundplayer",
|
|
3
|
-
"version": "7.20.
|
|
3
|
+
"version": "7.20.1-canary.39d0eda.0",
|
|
4
4
|
"description": "Sound playback helper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,27 +26,27 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@quenty/adorneeutils": "3.3.3",
|
|
29
|
-
"@quenty/baseobject": "10.
|
|
30
|
-
"@quenty/blend": "12.19.
|
|
31
|
-
"@quenty/brio": "14.18.
|
|
32
|
-
"@quenty/instanceutils": "13.18.
|
|
33
|
-
"@quenty/loader": "10.
|
|
34
|
-
"@quenty/maid": "3.
|
|
29
|
+
"@quenty/baseobject": "10.9.0",
|
|
30
|
+
"@quenty/blend": "12.19.1-canary.39d0eda.0",
|
|
31
|
+
"@quenty/brio": "14.18.1-canary.39d0eda.0",
|
|
32
|
+
"@quenty/instanceutils": "13.18.1-canary.39d0eda.0",
|
|
33
|
+
"@quenty/loader": "10.9.0",
|
|
34
|
+
"@quenty/maid": "3.5.0",
|
|
35
35
|
"@quenty/numberrangeutils": "3.1.1",
|
|
36
|
-
"@quenty/promise": "10.11.
|
|
37
|
-
"@quenty/promisemaid": "5.11.
|
|
38
|
-
"@quenty/randomutils": "6.
|
|
39
|
-
"@quenty/rbxasset": "5.
|
|
40
|
-
"@quenty/rx": "13.18.
|
|
41
|
-
"@quenty/signal": "7.
|
|
42
|
-
"@quenty/sounds": "10.11.
|
|
43
|
-
"@quenty/table": "3.
|
|
44
|
-
"@quenty/transitionmodel": "7.20.
|
|
45
|
-
"@quenty/valueobject": "13.18.
|
|
36
|
+
"@quenty/promise": "10.11.1-canary.39d0eda.0",
|
|
37
|
+
"@quenty/promisemaid": "5.11.1-canary.39d0eda.0",
|
|
38
|
+
"@quenty/randomutils": "6.11.0",
|
|
39
|
+
"@quenty/rbxasset": "5.9.0",
|
|
40
|
+
"@quenty/rx": "13.18.1-canary.39d0eda.0",
|
|
41
|
+
"@quenty/signal": "7.11.1-canary.39d0eda.0",
|
|
42
|
+
"@quenty/sounds": "10.11.1-canary.39d0eda.0",
|
|
43
|
+
"@quenty/table": "3.8.0",
|
|
44
|
+
"@quenty/transitionmodel": "7.20.1-canary.39d0eda.0",
|
|
45
|
+
"@quenty/valueobject": "13.18.1-canary.39d0eda.0",
|
|
46
46
|
"@quentystudios/t": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "39d0edaa45d0c4812b43f2a64ad543fac3f79423"
|
|
52
52
|
}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
|
-
local SpringTransitionModel = require("SpringTransitionModel")
|
|
8
|
-
local ValueObject = require("ValueObject")
|
|
9
7
|
local LoopedSoundPlayer = require("LoopedSoundPlayer")
|
|
10
8
|
local Maid = require("Maid")
|
|
11
9
|
local Rx = require("Rx")
|
|
12
|
-
local SoundUtils = require("SoundUtils")
|
|
13
10
|
local SoundLoopScheduleUtils = require("SoundLoopScheduleUtils")
|
|
11
|
+
local SoundUtils = require("SoundUtils")
|
|
12
|
+
local SpringTransitionModel = require("SpringTransitionModel")
|
|
13
|
+
local ValueObject = require("ValueObject")
|
|
14
14
|
local t = require("t")
|
|
15
15
|
|
|
16
16
|
local LayeredLoopedSoundPlayer = setmetatable({}, SpringTransitionModel)
|
|
@@ -60,7 +60,7 @@ function LayeredLoopedSoundPlayer:SetSoundGroup(soundGroup: SoundGroup?)
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
function LayeredLoopedSoundPlayer:Swap(layerId: string, soundId, scheduleOptions)
|
|
63
|
-
assert(type(layerId) == "string",
|
|
63
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
64
64
|
assert(SoundUtils.isConvertableToRbxAsset(soundId) or soundId == nil, "Bad soundId")
|
|
65
65
|
assert(SoundLoopScheduleUtils.isLoopedSchedule(scheduleOptions) or scheduleOptions == nil, "Bad scheduleOptions")
|
|
66
66
|
|
|
@@ -69,7 +69,7 @@ function LayeredLoopedSoundPlayer:Swap(layerId: string, soundId, scheduleOptions
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
function LayeredLoopedSoundPlayer:SwapOnLoop(layerId, soundId, scheduleOptions)
|
|
72
|
-
assert(type(layerId) == "string",
|
|
72
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
73
73
|
assert(SoundUtils.isConvertableToRbxAsset(soundId) or soundId == nil, "Bad soundId")
|
|
74
74
|
|
|
75
75
|
local layer = self:_getOrCreateLayer(layerId)
|
|
@@ -77,7 +77,7 @@ function LayeredLoopedSoundPlayer:SwapOnLoop(layerId, soundId, scheduleOptions)
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
function LayeredLoopedSoundPlayer:SwapToSamples(layerId, soundId, scheduleOptions)
|
|
80
|
-
assert(type(layerId) == "string",
|
|
80
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
81
81
|
assert(SoundUtils.isConvertableToRbxAsset(soundId) or soundId == nil, "Bad soundId")
|
|
82
82
|
assert(SoundLoopScheduleUtils.isLoopedSchedule(scheduleOptions) or scheduleOptions == nil, "Bad scheduleOptions")
|
|
83
83
|
|
|
@@ -86,7 +86,7 @@ function LayeredLoopedSoundPlayer:SwapToSamples(layerId, soundId, scheduleOption
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
function LayeredLoopedSoundPlayer:SwapToChoice(layerId, soundIdList, scheduleOptions)
|
|
89
|
-
assert(type(layerId) == "string",
|
|
89
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
90
90
|
assert(type(soundIdList) == "table", "Bad soundIdList")
|
|
91
91
|
assert(SoundLoopScheduleUtils.isLoopedSchedule(scheduleOptions) or scheduleOptions == nil, "Bad scheduleOptions")
|
|
92
92
|
|
|
@@ -95,7 +95,7 @@ function LayeredLoopedSoundPlayer:SwapToChoice(layerId, soundIdList, scheduleOpt
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
function LayeredLoopedSoundPlayer:PlayOnce(layerId, soundIdList, scheduleOptions)
|
|
98
|
-
assert(type(layerId) == "string",
|
|
98
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
99
99
|
assert(type(soundIdList) == "table", "Bad soundIdList")
|
|
100
100
|
assert(SoundLoopScheduleUtils.isLoopedSchedule(scheduleOptions) or scheduleOptions == nil, "Bad scheduleOptions")
|
|
101
101
|
|
|
@@ -104,14 +104,14 @@ function LayeredLoopedSoundPlayer:PlayOnce(layerId, soundIdList, scheduleOptions
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
function LayeredLoopedSoundPlayer:PlayOnceOnLoop(layerId, soundId, scheduleOptions)
|
|
107
|
-
assert(type(layerId) == "string",
|
|
107
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
108
108
|
|
|
109
109
|
local layer = self:_getOrCreateLayer(layerId)
|
|
110
110
|
layer:PlayOnceOnLoop(soundId, scheduleOptions)
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
function LayeredLoopedSoundPlayer:_getOrCreateLayer(layerId)
|
|
114
|
-
if
|
|
114
|
+
if self._layers[layerId] then
|
|
115
115
|
return self._layers[layerId]
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -139,10 +139,10 @@ function LayeredLoopedSoundPlayer:_getOrCreateLayer(layerId)
|
|
|
139
139
|
end))
|
|
140
140
|
|
|
141
141
|
maid:GiveTask(Rx.combineLatest({
|
|
142
|
-
visible = self:ObserveRenderStepped()
|
|
143
|
-
multiplier = self._volumeMultiplier:Observe()
|
|
142
|
+
visible = self:ObserveRenderStepped(),
|
|
143
|
+
multiplier = self._volumeMultiplier:Observe(),
|
|
144
144
|
}):Subscribe(function(state)
|
|
145
|
-
layer:SetVolumeMultiplier(state.multiplier*state.visible)
|
|
145
|
+
layer:SetVolumeMultiplier(state.multiplier * state.visible)
|
|
146
146
|
end))
|
|
147
147
|
|
|
148
148
|
self._layers[layerId] = layer
|
|
@@ -167,4 +167,4 @@ function LayeredLoopedSoundPlayer:StopAll()
|
|
|
167
167
|
self._layerMaid:DoCleaning()
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
-
return LayeredLoopedSoundPlayer
|
|
170
|
+
return LayeredLoopedSoundPlayer
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
@class LayeredLoopedSoundPlayer.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
|
-
local Maid = require("Maid")
|
|
8
|
-
local LayeredLoopedSoundPlayer = require("LayeredLoopedSoundPlayer")
|
|
9
8
|
local Blend = require("Blend")
|
|
9
|
+
local LayeredLoopedSoundPlayer = require("LayeredLoopedSoundPlayer")
|
|
10
|
+
local Maid = require("Maid")
|
|
10
11
|
|
|
11
12
|
return function(target)
|
|
12
13
|
local maid = Maid.new()
|
|
@@ -19,23 +20,23 @@ return function(target)
|
|
|
19
20
|
local function initial()
|
|
20
21
|
layeredLoopedSoundPlayer:SwapToChoice("drums", {
|
|
21
22
|
{
|
|
22
|
-
SoundId = "rbxassetid://14478151709"
|
|
23
|
-
Volume = 0.1
|
|
24
|
-
}
|
|
23
|
+
SoundId = "rbxassetid://14478151709",
|
|
24
|
+
Volume = 0.1,
|
|
25
|
+
},
|
|
25
26
|
{
|
|
26
|
-
SoundId = "rbxassetid://14478738244"
|
|
27
|
-
Volume = 0.1
|
|
28
|
-
}
|
|
27
|
+
SoundId = "rbxassetid://14478738244",
|
|
28
|
+
Volume = 0.1,
|
|
29
|
+
},
|
|
29
30
|
})
|
|
30
31
|
layeredLoopedSoundPlayer:SwapToChoice("rifts", {
|
|
31
32
|
{
|
|
32
|
-
SoundId = "rbxassetid://14478152812"
|
|
33
|
-
Volume = 0.2
|
|
34
|
-
}
|
|
33
|
+
SoundId = "rbxassetid://14478152812",
|
|
34
|
+
Volume = 0.2,
|
|
35
|
+
},
|
|
35
36
|
{
|
|
36
|
-
SoundId = "rbxassetid://14478729478"
|
|
37
|
-
Volume = 0.015
|
|
38
|
-
}
|
|
37
|
+
SoundId = "rbxassetid://14478729478",
|
|
38
|
+
Volume = 0.015,
|
|
39
|
+
},
|
|
39
40
|
})
|
|
40
41
|
end
|
|
41
42
|
initial()
|
|
@@ -44,117 +45,112 @@ return function(target)
|
|
|
44
45
|
|
|
45
46
|
local function button(props)
|
|
46
47
|
return Blend.New "TextButton" {
|
|
47
|
-
Text = props.Text
|
|
48
|
-
AutoButtonColor = true
|
|
49
|
-
Font = Enum.Font.FredokaOne
|
|
50
|
-
Size = UDim2.new(0, 100, 0, 30)
|
|
51
|
-
|
|
52
|
-
Blend.New "UICorner" {
|
|
48
|
+
Text = props.Text,
|
|
49
|
+
AutoButtonColor = true,
|
|
50
|
+
Font = Enum.Font.FredokaOne,
|
|
51
|
+
Size = UDim2.new(0, 100, 0, 30),
|
|
53
52
|
|
|
54
|
-
}
|
|
53
|
+
Blend.New "UICorner" {},
|
|
55
54
|
|
|
56
55
|
[Blend.OnEvent "Activated"] = function()
|
|
57
|
-
props.OnActivated()
|
|
58
|
-
end
|
|
59
|
-
}
|
|
56
|
+
props.OnActivated()
|
|
57
|
+
end,
|
|
58
|
+
}
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
maid:GiveTask(Blend.mount(target, {
|
|
63
62
|
Blend.New "Frame" {
|
|
64
|
-
Name = "ButtonContainer"
|
|
65
|
-
BackgroundTransparency = 1
|
|
66
|
-
Position = UDim2.new(0.5, 0, 0, 5)
|
|
67
|
-
AnchorPoint = Vector2.new(0.5, 0)
|
|
68
|
-
Size = UDim2.new(1, 0, 0, 30)
|
|
63
|
+
Name = "ButtonContainer",
|
|
64
|
+
BackgroundTransparency = 1,
|
|
65
|
+
Position = UDim2.new(0.5, 0, 0, 5),
|
|
66
|
+
AnchorPoint = Vector2.new(0.5, 0),
|
|
67
|
+
Size = UDim2.new(1, 0, 0, 30),
|
|
69
68
|
|
|
70
69
|
Blend.New "UIListLayout" {
|
|
71
|
-
FillDirection = Enum.FillDirection.Horizontal
|
|
72
|
-
Padding = UDim.new(0, 5)
|
|
73
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
74
|
-
}
|
|
70
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
71
|
+
Padding = UDim.new(0, 5),
|
|
72
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
73
|
+
},
|
|
75
74
|
|
|
76
75
|
button({
|
|
77
|
-
Text = "Toggle"
|
|
76
|
+
Text = "Toggle",
|
|
78
77
|
OnActivated = function()
|
|
79
78
|
layeredLoopedSoundPlayer:Toggle()
|
|
80
|
-
end
|
|
81
|
-
})
|
|
79
|
+
end,
|
|
80
|
+
}),
|
|
82
81
|
|
|
83
82
|
button({
|
|
84
|
-
Text = "Reset"
|
|
83
|
+
Text = "Reset",
|
|
85
84
|
OnActivated = function()
|
|
86
85
|
initial()
|
|
87
|
-
end
|
|
88
|
-
})
|
|
86
|
+
end,
|
|
87
|
+
}),
|
|
89
88
|
|
|
90
89
|
button({
|
|
91
|
-
Text = "Combat equip"
|
|
90
|
+
Text = "Combat equip",
|
|
92
91
|
OnActivated = function()
|
|
93
92
|
layeredLoopedSoundPlayer:SwapToChoice("drums", {
|
|
94
|
-
"rbxassetid://14478154829"
|
|
95
|
-
"rbxassetid://14478714545"
|
|
96
|
-
"rbxassetid://14478772830"
|
|
97
|
-
"rbxassetid://14478897865"
|
|
93
|
+
"rbxassetid://14478154829",
|
|
94
|
+
"rbxassetid://14478714545",
|
|
95
|
+
"rbxassetid://14478772830",
|
|
96
|
+
"rbxassetid://14478897865",
|
|
98
97
|
})
|
|
99
98
|
layeredLoopedSoundPlayer:PlayOnceOnLoop("rifts", nil)
|
|
100
|
-
end
|
|
101
|
-
})
|
|
99
|
+
end,
|
|
100
|
+
}),
|
|
102
101
|
|
|
103
102
|
button({
|
|
104
|
-
Text = "On target lock"
|
|
103
|
+
Text = "On target lock",
|
|
105
104
|
OnActivated = function()
|
|
106
105
|
layeredLoopedSoundPlayer:SwapToChoice("drums", {
|
|
107
106
|
{
|
|
108
|
-
SoundId = "rbxassetid://14478150956"
|
|
109
|
-
Volume = 0.1
|
|
110
|
-
}
|
|
107
|
+
SoundId = "rbxassetid://14478150956",
|
|
108
|
+
Volume = 0.1,
|
|
109
|
+
},
|
|
111
110
|
{
|
|
112
|
-
SoundId = "rbxassetid://14478721669"
|
|
113
|
-
Volume = 0.2
|
|
114
|
-
}
|
|
115
|
-
"rbxassetid://14478154829"
|
|
116
|
-
"rbxassetid://14478764914"
|
|
111
|
+
SoundId = "rbxassetid://14478721669",
|
|
112
|
+
Volume = 0.2,
|
|
113
|
+
},
|
|
114
|
+
"rbxassetid://14478154829",
|
|
115
|
+
"rbxassetid://14478764914",
|
|
117
116
|
})
|
|
118
117
|
|
|
119
118
|
layeredLoopedSoundPlayer:SwapToChoice("rifts", {
|
|
120
|
-
"rbxassetid://14478145963"
|
|
121
|
-
"rbxassetid://14478156714"
|
|
119
|
+
"rbxassetid://14478145963",
|
|
120
|
+
"rbxassetid://14478156714",
|
|
122
121
|
{
|
|
123
|
-
SoundId = "rbxassetid://14478777472"
|
|
124
|
-
Volume = 0.1
|
|
125
|
-
}
|
|
122
|
+
SoundId = "rbxassetid://14478777472",
|
|
123
|
+
Volume = 0.1,
|
|
124
|
+
},
|
|
126
125
|
{
|
|
127
|
-
SoundId = "rbxassetid://14478793045"
|
|
128
|
-
Volume = 0.1
|
|
129
|
-
}
|
|
126
|
+
SoundId = "rbxassetid://14478793045",
|
|
127
|
+
Volume = 0.1,
|
|
128
|
+
},
|
|
130
129
|
})
|
|
131
|
-
end
|
|
132
|
-
})
|
|
130
|
+
end,
|
|
131
|
+
}),
|
|
133
132
|
|
|
134
133
|
button({
|
|
135
|
-
Text = "On low health"
|
|
134
|
+
Text = "On low health",
|
|
136
135
|
OnActivated = function()
|
|
137
136
|
layeredLoopedSoundPlayer:SwapToChoice("drums", {
|
|
138
|
-
"rbxassetid://14478746326"
|
|
139
|
-
"rbxassetid://14478767498"
|
|
140
|
-
"rbxassetid://14478797936"
|
|
137
|
+
"rbxassetid://14478746326",
|
|
138
|
+
"rbxassetid://14478767498",
|
|
139
|
+
"rbxassetid://14478797936", -- record scratch
|
|
141
140
|
})
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
|
|
141
|
+
end,
|
|
142
|
+
}),
|
|
146
143
|
|
|
147
144
|
button({
|
|
148
|
-
Text = "Target drop"
|
|
145
|
+
Text = "Target drop",
|
|
149
146
|
OnActivated = function()
|
|
150
147
|
layeredLoopedSoundPlayer:PlayOnceOnLoop("rifts", "rbxassetid://14478158396")
|
|
151
|
-
end
|
|
152
|
-
})
|
|
153
|
-
}
|
|
148
|
+
end,
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
154
151
|
}))
|
|
155
152
|
|
|
156
|
-
|
|
157
153
|
return function()
|
|
158
154
|
maid:DoCleaning()
|
|
159
155
|
end
|
|
160
|
-
end
|
|
156
|
+
end
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
@class LoopedSoundPlayer.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
7
|
-
local Maid = require("Maid")
|
|
8
|
-
local LoopedSoundPlayer = require("LoopedSoundPlayer")
|
|
9
|
-
local RandomUtils = require("RandomUtils")
|
|
10
8
|
local Blend = require("Blend")
|
|
9
|
+
local LoopedSoundPlayer = require("LoopedSoundPlayer")
|
|
11
10
|
local LoopedSoundScheduleUtils = require("LoopedSoundScheduleUtils")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local RandomUtils = require("RandomUtils")
|
|
12
13
|
|
|
13
14
|
return function(target)
|
|
14
15
|
local maid = Maid.new()
|
|
@@ -22,7 +23,7 @@ return function(target)
|
|
|
22
23
|
loopedSoundPlayer:SetSoundParent(target)
|
|
23
24
|
|
|
24
25
|
local OPTIONS = {
|
|
25
|
-
"rbxassetid://14477453689"
|
|
26
|
+
"rbxassetid://14477453689",
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
maid:GiveTask(task.spawn(function()
|
|
@@ -36,89 +37,90 @@ return function(target)
|
|
|
36
37
|
|
|
37
38
|
local function button(props)
|
|
38
39
|
return Blend.New "TextButton" {
|
|
39
|
-
Text = props.Text
|
|
40
|
-
AutoButtonColor = true
|
|
41
|
-
Font = Enum.Font.FredokaOne
|
|
42
|
-
Size = UDim2.new(0, 100, 0, 30)
|
|
43
|
-
|
|
44
|
-
Blend.New "UICorner" {
|
|
40
|
+
Text = props.Text,
|
|
41
|
+
AutoButtonColor = true,
|
|
42
|
+
Font = Enum.Font.FredokaOne,
|
|
43
|
+
Size = UDim2.new(0, 100, 0, 30),
|
|
45
44
|
|
|
46
|
-
}
|
|
45
|
+
Blend.New "UICorner" {},
|
|
47
46
|
|
|
48
47
|
[Blend.OnEvent "Activated"] = function()
|
|
49
|
-
props.OnActivated()
|
|
50
|
-
end
|
|
51
|
-
}
|
|
48
|
+
props.OnActivated()
|
|
49
|
+
end,
|
|
50
|
+
}
|
|
52
51
|
end
|
|
53
52
|
|
|
54
53
|
maid:GiveTask(Blend.mount(target, {
|
|
55
54
|
Blend.New "Frame" {
|
|
56
|
-
Name = "ButtonContainer"
|
|
57
|
-
BackgroundTransparency = 1
|
|
58
|
-
Position = UDim2.new(0.5, 0, 0, 5)
|
|
59
|
-
AnchorPoint = Vector2.new(0.5, 0)
|
|
60
|
-
Size = UDim2.new(1, 0, 0, 30)
|
|
55
|
+
Name = "ButtonContainer",
|
|
56
|
+
BackgroundTransparency = 1,
|
|
57
|
+
Position = UDim2.new(0.5, 0, 0, 5),
|
|
58
|
+
AnchorPoint = Vector2.new(0.5, 0),
|
|
59
|
+
Size = UDim2.new(1, 0, 0, 30),
|
|
61
60
|
|
|
62
61
|
Blend.New "UIListLayout" {
|
|
63
|
-
FillDirection = Enum.FillDirection.Horizontal
|
|
64
|
-
Padding = UDim.new(0, 5)
|
|
65
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
66
|
-
}
|
|
62
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
63
|
+
Padding = UDim.new(0, 5),
|
|
64
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
65
|
+
},
|
|
67
66
|
|
|
68
67
|
button({
|
|
69
|
-
Text = "Toggle"
|
|
68
|
+
Text = "Toggle",
|
|
70
69
|
OnActivated = function()
|
|
71
70
|
loopedSoundPlayer:Toggle()
|
|
72
|
-
end
|
|
73
|
-
})
|
|
71
|
+
end,
|
|
72
|
+
}),
|
|
74
73
|
|
|
75
74
|
button({
|
|
76
|
-
Text = "Reset"
|
|
75
|
+
Text = "Reset",
|
|
77
76
|
OnActivated = function()
|
|
78
77
|
loopedSoundPlayer:Swap(ORIGINAL)
|
|
79
|
-
end
|
|
80
|
-
})
|
|
78
|
+
end,
|
|
79
|
+
}),
|
|
81
80
|
|
|
82
81
|
button({
|
|
83
|
-
Text = "Swap sample"
|
|
82
|
+
Text = "Swap sample",
|
|
84
83
|
OnActivated = function()
|
|
85
84
|
loopedSoundPlayer:SwapToSamples({
|
|
86
|
-
"rbxassetid://14478670277"
|
|
87
|
-
"rbxassetid://14478671494"
|
|
88
|
-
"rbxassetid://14478672676"
|
|
85
|
+
"rbxassetid://14478670277",
|
|
86
|
+
"rbxassetid://14478671494",
|
|
87
|
+
"rbxassetid://14478672676",
|
|
89
88
|
})
|
|
90
|
-
end
|
|
91
|
-
})
|
|
89
|
+
end,
|
|
90
|
+
}),
|
|
92
91
|
|
|
93
92
|
button({
|
|
94
|
-
Text = "Play once"
|
|
93
|
+
Text = "Play once",
|
|
95
94
|
OnActivated = function()
|
|
96
95
|
loopedSoundPlayer:PlayOnce("rbxassetid://14478764914")
|
|
97
|
-
end
|
|
98
|
-
})
|
|
96
|
+
end,
|
|
97
|
+
}),
|
|
99
98
|
|
|
100
99
|
button({
|
|
101
|
-
Text = "Play delayed loop"
|
|
100
|
+
Text = "Play delayed loop",
|
|
102
101
|
OnActivated = function()
|
|
103
|
-
loopedSoundPlayer:Swap(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
loopedSoundPlayer:Swap(
|
|
103
|
+
{
|
|
104
|
+
SoundId = "rbxassetid://6052547865",
|
|
105
|
+
Volume = 3,
|
|
106
|
+
},
|
|
107
|
+
LoopedSoundScheduleUtils.schedule({
|
|
108
|
+
loopDelay = NumberRange.new(0.25, 1),
|
|
109
|
+
})
|
|
110
|
+
)
|
|
111
|
+
end,
|
|
112
|
+
}),
|
|
111
113
|
|
|
112
114
|
button({
|
|
113
|
-
Text = "Swap on loop"
|
|
115
|
+
Text = "Swap on loop",
|
|
114
116
|
OnActivated = function()
|
|
115
117
|
loopedSoundPlayer:SwapOnLoop(RandomUtils.choice(OPTIONS))
|
|
116
|
-
end
|
|
117
|
-
})
|
|
118
|
-
}
|
|
118
|
+
end,
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
119
121
|
}))
|
|
120
122
|
|
|
121
123
|
return function()
|
|
122
124
|
maid:DoCleaning()
|
|
123
125
|
end
|
|
124
|
-
end
|
|
126
|
+
end
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
|
-
local
|
|
7
|
+
local Promise = require("Promise")
|
|
8
8
|
local Rx = require("Rx")
|
|
9
|
-
local SoundUtils = require("SoundUtils")
|
|
10
9
|
local SoundPromiseUtils = require("SoundPromiseUtils")
|
|
11
|
-
local
|
|
10
|
+
local SoundUtils = require("SoundUtils")
|
|
11
|
+
local TimedTransitionModel = require("TimedTransitionModel")
|
|
12
12
|
local ValueObject = require("ValueObject")
|
|
13
13
|
|
|
14
14
|
local SimpleLoopedSoundPlayer = setmetatable({}, TimedTransitionModel)
|
|
@@ -29,10 +29,10 @@ function SimpleLoopedSoundPlayer.new(soundId)
|
|
|
29
29
|
self._maxVolume = self.Sound.Volume
|
|
30
30
|
|
|
31
31
|
self._maid:GiveTask(Rx.combineLatest({
|
|
32
|
-
visible = self:ObserveRenderStepped()
|
|
33
|
-
multiplier = self._volumeMultiplier:Observe()
|
|
32
|
+
visible = self:ObserveRenderStepped(),
|
|
33
|
+
multiplier = self._volumeMultiplier:Observe(),
|
|
34
34
|
}):Subscribe(function(state)
|
|
35
|
-
self.Sound.Volume = state.visible*self._maxVolume*state.multiplier
|
|
35
|
+
self.Sound.Volume = state.visible * self._maxVolume * state.multiplier
|
|
36
36
|
end))
|
|
37
37
|
|
|
38
38
|
self._maid:GiveTask(self.VisibleChanged:Connect(function(isVisible)
|
|
@@ -63,5 +63,4 @@ function SimpleLoopedSoundPlayer:PromiseLoopDone()
|
|
|
63
63
|
return SoundPromiseUtils.promiseLooped(self.Sound)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
return SimpleLoopedSoundPlayer
|
|
66
|
+
return SimpleLoopedSoundPlayer
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
@class SimpleLoopedSoundPlayer.story
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local require =
|
|
5
|
+
local require =
|
|
6
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
6
7
|
|
|
8
|
+
local Blend = require("Blend")
|
|
7
9
|
local Maid = require("Maid")
|
|
8
10
|
local SimpleLoopedSoundPlayer = require("SimpleLoopedSoundPlayer")
|
|
9
|
-
local Blend = require("Blend")
|
|
10
11
|
|
|
11
12
|
return function(target)
|
|
12
13
|
local maid = Maid.new()
|
|
@@ -20,45 +21,43 @@ return function(target)
|
|
|
20
21
|
|
|
21
22
|
local function button(props)
|
|
22
23
|
return Blend.New "TextButton" {
|
|
23
|
-
Text = props.Text
|
|
24
|
-
AutoButtonColor = true
|
|
25
|
-
Font = Enum.Font.FredokaOne
|
|
26
|
-
Size = UDim2.new(0, 100, 0, 30)
|
|
27
|
-
|
|
28
|
-
Blend.New "UICorner" {
|
|
24
|
+
Text = props.Text,
|
|
25
|
+
AutoButtonColor = true,
|
|
26
|
+
Font = Enum.Font.FredokaOne,
|
|
27
|
+
Size = UDim2.new(0, 100, 0, 30),
|
|
29
28
|
|
|
30
|
-
}
|
|
29
|
+
Blend.New "UICorner" {},
|
|
31
30
|
|
|
32
31
|
[Blend.OnEvent "Activated"] = function()
|
|
33
|
-
props.OnActivated()
|
|
34
|
-
end
|
|
35
|
-
}
|
|
32
|
+
props.OnActivated()
|
|
33
|
+
end,
|
|
34
|
+
}
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
maid:GiveTask(Blend.mount(target, {
|
|
39
38
|
Blend.New "Frame" {
|
|
40
|
-
Name = "ButtonContainer"
|
|
41
|
-
BackgroundTransparency = 1
|
|
42
|
-
Position = UDim2.new(0.5, 0, 0, 5)
|
|
43
|
-
AnchorPoint = Vector2.new(0.5, 0)
|
|
44
|
-
Size = UDim2.new(1, 0, 0, 30)
|
|
39
|
+
Name = "ButtonContainer",
|
|
40
|
+
BackgroundTransparency = 1,
|
|
41
|
+
Position = UDim2.new(0.5, 0, 0, 5),
|
|
42
|
+
AnchorPoint = Vector2.new(0.5, 0),
|
|
43
|
+
Size = UDim2.new(1, 0, 0, 30),
|
|
45
44
|
|
|
46
45
|
Blend.New "UIListLayout" {
|
|
47
|
-
FillDirection = Enum.FillDirection.Horizontal
|
|
48
|
-
Padding = UDim.new(0, 5)
|
|
49
|
-
HorizontalAlignment = Enum.HorizontalAlignment.Center
|
|
50
|
-
}
|
|
46
|
+
FillDirection = Enum.FillDirection.Horizontal,
|
|
47
|
+
Padding = UDim.new(0, 5),
|
|
48
|
+
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
|
49
|
+
},
|
|
51
50
|
|
|
52
51
|
button({
|
|
53
|
-
Text = "Toggle"
|
|
52
|
+
Text = "Toggle",
|
|
54
53
|
OnActivated = function()
|
|
55
54
|
simpleLoopedSoundPlayer:Toggle()
|
|
56
|
-
end
|
|
57
|
-
})
|
|
58
|
-
}
|
|
55
|
+
end,
|
|
56
|
+
}),
|
|
57
|
+
},
|
|
59
58
|
}))
|
|
60
59
|
|
|
61
60
|
return function()
|
|
62
61
|
maid:DoCleaning()
|
|
63
62
|
end
|
|
64
|
-
end
|
|
63
|
+
end
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
|
-
local t = require("t")
|
|
8
7
|
local NumberRangeUtils = require("NumberRangeUtils")
|
|
9
8
|
local Table = require("Table")
|
|
9
|
+
local t = require("t")
|
|
10
10
|
|
|
11
11
|
local SoundLoopScheduleUtils = {}
|
|
12
12
|
|
|
@@ -69,4 +69,4 @@ function SoundLoopScheduleUtils.getWaitTimeSeconds(waitTime: number | NumberRang
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
return SoundLoopScheduleUtils
|
|
72
|
+
return SoundLoopScheduleUtils
|