Solved

Sound card device ID

Posted on 1998-12-07
7
357 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 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