Files
DRBv3/client/discordAudioBot/dabSettings.mjs
Logan Cusano 7983670c81 #18
- When grabbing the device from the CLI, we now add it to a new var
- We then add new var as the device so we can specify the group
- Updated the default UDP port in the audio device for OP25 config
2024-03-10 00:03:30 -05:00

24 lines
1.1 KiB
JavaScript

import { executeCommand } from '../modules/cliHandler.mjs';
import { extractValue } from '../modules/baseUtils.mjs';
import os from 'os';
// Defaults to Windows values for testing
let device = "VoiceMeeter VAIO3 Output (VB-Audio VoiceMeeter VAIO3)";
let maxTransmissionGap = 500;
let type = "dshow";
// Set Linux values for use in production
if (os.platform() === 'linux') {
await new Promise((res) => {
executeCommand("pactl", ['list', 'short', 'sources']).then(cliOutput => {
const extracted_device_details = extractValue(cliOutput, '(?:\\d(?:\\t|[\\s]{1,9})(?<device>[\\w\\d\\-\\.\\_]+?)(?:\\t|[\\s]{1,9})(?<card>[\\w\\d\\-\\.\\_]+)(?:\\t|[\\s]{1,9})(?:(?<device_type>[\\w\\d\\-\\.\\_]+?) (?<channels>\\dch) (?<frequency>\\d+Hz))(?:\\t|[\\s]{1,9})(?:IDLE|RUNNING|SUSPENDED))')
device = extracted_device_details.groups.device;
console.log("Device:", device);
res();
});
});
type = "pulse"; // Replace with appropriate type for Linux
}
export { device, maxTransmissionGap, type };