Detect if sound card is present/enabled?

Just starting out? Need help? Post your questions and find answers here.
BarryG
Addict
Addict
Posts: 4123
Joined: Thu Apr 18, 2019 8:17 am

Detect if sound card is present/enabled?

Post by BarryG »

Asking mainly for Windows. Need a way to check if a sound card is present and enabled, because not all users have one (as I recently found out), and if not found or enabled then some sound code can crash my app (like getting the volume and mute status). I tried using InitSound() but Fred said that's not the way.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: Detect if sound card is present/enabled?

Post by RASHAD »

Egypt my love
BarryG
Addict
Addict
Posts: 4123
Joined: Thu Apr 18, 2019 8:17 am

Re: Detect if sound card is present/enabled?

Post by BarryG »

Thanks, but that doesn't work: it just loads the sound and plays it silently. I don't want that; I want it to message me that no sound can be played because there's no audio device enabled on the PC.

This is what Winamp shows when no audio device is available/enabled. I'd love to show something like that.

Image
ZX80
Enthusiast
Enthusiast
Posts: 361
Joined: Mon Dec 12, 2016 1:37 pm

Re: Detect if sound card is present/enabled?

Post by ZX80 »

@BarryG

I suggest you try the following:
enumerate hardware devices

P.S. If the hardware is not present in the system, then this should work and it is obvious.
P.S.2. Also you can use the console utility, known as 'devcon.exe'. Be careful, it has two different version (x86 _n_ x64).
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Detect if sound card is present/enabled?

Post by mk-soft »

Update MediaGetVolume
Link: viewtopic.php?p=640610#p640610
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply