?
Solved

Sound card device ID

Posted on 1998-12-07
7
Medium Priority
?
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 150 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

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.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

765 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