Fixing imports and resolutions
This commit is contained in:
@@ -16,25 +16,27 @@ const log = new DebugBuilder("client-bot", "audioController");
|
||||
* @param deviceId The ID of the device being queried
|
||||
* @returns {unknown}
|
||||
*/
|
||||
exports.confirmAudioDevice = async function confirmAudioDevice({deviceName = undefined, deviceId = undefined}){
|
||||
async function confirmAudioDevice({deviceName = undefined, deviceId = undefined}){
|
||||
const deviceList = await getAudioDevices();
|
||||
if (!deviceName && !deviceId) throw new Error("No device given");
|
||||
if (deviceId) return deviceList.find(device => device.id === deviceId);
|
||||
if (deviceName) return deviceList.find(device => device.name === deviceName);
|
||||
}
|
||||
exports.confirmAudioDevice = confirmAudioDevice;
|
||||
|
||||
/**
|
||||
* Return a list of the audio devices connected with input channels
|
||||
*
|
||||
* @returns {unknown[]}
|
||||
*/
|
||||
exports.getAudioDevices = async function getAudioDevices(){
|
||||
async function getAudioDevices(){
|
||||
// Exec output contains both stderr and stdout outputs
|
||||
const deviceList = await returnAlsaDeviceObject();
|
||||
log.DEBUG("Device list: ", deviceList);
|
||||
|
||||
return deviceList;
|
||||
}
|
||||
exports.getAudioDevices = getAudioDevices;
|
||||
|
||||
/**
|
||||
* Create and return the audio instance from the saved settings
|
||||
@@ -42,8 +44,8 @@ exports.getAudioDevices = async function getAudioDevices(){
|
||||
*
|
||||
* @returns new portAudio.AudioIO
|
||||
*/
|
||||
exports.createAudioInstance = async function createAudioInstance() {
|
||||
const selectedDevice = await this.confirmAudioDevice({deviceId: getDeviceID()});//{deviceName: "VoiceMeeter VAIO3 Output (VB-Au"});
|
||||
async function createAudioInstance() {
|
||||
const selectedDevice = await confirmAudioDevice({deviceId: getDeviceID()});//{deviceName: "VoiceMeeter VAIO3 Output (VB-Au"});
|
||||
log.DEBUG("Device selected from config: ", selectedDevice);
|
||||
// Create an instance of AudioIO with outOptions (defaults are as below), which will return a WritableStream
|
||||
return new alsaInstance({
|
||||
@@ -55,4 +57,5 @@ exports.createAudioInstance = async function createAudioInstance() {
|
||||
periodTime: undefined,
|
||||
// highwaterMark: 3840
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.createAudioInstance = createAudioInstance;
|
||||
@@ -6,7 +6,8 @@ const { readFileSync } = require('fs');
|
||||
const path = require("path");
|
||||
|
||||
function getConfig() {
|
||||
return JSON.parse(readFileSync(path.resolve("../config/botConfig.json")));
|
||||
const botConfigObj = JSON.parse(readFileSync(path.resolve("./config/botConfig.json")))
|
||||
return botConfigObj;
|
||||
}
|
||||
exports.getConfig = getConfig;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user