decord/source/modules/guild_rooms/GuildRoomSpatialAudio.tsx

94 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 16129
// Function ID: 124976
2026-07-20 16:05:17 +00:00
// Name: getSpatialAudioPointFromGuildRoomPosition
2026-07-27 11:26:19 +00:00
// Dependencies: [1194, 16119, 16124, 16125, 566, 16120, 2]
2026-07-20 16:05:17 +00:00
// Exports: livingRoomWorldPointToMediaEnginePoint, useGuildRoomSpatialAudio
2026-07-27 11:26:19 +00:00
// Module 16129 (getSpatialAudioPointFromGuildRoomPosition)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_4 from "_isNativeReflectConstruct";
2026-07-24 07:16:23 +00:00
import getName from "getName";
2026-07-23 10:11:24 +00:00
let closure_5;
let closure_6;
const require = arg1;
2026-07-22 07:54:56 +00:00
function getSpatialAudioPointFromGuildRoomPosition(arg0, arg1, aspectRatio) {
2026-07-20 16:05:17 +00:00
let point = arg1;
if (null == arg1) {
point = closure_7;
}
2026-07-22 07:54:56 +00:00
const obj = { worldX: (arg0.x - point.x) / 100 * aspectRatio.aspectRatio * 8, worldY: 0, worldZ: 8 * ((arg0.y - point.y) / 100) };
2026-07-20 16:05:17 +00:00
return obj;
}
2026-07-24 07:16:23 +00:00
function computeLivingRoomWorldPoints(channelId) {
2026-07-20 16:05:17 +00:00
let currentUserId;
let users;
2026-07-24 07:16:23 +00:00
({ users, currentUserId } = channelId);
2026-07-23 10:11:24 +00:00
let c1;
let aspectRatio;
2026-07-20 16:05:17 +00:00
const value = users.get(currentUserId);
let position;
if (null != value) {
position = value.position;
}
let tmp3 = null;
if (null != position) {
tmp3 = position;
}
2026-07-23 10:11:24 +00:00
c1 = tmp3;
2026-07-24 07:16:23 +00:00
room = room.getRoom(channelId.channelId);
let background;
if (null != room) {
background = room.background;
}
if (null == background) {
background = currentUserId(aspectRatio[3]).GuildRoomBackgrounds.DEFAULT;
}
aspectRatio = table[background].aspectRatio;
2026-07-23 10:11:24 +00:00
let items = [...users.values()];
2026-07-20 16:05:17 +00:00
const found = items.filter((userId) => userId.userId !== currentUserId);
return Object.fromEntries(found.map((userId) => {
2026-07-23 10:11:24 +00:00
const items = [userId.userId, outer1_8(userId.position, c1, { aspectRatio })];
2026-07-20 16:05:17 +00:00
return items;
}));
}
2026-07-24 07:16:23 +00:00
({ GUILD_ROOM_BACKGROUND_CONFIG: closure_5, GUILD_ROOM_SPATIAL_AUDIO_MODE: closure_6 } = getName);
2026-07-23 10:11:24 +00:00
let closure_7 = { x: 50, y: 50 };
2026-07-24 07:16:23 +00:00
const result = require("getName").fileFinishedImporting("modules/guild_rooms/GuildRoomSpatialAudio.tsx");
2026-07-20 16:05:17 +00:00
export { computeLivingRoomWorldPoints };
export const livingRoomWorldPointToMediaEnginePoint = function livingRoomWorldPointToMediaEnginePoint(worldX) {
return { x: worldX.worldX, y: worldX.worldY, z: worldX.worldZ };
};
export const useGuildRoomSpatialAudio = function useGuildRoomSpatialAudio(channelId) {
channelId = channelId.channelId;
2026-07-22 07:54:56 +00:00
const guildId = channelId.guildId;
let dependencyMap;
2026-07-23 10:11:24 +00:00
let obj = channelId(566);
const items = [_isNativeReflectConstruct];
const stateFromStores = obj.useStateFromStores(items, () => outer1_3.getId());
2026-07-27 11:26:19 +00:00
let interactionsEnabled = stateFromStores(16120).useExperiment({ guildId, location: "SpatialAudioPanel" }).interactionsEnabled;
2026-07-24 07:16:23 +00:00
if (interactionsEnabled) {
interactionsEnabled = null != guildId;
2026-07-20 16:05:17 +00:00
}
2026-07-24 07:16:23 +00:00
let tmp3 = interactionsEnabled;
if (interactionsEnabled) {
2026-07-20 16:05:17 +00:00
tmp3 = channelId.mode === closure_6;
}
2026-07-22 07:54:56 +00:00
dependencyMap = tmp3;
2026-07-24 07:16:23 +00:00
obj = { available: interactionsEnabled };
2026-07-27 11:26:19 +00:00
const obj2 = stateFromStores(16120);
2026-07-20 16:05:17 +00:00
const items1 = [closure_4];
2026-07-22 07:54:56 +00:00
const items2 = [tmp3, channelId, stateFromStores];
2026-07-23 10:11:24 +00:00
obj.worldPoints = channelId(566).useStateFromStores(items1, () => {
if (c2) {
2026-07-20 16:05:17 +00:00
if (null != channelId) {
2026-07-24 07:16:23 +00:00
const obj = { users: outer1_4.getRoomUsers(channelId), currentUserId: stateFromStores, channelId };
2026-07-23 10:11:24 +00:00
outer1_9(obj);
2026-07-20 16:05:17 +00:00
}
return {};
}
}, items2);
return obj;
};