decord/source/modules/guild_rooms/GuildRoomSpatialAudio.tsx

95 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 16446
// Function ID: 16447
2026-07-29 08:29:29 +00:00
// Name: computeLivingRoomWorldPoints
2026-08-08 06:10:11 +00:00
// Dependencies: [1218, 16435, 16440, 16441, 589, 16436, 2]
2026-07-20 16:05:17 +00:00
// Exports: livingRoomWorldPointToMediaEnginePoint, useGuildRoomSpatialAudio
2026-08-08 06:10:11 +00:00
// Module 16446 (computeLivingRoomWorldPoints)
2026-07-29 08:29:29 +00:00
import fetchFingerprint from "fetchFingerprint";
import handleSelectedChannelStoreChange from "handleSelectedChannelStoreChange";
2026-07-24 07:16:23 +00:00
import getName from "getName";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c5;
2026-07-23 10:11:24 +00:00
let closure_6;
const require = arg1;
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-29 08:29:29 +00:00
let position;
2026-07-23 10:11:24 +00:00
let aspectRatio;
2026-07-20 16:05:17 +00:00
const value = users.get(currentUserId);
2026-07-29 08:29:29 +00:00
position = undefined;
if (value != null) {
2026-07-20 16:05:17 +00:00
position = value.position;
}
2026-07-29 08:29:29 +00:00
if (position == null) {
position = null;
2026-07-20 16:05:17 +00:00
}
2026-07-24 07:16:23 +00:00
room = room.getRoom(channelId.channelId);
let background;
2026-07-29 08:29:29 +00:00
if (room != null) {
2026-07-24 07:16:23 +00:00
background = room.background;
}
2026-07-29 08:29:29 +00:00
if (background == null) {
2026-07-24 07:16:23 +00:00
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);
2026-07-29 08:29:29 +00:00
return Object.fromEntries(found.map((position) => {
position = position.position;
const items = [position.userId, ];
let point = position;
if (position == null) {
point = outer1_7;
}
items[1] = { worldX: (position.x - point.x) / 100 * aspectRatio * 8, worldY: 0, worldZ: 8 * ((position.y - point.y) / 100) };
2026-07-20 16:05:17 +00:00
return items;
}));
}
2026-07-29 08:29:29 +00:00
({ GUILD_ROOM_BACKGROUND_CONFIG: c5, 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;
2026-07-29 08:29:29 +00:00
let stateFromStores;
2026-07-22 07:54:56 +00:00
let dependencyMap;
2026-07-29 08:29:29 +00:00
let obj = channelId(589);
const items = [fetchFingerprint];
stateFromStores = obj.useStateFromStores(items, () => id.getId());
2026-08-08 06:10:11 +00:00
let interactionsEnabled = stateFromStores(16436).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-29 08:29:29 +00:00
let tmp5 = interactionsEnabled;
2026-07-24 07:16:23 +00:00
if (interactionsEnabled) {
2026-07-29 08:29:29 +00:00
tmp5 = channelId.mode === closure_6;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
dependencyMap = tmp5;
obj = { available: interactionsEnabled, worldPoints: null };
2026-08-08 06:10:11 +00:00
const obj2 = stateFromStores(16436);
2026-07-29 08:29:29 +00:00
const tmp = channelId;
const items1 = [handleSelectedChannelStoreChange];
const items2 = [tmp5, channelId, stateFromStores];
obj[1] = channelId(589).useStateFromStores(items1, () => {
2026-07-23 10:11:24 +00:00
if (c2) {
2026-07-20 16:05:17 +00:00
if (null != channelId) {
2026-07-29 08:29:29 +00:00
const obj = { users: null, currentUserId: null, channelId: null };
obj[0] = outer1_4.getRoomUsers(tmp);
obj[1] = stateFromStores;
obj[2] = tmp;
outer1_8(obj);
2026-07-20 16:05:17 +00:00
}
return {};
}
}, items2);
return obj;
};