Solved

Sound card device ID

Posted on 1998-12-07
7
346 Views
Last Modified: 2013-12-03
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
Comment
Question by:keithcsl
  • 4
  • 3
7 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 50 total points
Comment Utility
You should use waveOutGetNumDevs()
Details a few mins later
0
 
LVL 15

Expert Comment

by:NickRepin
Comment Utility
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
 
LVL 1

Author Comment

by:keithcsl
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 15

Expert Comment

by:NickRepin
Comment Utility
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
 
LVL 1

Author Comment

by:keithcsl
Comment Utility
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
 
LVL 15

Expert Comment

by:NickRepin
Comment Utility
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
 
LVL 1

Author Comment

by:keithcsl
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now