Files
DRBv3/client/discordAudioBot/dabSettings.mjs
Logan Cusano 3cb53605c7 Working on #13
- Running the 'pactl' command
- Using regex on the output to find the active running device
2024-03-08 21:58:27 -05:00

23 lines
808 B
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 => {
device = extractValue(cliOutput, '(?:\d[ ]{4,12}(.+?)[ ]{4,12}(?:.+?[ ]{4,12}){2,4}RUNNING)')
console.log("Device:", device);
res();
});
});
type = "pulse"; // Replace with appropriate type for Linux
}
export { device, maxTransmissionGap, type };