@quenty/soundplayer 7.19.0 → 7.19.2-canary.547.11ae689.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,29 @@
|
|
|
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.19.2-canary.547.11ae689.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@7.19.0...@quenty/soundplayer@7.19.2-canary.547.11ae689.0) (2025-04-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
* Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [7.19.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@7.19.0...@quenty/soundplayer@7.19.1) (2025-04-07)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
# [7.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/soundplayer@7.18.2...@quenty/soundplayer@7.19.0) (2025-04-02)
|
|
7
30
|
|
|
8
31
|
**Note:** Version bump only for package @quenty/soundplayer
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2014-
|
|
3
|
+
Copyright (c) 2014-2025 James Onnen (Quenty)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/soundplayer",
|
|
3
|
-
"version": "7.19.0",
|
|
3
|
+
"version": "7.19.2-canary.547.11ae689.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": "
|
|
29
|
-
"@quenty/baseobject": "
|
|
30
|
-
"@quenty/blend": "
|
|
31
|
-
"@quenty/brio": "
|
|
32
|
-
"@quenty/instanceutils": "
|
|
33
|
-
"@quenty/loader": "
|
|
34
|
-
"@quenty/maid": "
|
|
35
|
-
"@quenty/numberrangeutils": "
|
|
36
|
-
"@quenty/promise": "
|
|
37
|
-
"@quenty/promisemaid": "
|
|
38
|
-
"@quenty/randomutils": "
|
|
39
|
-
"@quenty/rbxasset": "
|
|
40
|
-
"@quenty/rx": "
|
|
41
|
-
"@quenty/signal": "
|
|
42
|
-
"@quenty/sounds": "
|
|
43
|
-
"@quenty/table": "
|
|
44
|
-
"@quenty/transitionmodel": "
|
|
45
|
-
"@quenty/valueobject": "
|
|
28
|
+
"@quenty/adorneeutils": "3.3.3-canary.547.11ae689.0",
|
|
29
|
+
"@quenty/baseobject": "10.8.2-canary.547.11ae689.0",
|
|
30
|
+
"@quenty/blend": "12.18.2-canary.547.11ae689.0",
|
|
31
|
+
"@quenty/brio": "14.17.2-canary.547.11ae689.0",
|
|
32
|
+
"@quenty/instanceutils": "13.17.2-canary.547.11ae689.0",
|
|
33
|
+
"@quenty/loader": "10.8.2-canary.547.11ae689.0",
|
|
34
|
+
"@quenty/maid": "3.4.2-canary.547.11ae689.0",
|
|
35
|
+
"@quenty/numberrangeutils": "3.1.1",
|
|
36
|
+
"@quenty/promise": "10.10.3-canary.547.11ae689.0",
|
|
37
|
+
"@quenty/promisemaid": "5.10.3-canary.547.11ae689.0",
|
|
38
|
+
"@quenty/randomutils": "6.10.2-canary.547.11ae689.0",
|
|
39
|
+
"@quenty/rbxasset": "5.8.2-canary.547.11ae689.0",
|
|
40
|
+
"@quenty/rx": "13.17.2-canary.547.11ae689.0",
|
|
41
|
+
"@quenty/signal": "7.10.2-canary.547.11ae689.0",
|
|
42
|
+
"@quenty/sounds": "10.10.3-canary.547.11ae689.0",
|
|
43
|
+
"@quenty/table": "3.7.3-canary.547.11ae689.0",
|
|
44
|
+
"@quenty/transitionmodel": "7.19.2-canary.547.11ae689.0",
|
|
45
|
+
"@quenty/valueobject": "13.17.2-canary.547.11ae689.0",
|
|
46
46
|
"@quentystudios/t": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "11ae6894c9c40c596e521dc1d2a71977af63752f"
|
|
52
52
|
}
|
|
@@ -158,8 +158,8 @@ function LayeredLoopedSoundPlayer:_getOrCreateLayer(layerId)
|
|
|
158
158
|
return layer
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
function LayeredLoopedSoundPlayer:StopLayer(layerId)
|
|
162
|
-
assert(type(layerId) == "string",
|
|
161
|
+
function LayeredLoopedSoundPlayer:StopLayer(layerId: string)
|
|
162
|
+
assert(type(layerId) == "string", "Bad layerId")
|
|
163
163
|
|
|
164
164
|
self._layerMaid[layerId] = nil
|
|
165
165
|
end
|
|
@@ -25,7 +25,7 @@ local LoopedSoundPlayer = setmetatable({}, SpringTransitionModel)
|
|
|
25
25
|
LoopedSoundPlayer.ClassName = "LoopedSoundPlayer"
|
|
26
26
|
LoopedSoundPlayer.__index = LoopedSoundPlayer
|
|
27
27
|
|
|
28
|
-
function LoopedSoundPlayer.new(soundId, soundParent)
|
|
28
|
+
function LoopedSoundPlayer.new(soundId, soundParent: Instance?)
|
|
29
29
|
assert(SoundUtils.isConvertableToRbxAsset(soundId) or soundId == nil, "Bad soundId")
|
|
30
30
|
|
|
31
31
|
local self = setmetatable(SpringTransitionModel.new(), LoopedSoundPlayer)
|
|
@@ -60,25 +60,25 @@ function LoopedSoundPlayer.new(soundId, soundParent)
|
|
|
60
60
|
return self
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
function LoopedSoundPlayer:SetCrossFadeTime(crossFadeTime)
|
|
63
|
+
function LoopedSoundPlayer:SetCrossFadeTime(crossFadeTime: number)
|
|
64
64
|
return self._crossFadeTime:Mount(crossFadeTime)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
function LoopedSoundPlayer:SetVolumeMultiplier(volume)
|
|
67
|
+
function LoopedSoundPlayer:SetVolumeMultiplier(volume: number)
|
|
68
68
|
self._volumeMultiplier.Value = volume
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
function LoopedSoundPlayer:SetSoundGroup(soundGroup)
|
|
71
|
+
function LoopedSoundPlayer:SetSoundGroup(soundGroup: SoundGroup?)
|
|
72
72
|
return self._soundGroup:Mount(soundGroup)
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
function LoopedSoundPlayer:SetBPM(bpm)
|
|
75
|
+
function LoopedSoundPlayer:SetBPM(bpm: number?)
|
|
76
76
|
assert(type(bpm) == "number" or bpm == nil, "Bad bpm")
|
|
77
77
|
|
|
78
78
|
self._bpm.Value = bpm
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
function LoopedSoundPlayer:SetSoundParent(parent)
|
|
81
|
+
function LoopedSoundPlayer:SetSoundParent(parent: Instance?)
|
|
82
82
|
self._soundParent.Value = parent
|
|
83
83
|
end
|
|
84
84
|
|
|
@@ -96,24 +96,25 @@ function LoopedSoundPlayer:Swap(soundId, loopSchedule)
|
|
|
96
96
|
self._maid._swappingTo = maid
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
function LoopedSoundPlayer:SetDoSyncSoundPlayback(doSyncSoundPlayback)
|
|
99
|
+
function LoopedSoundPlayer:SetDoSyncSoundPlayback(doSyncSoundPlayback: boolean)
|
|
100
100
|
self._doSyncSoundPlayback.Value = doSyncSoundPlayback
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
function LoopedSoundPlayer:_setupRender()
|
|
104
|
-
self._maid:GiveTask(self._currentSoundId
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
self._maid:GiveTask(self._currentSoundId
|
|
105
|
+
:ObserveBrio(function(value)
|
|
106
|
+
return value ~= nil
|
|
107
|
+
end)
|
|
108
|
+
:Subscribe(function(brio)
|
|
109
|
+
if brio:IsDead() then
|
|
110
|
+
return
|
|
111
|
+
end
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
local maid = brio:ToMaid()
|
|
114
|
+
local soundId = brio:GetValue()
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
maid:GiveTask(self:_renderSoundPlayer(soundId))
|
|
117
|
+
end))
|
|
117
118
|
end
|
|
118
119
|
|
|
119
120
|
function LoopedSoundPlayer:_renderSoundPlayer(soundId)
|
|
@@ -128,18 +129,18 @@ function LoopedSoundPlayer:_renderSoundPlayer(soundId)
|
|
|
128
129
|
end))
|
|
129
130
|
|
|
130
131
|
renderMaid:GiveTask(Rx.combineLatest({
|
|
131
|
-
bpm = self._bpm:Observe()
|
|
132
|
-
isLoaded = Rx.fromPromise(SoundPromiseUtils.promiseLoaded(soundPlayer.Sound))
|
|
133
|
-
doSyncSoundPlayback = self._doSyncSoundPlayback:Observe()
|
|
134
|
-
timeLength = RxInstanceUtils.observeProperty(soundPlayer.Sound, "TimeLength")
|
|
132
|
+
bpm = self._bpm:Observe(),
|
|
133
|
+
isLoaded = Rx.fromPromise(SoundPromiseUtils.promiseLoaded(soundPlayer.Sound)),
|
|
134
|
+
doSyncSoundPlayback = self._doSyncSoundPlayback:Observe(),
|
|
135
|
+
timeLength = RxInstanceUtils.observeProperty(soundPlayer.Sound, "TimeLength"),
|
|
135
136
|
}):Subscribe(function(state)
|
|
136
137
|
local syncMaid = Maid.new()
|
|
137
138
|
|
|
138
139
|
if state.doSyncSoundPlayback then
|
|
139
140
|
if state.bpm then
|
|
140
|
-
local bps = state.bpm/60
|
|
141
|
-
local beatTime = 1/bps
|
|
142
|
-
local truncatedTimeLength = math.floor(state.timeLength/beatTime) * beatTime
|
|
141
|
+
local bps = state.bpm / 60
|
|
142
|
+
local beatTime = 1 / bps
|
|
143
|
+
local truncatedTimeLength = math.floor(state.timeLength / beatTime) * beatTime
|
|
143
144
|
local currentTimePosition = soundPlayer.Sound.TimePosition
|
|
144
145
|
local clockDistanceIntoBeat = os.clock() % beatTime
|
|
145
146
|
local soundDistanceIntoBeat = currentTimePosition % beatTime
|
|
@@ -168,7 +169,7 @@ function LoopedSoundPlayer:_renderSoundPlayer(soundId)
|
|
|
168
169
|
end))
|
|
169
170
|
|
|
170
171
|
maid:GiveTask(Rx.combineLatestDefer({
|
|
171
|
-
loopSchedule = self._currentLoopSchedule:Observe()
|
|
172
|
+
loopSchedule = self._currentLoopSchedule:Observe(),
|
|
172
173
|
}):Subscribe(function(state)
|
|
173
174
|
local scheduleMaid = Maid.new()
|
|
174
175
|
|
|
@@ -194,10 +195,10 @@ function LoopedSoundPlayer:_renderSoundPlayer(soundId)
|
|
|
194
195
|
end))
|
|
195
196
|
|
|
196
197
|
maid:GiveTask(Rx.combineLatest({
|
|
197
|
-
visible = self:ObserveRenderStepped()
|
|
198
|
-
multiplier = self._volumeMultiplier:Observe()
|
|
198
|
+
visible = self:ObserveRenderStepped(),
|
|
199
|
+
multiplier = self._volumeMultiplier:Observe(),
|
|
199
200
|
}):Subscribe(function(state)
|
|
200
|
-
soundPlayer:SetVolumeMultiplier(state.multiplier*state.visible)
|
|
201
|
+
soundPlayer:SetVolumeMultiplier(state.multiplier * state.visible)
|
|
201
202
|
end))
|
|
202
203
|
|
|
203
204
|
maid:GiveTask(self:ObserveVisible():Subscribe(function(isVisible, doNotAnimate)
|
|
@@ -213,10 +214,6 @@ function LoopedSoundPlayer:_renderSoundPlayer(soundId)
|
|
|
213
214
|
return maid
|
|
214
215
|
end
|
|
215
216
|
|
|
216
|
-
function LoopedSoundPlayer:SetVolumeMultiplier(volume)
|
|
217
|
-
self._volumeMultiplier.Value = volume
|
|
218
|
-
end
|
|
219
|
-
|
|
220
217
|
function LoopedSoundPlayer:_setupLoopScheduling(soundPlayer, loopSchedule)
|
|
221
218
|
local maid = Maid.new()
|
|
222
219
|
|
|
@@ -331,16 +328,16 @@ function LoopedSoundPlayer:_scheduleFirstPlay(loopSchedule, callback)
|
|
|
331
328
|
end
|
|
332
329
|
|
|
333
330
|
return self:_observeActiveSoundFinishLoop(waitTime)
|
|
334
|
-
end)
|
|
335
|
-
})
|
|
331
|
+
end),
|
|
332
|
+
})
|
|
336
333
|
end
|
|
337
334
|
|
|
338
335
|
if loopSchedule.initialDelay then
|
|
339
336
|
observable = observable:Pipe({
|
|
340
337
|
Rx.switchMap(function()
|
|
341
338
|
return Rx.delayed(SoundLoopScheduleUtils.getWaitTimeSeconds(loopSchedule.initialDelay))
|
|
342
|
-
end)
|
|
343
|
-
})
|
|
339
|
+
end),
|
|
340
|
+
})
|
|
344
341
|
end
|
|
345
342
|
|
|
346
343
|
-- Immediate
|