Hello
I have a problem enumerating soundcards in DirectSound.
I get the strings and guids of the soundcards but when I try open it with the DirectSoundCreate function, I get an error. (DSERR_NODRIVER)
lea esi,SoundCardGuids
mov eax,SoundCardNr
shl eax,4
add eax,esi
invoke DirectSoundCreate,eax,addr g_pDS,NULL
Who can tell me to do it the right way ?
Here are the sources:
[attachment deleted by admin]
Have you tried with NULL instead of the enumerated GUID to check if it works?
DirectSoundCreate can fail IF another application is using the sound device and in this case you must ask the user to close that application and/or continue your application with no sound.
Yes I did
invoke DirectSoundCreate,NULL,addr g_pDS,NULL ; open default device
I bought a second sound device, till now I never bothered to enumerate the devices because I allways used the default device.
Solved !!!!!
Thanks to farrier
My approach was wrong.......
Here's the working version
[attachment deleted by admin]
:U
very cool!c:\china>\masm32\bin\rc.exe EnumSoundcards.rc
EnumSoundcards.rc (15): warning RC2182 : duplicate dialog control ID 10
c:\china>\masm32\bin\ml.exe /c /coff EnumSoundcards.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: EnumSoundcards.asm
c:\china>\masm32\bin\link.exe /subsystem:windows EnumSoundcards.res EnumSoundcards.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
LINK : warning LNK4068: /MACHINE not specified; defaulting to IX86
c:\china>
Hi UtillMasm
code changed, removed duplicate dialog control ID 10 to -1
:U
very cool again!@echo off
\masm32\bin\rc.exe /foEnumSoundcards.res EnumSoundcards.rc
\masm32\bin\ml.exe /c /coff /FoEnumSoundcards.obj /nologo EnumSoundcards.asm
\masm32\bin\link.exe /subsystem:windows EnumSoundcards.obj EnumSoundcards.res /nologo
pause
SoundCards:
Primary Sound Driver
Speakers (Realtek High Definition Audio)
Speakers (VMware VMaudio (VMAUDIO) (WDM))
Realtek Digital Output (Realtek High Definition Audio)
Siekmanski,
Glad I could help!
The code I recommended can be found at:
http://board.flatassembler.net/topic.php?t=6990
Share with us when you get something great put together.
farrier
I vaguely remember there is an older version of this that was released a few years ago or is it that this just has the same look and feel? Still, as always, nice work.
Paul
Hi Paul
Yes, this is the old version I released in 2004.
I used this old source to show my bad enumeration routine.
Your funny. Why do you say 'bad' when it works so well?
Paul
:bg
Yes, now it does....