News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Enumerating soundcards in DirectSound

Started by Siekmanski, May 26, 2009, 03:02:13 PM

Previous topic - Next topic

Siekmanski

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]

BogdanOntanu

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.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

Siekmanski

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.


Siekmanski

#3
Solved !!!!!

Thanks to farrier
My approach was wrong.......

Here's the working version


[attachment deleted by admin]

UtillMasm

 :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>

Siekmanski

Hi UtillMasm

code changed, removed duplicate dialog control ID 10 to -1

UtillMasm

 :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)

farrier

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
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

Siekmanski

Hi Paul

Yes, this is the old version I released in 2004.
I used this old source to show my bad enumeration routine.

PBrennick

Your funny. Why do you say 'bad' when it works so well?

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Siekmanski