C
C#2w ago
Tweaks

Getting audio input/output with comport as Input

I’ve been bashing my head in for the last 2 days trying to get a problem working. I’m trying to get all sound devices connected to a COMport and then play the audio to them, but for some reason the devices you get from ManagementObjectSearcher("SELECT * FROM Win32_SoundDevice") is completely different from what I would get from NAudio or enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active). Has anyone ever worked with anything remotely similar? Because I’ve been getting the Product ID and Vendor ID from the comport and I’m successfully finding it in Win32_SoundDevice, but I cannot for the life of me find anything that matches anything, the name isn’t even the same. It says USB 2.0 DEVICE instead of the actual name That it has in the windows environment
8 Replies
Tweaks
TweaksOP2w ago
here's the methods i'm using so far.
Tweaks
TweaksOP2w ago
BlazeBin - bdtlrvvielqz
A tool for sharing your source code with the world!
Tweaks
TweaksOP2w ago
I'm using these packages: System.Management NAudio NAudio Core
public static void LoadAudioDevices(DataFlow mode, MMDevice selectedDevice = null)
{
// Clear the ComboBox
comboBox.Items.Clear();

// Enumerate audio devices using NAudio
var enumerator = new MMDeviceEnumerator();
var devices = enumerator.EnumerateAudioEndPoints(mode, DeviceState.Active);
}
public static void LoadAudioDevices(DataFlow mode, MMDevice selectedDevice = null)
{
// Clear the ComboBox
comboBox.Items.Clear();

// Enumerate audio devices using NAudio
var enumerator = new MMDeviceEnumerator();
var devices = enumerator.EnumerateAudioEndPoints(mode, DeviceState.Active);
}
i found this, where i can use MMDevice.ID to compare but i'm unsure if i can just compare MMDevice with the comport. Fuck it ima just say fuck you to NAudio
Insire
Insire2w ago
WMI seems to be the wrong tool for this. It doesnt contain anything that resembles a device name you can see in windows as i said in #advanced i recommend simply using NAudio and in there the WASAPI interface
Tweaks
TweaksOP2w ago
Thanks I will check it out i just looked around in the WASAPI interface, and yeah it shows me what i need but there's no way for me to see what comport is connected to which sound device. using WMI i can see what comport it is. but i cannot get a way to refrence it with eachother. does windows just say fuck you to comports and treat them as different ports altogether with zero connections to any other device? or am i going crazy? @Insire
Insire
Insire2w ago
i have no idea. never needed to touch COM anything or even unmanaged code i just stay in the .NET bubble and let others worry about it
Tweaks
TweaksOP7d ago
Holy jesus i got it EUREKA! check the link out for my solution
Tweaks
TweaksOP7d ago
BlazeBin - pugkbnxgqkqs
A tool for sharing your source code with the world!
Want results from more Discord servers?
Add your server