@rbxts/sound-manager 2.3.3 → 2.3.4
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/README.md
CHANGED
|
@@ -86,7 +86,7 @@ local function createSoundCategoryRegistry(definitions)
|
|
|
86
86
|
old:stop()
|
|
87
87
|
old:destroy()
|
|
88
88
|
end
|
|
89
|
-
local handle = createSpatialHandle(instance.SoundId, spatial.emitters, instance.Volume)
|
|
89
|
+
local handle = createSpatialHandle(instance.SoundId, spatial.emitters, instance.Volume, false, 1)
|
|
90
90
|
local _categoryHandles_1 = categoryHandles
|
|
91
91
|
local _name_1 = instance.Name
|
|
92
92
|
_categoryHandles_1[_name_1] = handle
|
|
@@ -51,7 +51,15 @@ local function createSoundRegistry(definitions)
|
|
|
51
51
|
if _condition == nil then
|
|
52
52
|
_condition = 1
|
|
53
53
|
end
|
|
54
|
-
local
|
|
54
|
+
local _condition_1 = config.loop
|
|
55
|
+
if _condition_1 == nil then
|
|
56
|
+
_condition_1 = false
|
|
57
|
+
end
|
|
58
|
+
local _condition_2 = config.playbackSpeed
|
|
59
|
+
if _condition_2 == nil then
|
|
60
|
+
_condition_2 = 1
|
|
61
|
+
end
|
|
62
|
+
local handle = createSpatialHandle(_exp, emittersArray, _condition, _condition_1, _condition_2)
|
|
55
63
|
local _name = name
|
|
56
64
|
spatialHandles[_name] = handle
|
|
57
65
|
return handle
|
|
@@ -81,7 +89,15 @@ local function createSoundRegistry(definitions)
|
|
|
81
89
|
if _condition == nil then
|
|
82
90
|
_condition = 1
|
|
83
91
|
end
|
|
84
|
-
local
|
|
92
|
+
local _condition_1 = config.loop
|
|
93
|
+
if _condition_1 == nil then
|
|
94
|
+
_condition_1 = false
|
|
95
|
+
end
|
|
96
|
+
local _condition_2 = config.playbackSpeed
|
|
97
|
+
if _condition_2 == nil then
|
|
98
|
+
_condition_2 = 1
|
|
99
|
+
end
|
|
100
|
+
local handle = createSpatialHandle(_exp, emittersArray, _condition, _condition_1, _condition_2)
|
|
85
101
|
local _name = name
|
|
86
102
|
spatialHandles[_name] = handle
|
|
87
103
|
handle:play()
|
|
@@ -150,7 +166,15 @@ local function createSoundRegistry(definitions)
|
|
|
150
166
|
if _condition == nil then
|
|
151
167
|
_condition = 1
|
|
152
168
|
end
|
|
153
|
-
local
|
|
169
|
+
local _condition_1 = config.loop
|
|
170
|
+
if _condition_1 == nil then
|
|
171
|
+
_condition_1 = false
|
|
172
|
+
end
|
|
173
|
+
local _condition_2 = config.playbackSpeed
|
|
174
|
+
if _condition_2 == nil then
|
|
175
|
+
_condition_2 = 1
|
|
176
|
+
end
|
|
177
|
+
local handle = createSpatialHandle(_exp, emitterArray, _condition, _condition_1, _condition_2)
|
|
154
178
|
spatialHandles[soundName] = handle
|
|
155
179
|
end
|
|
156
180
|
end
|
|
@@ -177,7 +201,15 @@ local function createSoundRegistry(definitions)
|
|
|
177
201
|
if _condition == nil then
|
|
178
202
|
_condition = 1
|
|
179
203
|
end
|
|
180
|
-
local
|
|
204
|
+
local _condition_1 = config.loop
|
|
205
|
+
if _condition_1 == nil then
|
|
206
|
+
_condition_1 = false
|
|
207
|
+
end
|
|
208
|
+
local _condition_2 = config.playbackSpeed
|
|
209
|
+
if _condition_2 == nil then
|
|
210
|
+
_condition_2 = 1
|
|
211
|
+
end
|
|
212
|
+
local handle = createSpatialHandle(_exp, _exp_1, _condition, _condition_1, _condition_2)
|
|
181
213
|
local _name_1 = name
|
|
182
214
|
spatialHandles[_name_1] = handle
|
|
183
215
|
end
|
|
@@ -217,7 +249,15 @@ local function createSoundRegistry(definitions)
|
|
|
217
249
|
if _condition == nil then
|
|
218
250
|
_condition = 1
|
|
219
251
|
end
|
|
220
|
-
local
|
|
252
|
+
local _condition_1 = config.loop
|
|
253
|
+
if _condition_1 == nil then
|
|
254
|
+
_condition_1 = false
|
|
255
|
+
end
|
|
256
|
+
local _condition_2 = config.playbackSpeed
|
|
257
|
+
if _condition_2 == nil then
|
|
258
|
+
_condition_2 = 1
|
|
259
|
+
end
|
|
260
|
+
local handle = createSpatialHandle(_exp, emittersArray, _condition, _condition_1, _condition_2)
|
|
221
261
|
local _self = handle
|
|
222
262
|
local _result = _self.fadeIn
|
|
223
263
|
if _result ~= nil then
|
|
@@ -274,7 +314,15 @@ local function createSoundRegistry(definitions)
|
|
|
274
314
|
if _condition == nil then
|
|
275
315
|
_condition = 1
|
|
276
316
|
end
|
|
277
|
-
local
|
|
317
|
+
local _condition_1 = config.loop
|
|
318
|
+
if _condition_1 == nil then
|
|
319
|
+
_condition_1 = false
|
|
320
|
+
end
|
|
321
|
+
local _condition_2 = config.playbackSpeed
|
|
322
|
+
if _condition_2 == nil then
|
|
323
|
+
_condition_2 = 1
|
|
324
|
+
end
|
|
325
|
+
local handle = createSpatialHandle(_exp, emittersArray, _condition, _condition_1, _condition_2)
|
|
278
326
|
local _self = handle
|
|
279
327
|
local _result = _self.fadeOut
|
|
280
328
|
if _result ~= nil then
|
|
@@ -403,7 +451,17 @@ local function createSoundRegistry(definitions)
|
|
|
403
451
|
_sound.Volume = volume
|
|
404
452
|
else
|
|
405
453
|
local emittersArray = spatial.emitters
|
|
406
|
-
local
|
|
454
|
+
local _exp = config.id
|
|
455
|
+
local _exp_1 = volume
|
|
456
|
+
local _condition = config.loop
|
|
457
|
+
if _condition == nil then
|
|
458
|
+
_condition = false
|
|
459
|
+
end
|
|
460
|
+
local _condition_1 = config.playbackSpeed
|
|
461
|
+
if _condition_1 == nil then
|
|
462
|
+
_condition_1 = 1
|
|
463
|
+
end
|
|
464
|
+
local handle = createSpatialHandle(_exp, emittersArray, _exp_1, _condition, _condition_1)
|
|
407
465
|
end
|
|
408
466
|
end
|
|
409
467
|
--[[
|
|
@@ -4,4 +4,4 @@ import { SoundHandle } from "./options";
|
|
|
4
4
|
* @param assetId Asset ID
|
|
5
5
|
* @param emitters Emitter
|
|
6
6
|
*/
|
|
7
|
-
export declare function createSpatialHandle(assetId: string, emitters: BasePart[], volume: number): SoundHandle;
|
|
7
|
+
export declare function createSpatialHandle(assetId: string, emitters: BasePart[], volume: number, looped: boolean, playBackSpeed: number): SoundHandle;
|
|
@@ -10,11 +10,13 @@ local fadeOut = _functions.fadeOut
|
|
|
10
10
|
* @param emitters Emitter
|
|
11
11
|
|
|
12
12
|
]]
|
|
13
|
-
local function createSpatialHandle(assetId, emitters, volume)
|
|
13
|
+
local function createSpatialHandle(assetId, emitters, volume, looped, playBackSpeed)
|
|
14
14
|
local player = Instance.new("AudioPlayer")
|
|
15
15
|
player.Asset = assetId
|
|
16
16
|
player.Volume = volume
|
|
17
17
|
player.Parent = game:GetService("ReplicatedStorage")
|
|
18
|
+
player.Looping = looped
|
|
19
|
+
player.PlaybackSpeed = playBackSpeed
|
|
18
20
|
local emitterInstances = {}
|
|
19
21
|
for _, part in emitters do
|
|
20
22
|
local emitter = Instance.new("AudioEmitter")
|
|
@@ -58,6 +60,9 @@ local function createSpatialHandle(assetId, emitters, volume)
|
|
|
58
60
|
setTimePosition = function(self, timeposition)
|
|
59
61
|
player.TimePosition = timeposition
|
|
60
62
|
end,
|
|
63
|
+
setPlayBackSpeed = function(self, playbackspeed)
|
|
64
|
+
player.PlaybackSpeed = playbackspeed
|
|
65
|
+
end,
|
|
61
66
|
}
|
|
62
67
|
end
|
|
63
68
|
return {
|
package/out/core/options.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface SoundOptions {
|
|
2
2
|
volume?: number;
|
|
3
3
|
loop?: boolean;
|
|
4
|
+
playbackSpeed?: number;
|
|
4
5
|
id: string;
|
|
5
6
|
spatial?: {
|
|
6
7
|
attenuation?: number;
|
|
@@ -16,11 +17,13 @@ export interface SoundHandle {
|
|
|
16
17
|
played(callback: () => void): void;
|
|
17
18
|
playing(): boolean;
|
|
18
19
|
setTimePosition(timeposition: number): void;
|
|
20
|
+
setPlayBackSpeed(playbackspeed: number): void;
|
|
19
21
|
}
|
|
20
22
|
interface SoundDefinition {
|
|
21
23
|
id: string;
|
|
22
24
|
volume?: number;
|
|
23
25
|
loop?: boolean;
|
|
26
|
+
playBackSpeed?: number;
|
|
24
27
|
}
|
|
25
28
|
export interface CategoryOptions {
|
|
26
29
|
category: string;
|