Musique/node_modules/@discordjs/voice/dist/index.mjs.map

8 lines
153 KiB
Text
Raw Permalink Normal View History

{
"version": 3,
"sources": ["../src/DataStore.ts", "../src/networking/Networking.ts", "../src/networking/VoiceUDPSocket.ts", "../src/networking/VoiceWebSocket.ts", "../src/util/Secretbox.ts", "../src/util/util.ts", "../src/VoiceConnection.ts", "../src/receive/VoiceReceiver.ts", "../src/receive/AudioReceiveStream.ts", "../src/audio/AudioPlayerError.ts", "../src/audio/PlayerSubscription.ts", "../src/audio/AudioPlayer.ts", "../src/receive/SpeakingMap.ts", "../src/receive/SSRCMap.ts", "../src/joinVoiceChannel.ts", "../src/audio/TransformerGraph.ts", "../src/audio/AudioResource.ts", "../src/util/generateDependencyReport.ts", "../src/util/abortAfter.ts", "../src/util/entersState.ts", "../src/util/demuxProbe.ts"],
"sourcesContent": ["import { GatewayOpcodes } from 'discord-api-types/v9';\nimport type { AudioPlayer } from './audio';\nimport type { VoiceConnection } from './VoiceConnection';\n\nexport interface JoinConfig {\n\tguildId: string;\n\tchannelId: string | null;\n\tselfDeaf: boolean;\n\tselfMute: boolean;\n\tgroup: string;\n}\n\n/**\n * Sends a voice state update to the main websocket shard of a guild, to indicate joining/leaving/moving across\n * voice channels.\n *\n * @param config - The configuration to use when joining the voice channel\n */\nexport function createJoinVoiceChannelPayload(config: JoinConfig) {\n\treturn {\n\t\top: GatewayOpcodes.VoiceStateUpdate,\n\t\td: {\n\t\t\tguild_id: config.guildId,\n\t\t\tchannel_id: config.channelId,\n\t\t\tself_deaf: config.selfDeaf,\n\t\t\tself_mute: config.selfMute,\n\t\t},\n\t};\n}\n\n// Voice Connections\nconst groups = new Map<string, Map<string, VoiceConnection>>();\ngroups.set('default', new Map());\n\nfunction getOrCreateGroup(group: string) {\n\tconst existing = groups.get(group);\n\tif (existing) return existing;\n\tconst map = new Map<string, VoiceConnection>();\n\tgroups.set(group, map);\n\treturn map;\n}\n\n/**\n * Retrieves the map of group names to maps of voice connections. By default, all voice connections\n * are created under the 'default' group.\n *\n * @returns The group map\n */\nexport function getGroups() {\n\treturn groups;\n}\n\n/**\n * Retrieves all the voice connections under the 'default' group.\n *\n * @param group - The group to look up\n *\n * @returns The map of voice connections\n */\nexport function getVoiceConnections(group?: 'default'): Map<string, VoiceConnection>;\n\n/**\n * Retrieves all the voice connections under the given group name.\n *\n * @param group - The group to look up\n *\n * @returns The map of voice connections\n */\nexport function getVoiceConnections(group: string): Map<string, VoiceConnection> | undefined;\n\n/**\n * Retrieves all the voice connections under the given group name. Defaults to the 'default' group.\n *\n * @param group - The group to look up\n *\n * @returns The map of voice connections\n */\nexport function getVoiceConnections(group = 'default') {\n\treturn groups.get(group);\n}\n\n/**\n * Finds a voice connection with the given guild id and group. Defaults to the 'default' group.\n *\n * @param guildId - The guild id of the voice connection\n * @param group - the group that the voice connection was registered with\n *\n * @returns The voice connection, if it exists\n */\nexport function getVoiceConnection(guildId: string, group = 'default') {\n\treturn getVoiceConnections(group)?.get(guildId);\n}\n\nexport function untrackVoiceConnection(voiceConnection: VoiceConnection) {\n\treturn getVoiceConnections(voiceConnection.joinConfig.group)?.delete(voiceConnection.joinConfig.guildId);\n}\n\nexport function trackVoiceConnection(voiceConnection: VoiceConnection) {\n\treturn getOrCreateGroup(voiceConnection.joinConfig.group).set(voiceConnection.joinConfig.guildId, voiceConnection);\n}\n\n// Audio Players\n\n// Each audio packet is 20ms long\nconst FRAME_LENGTH = 20;\n\nlet audioCycleInterval: NodeJS.Timeout | undefined;\nlet nextTime = -1;\n\n/**\n * A list of created audio players that are still active and haven't been destroyed.\n */\nconst audioPlayers: AudioPlayer[] = [];\n\n/**\n * Called roughly every 20 milliseconds. Dispatches audio from all players, and then gets the players to prepare\n * the next audio frame.\n */\nfunction audioCycleStep() {\n\tif (nextTime === -1) return;\n\n\tnextTime += FRAME_LENGTH;\n\tconst available = audioPlayers.filter((player) => player.checkPlayable());\n\n\t// eslint-disable-next-line @typescript-eslint/dot-notation\n\tavailable.forEach((player) => player['_stepDispatch']());\n\n\tprepareNextAudioFrame(available);\n}\n\n/**\n * Recursively gets the players that have been passed as parameters to prepare audio frames that can be played\n * at the start of the next cycle.\n */\nfunction prepareNextAudioFrame(players: AudioPlayer[]) {\n\tconst nextPlayer = players.shift();\n
"mappings": "kiFAAA,uDAkBO,WAAuC,EAAoB,CACjE,MAAO,CACN,GAAI,GAAe,iBACnB,EAAG,CACF,SAAU,EAAO,QACjB,WAAY,EAAO,UACnB,UAAW,EAAO,SAClB,UAAW,EAAO,WAMrB,GAAM,GAAS,GAAI,KACnB,EAAO,IAAI,UAAW,GAAI,MAE1B,YAA0B,EAAe,CACxC,GAAM,GAAW,EAAO,IAAI,GAC5B,GAAI,EAAU,MAAO,GACrB,GAAM,GAAM,GAAI,KAChB,SAAO,IAAI,EAAO,GACX,EASD,aAAqB,CAC3B,MAAO,GA4BD,WAA6B,EAAQ,UAAW,CACtD,MAAO,GAAO,IAAI,GAWZ,WAA4B,EAAiB,EAAQ,UAAW,CACtE,MAAO,GAAoB,IAAQ,IAAI,GAGjC,YAAgC,EAAkC,CACxE,MAAO,GAAoB,EAAgB,WAAW,QAAQ,OAAO,EAAgB,WAAW,SAG1F,YAA8B,EAAkC,CACtE,MAAO,IAAiB,EAAgB,WAAW,OAAO,IAAI,EAAgB,WAAW,QAAS,GAMnG,GAAM,IAAe,GAEjB,EACA,EAAW,GAKT,EAA8B,GAMpC,aAA0B,CACzB,GAAI,IAAa,GAAI,OAErB,GAAY,GACZ,GAAM,GAAY,EAAa,OAAO,AAAC,GAAW,EAAO,iBAGzD,EAAU,QAAQ,AAAC,GAAW,EAAO,iBAErC,GAAsB,GAOvB,YAA+B,EAAwB,CACtD,GAAM,GAAa,EAAQ,QAE3B,GAAI,CAAC,EAAY,CAChB,AAAI,IAAa,IAChB,GAAqB,WAAW,IAAM,KAAkB,EAAW,KAAK,QAEzE,OAID,EAAW,eAGX,aAAa,IAAM,GAAsB,IAUnC,YAAwB,EAAqB,CACnD,MAAO,GAAa,SAAS,GAQ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