decord/source/modules/guild_rooms/GuildRoomSpatialAudio.tsx

70 lines
2.7 KiB
TypeScript
Raw Normal View History

// Module ID: 17489
// Function ID: 17490
// Name: GuildRoomSpatialAudio
// Dependencies: [502, 4794, 4798, 4799, 504, 4836, 2]
2026-08-25 06:04:03 +00:00
// Exports: computeLivingRoomWorldPoints, livingRoomWorldPointToMediaEnginePoint, useGuildRoomSpatialAudio
2026-07-20 16:05:17 +00:00
// Module 17489 (GuildRoomSpatialAudio)
import initialize from "initialize" /* 504 */;
import GuildRoomsExperiment from "GuildRoomsExperiment" /* 4836 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import GuildRoomStore from "GuildRoomStore" /* 4794 */;
2026-07-23 10:11:24 +00:00
require = fn;
const GuildRoomConstants = fn(4798);
({ GUILD_ROOM_BACKGROUND_CONFIG: closure_4, GUILD_ROOM_SPATIAL_AUDIO_MODE } = GuildRoomConstants);
2026-08-28 06:19:39 +00:00
let c5 = false;
let closure_6 = { x: 50, y: 50 };
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_rooms/GuildRoomSpatialAudio.tsx");
2026-08-25 06:04:03 +00:00
export const GUILD_ROOM_SPATIAL_AUDIO_ENABLED = false;
export const computeLivingRoomWorldPoints = function computeLivingRoomWorldPoints(channelId) {
2026-07-24 07:16:23 +00:00
({ users, currentUserId } = channelId);
2026-07-23 10:11:24 +00:00
let aspectRatio;
value = users.get(currentUserId);
let position;
2026-07-29 08:29:29 +00:00
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
}
const room = GuildRoomStore.getRoom(channelId.channelId);
2026-07-24 07:16:23 +00:00
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-08-28 06:19:39 +00:00
background = currentUserId(position[3]).GuildRoomBackgrounds.DEFAULT;
2026-07-24 07:16:23 +00:00
}
aspectRatio = closure_4[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 = closure_6;
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-25 06:04:03 +00:00
};
2026-07-20 16:05:17 +00:00
export const livingRoomWorldPointToMediaEnginePoint = function livingRoomWorldPointToMediaEnginePoint(worldX) {
const point = { x: worldX.worldX, y: worldX.worldY, z: worldX.worldZ };
return point;
2026-07-20 16:05:17 +00:00
};
2026-08-25 06:04:03 +00:00
export const useGuildRoomSpatialAudio = function useGuildRoomSpatialAudio(arg0) {
({ channelId, guildId } = arg0);
const items = [AuthenticationStore];
const stateFromStores = initialize.useStateFromStores(items, () => id.getId());
const interactionsEnabled = GuildRoomsExperiment.useGuildRoomsExperiment({ guildId, location: "SpatialAudioPanel" }).interactionsEnabled;
const obj3 = { available, worldPoints: null };
const items1 = [GuildRoomStore];
2026-08-25 06:04:03 +00:00
const items2 = [false, channelId, stateFromStores];
obj3.worldPoints = initialize.useStateFromStores(items1, () => ({}), items2);
return obj3;
2026-07-20 16:05:17 +00:00
};