Solved

Sound card device ID

Posted on 1998-12-07
7
352 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
ID: 1416835
You should use waveOutGetNumDevs()
Details a few mins later
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 1416836
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
ID: 1416837
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 15

Expert Comment

by:NickRepin
ID: 1416838
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
ID: 1416839
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
ID: 1416840
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
ID: 1416841
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

786 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