[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 382
  • Last Modified:

Sound card device ID

Hi

i am using low level routines like waveOutOpen to play wave files to a device.

How do i get the device ID for my sound card? i suspect the information is stored somewhere in the registry?

Regards
KEith
0
keithcsl
Asked:
keithcsl
  • 4
  • 3
1 Solution
 
NickRepinCommented:
You should use waveOutGetNumDevs()
Details a few mins later
0
 
NickRepinCommented:
nDev=waveOutGetNumDevs() returns number of audio device installed.
Eg nDev==0 - no devices (sound card) at all
   nDev==1 - one device, deviceId=0
   nDev==2 - two devices, deviceId=0,1

You can use any device ID from 0 to nDev-1.
On the most PC there is only one card, so nDev==1 and you should use 0 as device Id.

Also it may be better to use WAVE_MAPPER instead of device id in waveOutOpen(). In this case the system automatically chooses the best device to play your audio format.
0
 
keithcslAuthor Commented:
NickRepin

i already knwo how to get the list of devices. my problem is that i have got 4 of them:

Game port
Voice Modem #00 Line
Voice Modem #00 Handset
ESS Sound Card

I want to play wave files to the sound card AND the modem, so i need to distinguish between them. i can get the phone device ID by lineGetID (a tapi function) but i don't know how to get the device ID for the sound card.....

Regards
Keith
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
NickRepinCommented:
In general, as I know, you cannot distinguish between modem and sound card. They are equally appear to the wave API as waveOut devices. The best way is to let the user to choose the device.

But, if you work with some (known) set of modems and sound cards, you may use waveOutGetDevCaps and check appropriate fields of the WAVEOUTCAPS struct (eg, manufacturer and product id). Or check szPname string.


0
 
keithcslAuthor Commented:
NickRepin

How do i get the sound card's name from the registry? since i have already gotten the name from my tapi call, i can just compare the name with that of the registry.

Regards
Keith
0
 
NickRepinCommented:
What's for?
You can obtain names from waveOutGetDevCaps(), WAVEOUTCAPS.szPname. It much more easy and reliable.

If you are not satisfied with my answer, you can just reject it. I have nothing more to add.
0
 
keithcslAuthor Commented:
thanks

i am using waveOutGetDevCaps(), WAVEOUTCAPS.szPname to get the name AND get the name from the registry. i have compared the two and made sure that they match. it works fine

Keith
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now