decord/source/modules/guild_rooms/GuildRoomSpatialAudio.tsx

91 lines
3.1 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 16684
// Function ID: 16685
2026-07-29 08:29:29 +00:00
// Name: computeLivingRoomWorldPoints
2026-08-24 06:08:38 +00:00
// Dependencies: [1218, 9903, 9906, 9907, 589, 9921, 2]
2026-07-20 16:05:17 +00:00
// Exports: livingRoomWorldPointToMediaEnginePoint, useGuildRoomSpatialAudio
2026-08-24 06:08:38 +00:00
// Module 16684 (computeLivingRoomWorldPoints)
import closure_3 from "fetchFingerprint" /* 1218 */;
import closure_4 from "resolveCreatingNotes" /* 9903 */;
import items from "items" /* 9906 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-24 07:16:23 +00:00
function computeLivingRoomWorldPoints(channelId) {
({ 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) {
2026-08-24 06:08:38 +00:00
point = closure_1_7;
2026-07-29 08:29:29 +00:00
}
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-08-24 06:08:38 +00:00
({ GUILD_ROOM_BACKGROUND_CONFIG: c5, GUILD_ROOM_SPATIAL_AUDIO_MODE: closure_6 } = items);
2026-07-23 10:11:24 +00:00
let closure_7 = { x: 50, y: 50 };
2026-08-24 06:08:38 +00:00
const result = require("set").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-08-24 06:08:38 +00:00
dependencyMap = undefined;
2026-07-29 08:29:29 +00:00
let obj = channelId(589);
2026-08-24 06:08:38 +00:00
const items = [closure_3];
2026-07-29 08:29:29 +00:00
stateFromStores = obj.useStateFromStores(items, () => id.getId());
2026-08-24 06:08:38 +00:00
let interactionsEnabled = stateFromStores(9921).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-24 06:08:38 +00:00
const obj2 = stateFromStores(9921);
2026-07-29 08:29:29 +00:00
const tmp = channelId;
2026-08-24 06:08:38 +00:00
const items1 = [closure_4];
2026-07-29 08:29:29 +00:00
const items2 = [tmp5, channelId, stateFromStores];
obj[1] = channelId(589).useStateFromStores(items1, () => {
2026-08-24 06:08:38 +00:00
if (closure_2) {
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 };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_4.getRoomUsers(tmp);
2026-07-29 08:29:29 +00:00
obj[1] = stateFromStores;
obj[2] = tmp;
2026-08-24 06:08:38 +00:00
closure_1_8(obj);
2026-07-20 16:05:17 +00:00
}
return {};
}
}, items2);
return obj;
};