@gamepadly/sdk 0.4.0 → 0.4.1
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/dist/browser.js +16 -8
- package/dist/browser.js.map +2 -2
- package/dist/browser.min.js +1 -1
- package/dist/game/host.d.ts.map +1 -1
- package/dist/game/host.js +12 -4
- package/dist/game/host.js.map +2 -2
- package/dist/game/types.d.ts +6 -1
- package/dist/game/types.d.ts.map +1 -1
- package/dist/game/types.js.map +2 -2
- package/dist/hub.d.ts +7 -0
- package/dist/hub.d.ts.map +1 -1
- package/dist/hub.js +8 -6
- package/dist/hub.js.map +2 -2
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -3201,6 +3201,11 @@ function buildCapabilitySignature(slots, active) {
|
|
|
3201
3201
|
active.hasGyro ? 1 : 0
|
|
3202
3202
|
].join("|");
|
|
3203
3203
|
}
|
|
3204
|
+
function toPcBusSampleOptions(opts) {
|
|
3205
|
+
const route = opts.route ?? "pc";
|
|
3206
|
+
if (route === "pc") return opts;
|
|
3207
|
+
return { ...opts, route: "pc", gain: (opts.gain ?? 0.85) * (route === "speaker" ? 0.45 : 0.5) };
|
|
3208
|
+
}
|
|
3204
3209
|
function createGamepadly(options = {}) {
|
|
3205
3210
|
const ownsHid = !options.hid;
|
|
3206
3211
|
const hid = options.hid ?? new DualSenseControllerManager();
|
|
@@ -3446,11 +3451,7 @@ function createGamepadly(options = {}) {
|
|
|
3446
3451
|
let sinkOpts = opts;
|
|
3447
3452
|
if (route !== "pc" && !ownsControllerAudio) {
|
|
3448
3453
|
if (route === "vcm") return NOOP_SAMPLE_HANDLE;
|
|
3449
|
-
sinkOpts =
|
|
3450
|
-
...opts,
|
|
3451
|
-
route: "pc",
|
|
3452
|
-
gain: (opts.gain ?? 0.85) * (route === "speaker" ? 0.45 : 0.5)
|
|
3453
|
-
};
|
|
3454
|
+
sinkOpts = toPcBusSampleOptions(opts);
|
|
3454
3455
|
}
|
|
3455
3456
|
const rawHandle = sink.playSample(id, sinkOpts);
|
|
3456
3457
|
if (!rawHandle.active) return rawHandle;
|
|
@@ -5491,14 +5492,21 @@ function createGameHost(opts) {
|
|
|
5491
5492
|
playComboPreset: (presetId, pan) => resolveHandle()?.haptics.playComboPreset(presetId, pan),
|
|
5492
5493
|
stop: () => resolveHandle()?.haptics.stop()
|
|
5493
5494
|
},
|
|
5495
|
+
// PC-bus sounds stay audible for an unassigned seat (they don't belong to a controller);
|
|
5496
|
+
// controller outputs (speaker tone, VCM, haptics, triggers, lightbar) stay inert.
|
|
5494
5497
|
audio: {
|
|
5495
|
-
playPcTone: (spec) => resolveHandle()
|
|
5496
|
-
playPcNoise: (o) => resolveHandle()
|
|
5498
|
+
playPcTone: (spec) => (resolveHandle() ?? active).audio.playPcTone(spec),
|
|
5499
|
+
playPcNoise: (o) => (resolveHandle() ?? active).audio.playPcNoise(o),
|
|
5497
5500
|
playControllerSpeakerTone: (spec) => resolveHandle()?.audio.playControllerSpeakerTone(spec),
|
|
5498
5501
|
loadSample: (id, source) => active.audio.loadSample(id, source),
|
|
5499
5502
|
hasSample: (id) => active.audio.hasSample(id),
|
|
5500
5503
|
unloadSample: (id) => active.audio.unloadSample(id),
|
|
5501
|
-
playSample: (id, o
|
|
5504
|
+
playSample: (id, o = {}) => {
|
|
5505
|
+
const h = resolveHandle();
|
|
5506
|
+
if (h) return h.audio.playSample(id, o);
|
|
5507
|
+
if (o.route === "vcm") return NOOP_SAMPLE_HANDLE;
|
|
5508
|
+
return active.audio.playSample(id, toPcBusSampleOptions(o));
|
|
5509
|
+
}
|
|
5502
5510
|
},
|
|
5503
5511
|
lightbar: {
|
|
5504
5512
|
setColor: (r, g, b) => resolveHandle()?.lightbar.setColor(r, g, b),
|