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