C++/VB - just starting out with DirectSound in MFC/C++ 6.0

Asked By SteveR
21-Oct-07 08:34 PM
In getting set up for my first test with DirectSound, attempting to follow
the DirectSound documentation, I have the following:

In my project settings:

Additional include directories:  C:\Program Files\Microsoft DirectX SDK
(August 2007)\Include
Additional library path:  C:\Program Files\Microsoft DirectX SDK (August
2007)\Lib\x86
(Should I be using x64? Not that it makes a difference in the errors I'm
getting.)
Object/library modules:  dsound.lib
Preprocessor definitions:  INITGUID, etc.

In my view:


I am getting many errors such as:

c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(230) :
error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(230) :
error C2501: 'LPCWAVEFORMATEX' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(305) :
error C2146: syntax error : missing ';' before identifier 'dwReserved1'
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(305) :
error C2501: 'DWORD_PTR' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(305) :
error C2501: 'dwReserved1' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(306) :
error C2146: syntax error : missing ';' before identifier 'dwReserved2'
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(306) :
error C2501: 'DWORD_PTR' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(306) :
error C2501: 'dwReserved2' : missing storage-class or type specifiers

I would appreciate help with this problem. Seems like I should know what it
is.

Steve R
XNA Game Studio
(1)
Windows XP
(1)
Windows Vista
(1)
Visual Studio
(1)
Vista
(1)
X64
(1)
DirectSound
(1)
DirectShow
(1)
  SteveR replied...
22-Oct-07 02:10 AM
I am now including mmsystem.h before dsound.h, and am down to six errors.
What am I missing?

c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(305) :
error C2146: syntax error : missing ';' before identifier 'dwReserved1'
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(305) :
error C2501: 'DWORD_PTR' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(305) :
error C2501: 'dwReserved1' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(306) :
error C2146: syntax error : missing ';' before identifier 'dwReserved2'
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(306) :
error C2501: 'DWORD_PTR' : missing storage-class or type specifiers
c:\program files\microsoft directx sdk (august 2007)\include\dsound.h(306) :
error C2501: 'dwReserved2' : missing storage-class or type specifiers
---------------
  SteveR replied...
22-Oct-07 03:54 AM
Apparently I am dealing with an issue related to needing a more recent
basetsd.h and possibly platform sdk, but I do not want to get myself in
trouble with a mismatch of older and newer components. Thanks for any help!
----------
  Chris P. replied...
22-Oct-07 02:33 PM
Just make sure windows.h or afx.h is included before the DirectSound
includes so that you get definitions for things like DWORD and DWORD_PTR.

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
  SteveR replied...
22-Oct-07 08:50 PM
Thank you, Chris.  DWORD_PTR is not found in my windows.h (Copyright (c)
1985-1997).  But when I #define DWORD_PTR DWORD myself, the errors
disappear.
-------------------
  Chris P. replied...
23-Oct-07 10:48 AM
This is because you are using the old, old, old version of VC :)  I would
expect to find a few more minor issues appear as you go along as they only
test the current DirectX SDK builds with Vista Platform SDK and VS 2005.

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
  SteveR replied...
24-Oct-07 10:48 AM
Well, I guess you will be hearing from me again on this subject, but I am very
encouraged that you have used the word "minor."  Can't say how much I
appreciate all the past assistance!
-----------
  Chuck Walbourn [MSFT] replied...
31-Oct-07 02:45 PM
You might consider just getting Visual Studio Express 2005 as that version
of the compiler is fully suported and is free/inexpensive. That combined
with the latest DirectX SDK and Windows SDK for Windows Vista and you'll be
set.

Continuing to work with a compiler three and soon to be four major versions
and ten years old is probably going to cause more than 'minor' problems.

That said, also remember that DirectSound is itself rather dated. XAudio 2
is still in Beta in the current DirectX SDK, but will be final in the next
few months.

--
Chuck Walbourn
SDE, XNA Developer Connection

This posting is provided "AS IS" with no warranties, and confers no rights.
  Mark Salsbery [MVP] replied...
31-Oct-07 03:08 PM
Hi Chuck,

So what should C++ programmers be using for audio in products currently
being developed?
Is XNA going to work on pre-Vista OSs?
Does XNA provide the same low-latency capabilities as DirectSound?

Thanks!
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
  Chuck Walbourn [MSFT] replied...
31-Oct-07 06:21 PM
It depends on the product. If you are writing a game, XACT or some 3rd party
solution is probably the easiest. If you are writing your own mixer/rate
conversation low-level audio layer, then you want to use WSAPI to output on
Windows Vista and DirectSound on Windows XP. If you want a low-level audio
layer that supports mixing, SRC, and effects processing, then XAudio 2 is an
excellent choice.


and Windows Vista. The XNA Game Studio Express product uses XACT as it's
official audio solution.

If you mean "XAudio 2", it works on Xbox 360, Windows XP, and Windows Vista.
All versions of Windows prior to XP SP 2 are no longer support for
Microsoft, so we don't support them for newer game technologies.


Again "XNA" is a brand that includes the XNA Game Studio, the DirectX SDK,
the Xbox 360 XDK, and other services. If you mean "XAudio 2", then it is the
low-latency low-level game audio solution going forward. DirectSound remains
supported in Windows Vista for compatability, but XAudio 2 uses WSAPI for
output on Vista to reduce latency.

--
Chuck Walbourn
SDE, XNA Developer Connection

This posting is provided "AS IS" with no warranties, and confers no rights.
  Mark Salsbery [MVP] replied...
31-Oct-07 08:06 PM
Excellent!  I saw XACT before and it was not what I was looking for.

I had not seen XAudio 2 though.

Thank you!
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
help
0f, &mesh, NULL); Win32 DirectX Graphics Discussions D3DXMatrixLookAtLH (1) D3DXMatrixRotationY (1) D3DXCreateCylinder (1) OnD3D9FrameRender (1) XP (1) IDirect3DDevice9 (1) DrawIndexedPrimitive (1) UnlockVertexBuffer (1) [Please do not mail me a copy of M, T1836%T<FEX5')A;G-L871I;VXH)FUA = % = O<FQD+#$P+C!F+# N, &8L, "XP M9BD[#0H)<&0S9$1E = FEC92T^4V5T5')A;G-F;W)M*"!$, T144U]73U), 1"PF C P, # P, #LL"B @.38N, S Y.38W.RTW, 2XR, 3<W, 3([ M, "XP, # P, # [+ H@("TY-BXS, #DY-C<[-S$N, C$W-S$R.S N, # P Y, 3$W.RP*(" M M.38N, S Y.38W.RTW, 2XR, 3<W, 3([, "XP, # P, # [+ H@(#DV+C, P.3DV-SLM M-S$N, C$W-S$R.S CLP+C P, # P, #LL"B @+3DV+C, P.3DV-SLW, 2XR, 3<W, 3([, "XP, # P M, # [+ H@("TY-BXS, #DY-C<[-S$N, C$W-S$R.S$Q C0S.3$Q-SLL"B @+3DV+C, P.3DV-SLW M, 2XR, 3<W, 3([, "XP, # P, # [+ H@("TY-BXS, #DY-C<[+3<Q+C(Q-S<Q, CLQ M, 3 3@L, "PQ.3LL"B @, SLQ.2PV+#$X.SL*"B @ M365S:$YO<FUA;', @('L*(" @-CL*(" @, "XP, # P, # [, "XP, # P, # [+3$N M, # P, # P.RP*(" @, "XP, # P, # [, "XP, # P, # [, 2XP, # P, # [+ H@(" P
with an applications consisting of mixed native and managed code writted in C++ / CLI in Visual Studio 2005. The application runs fine in "Debug mode", however when I compile the application in around a native class. I can also see the following in the output window of Visual Studio 2008: '3DWorkbench.exe' (Managed): Loaded 'c: \ svn \ auto3d \ 3dworkbench \ release \ GcpsDotNetApi.dll', Symbols loaded. First Measurement Systems and Data Analysis SINTEF ICT [http: / / www.sintef.com / omd] VC Language Discussions Visual Studio 2008 (1) Visual Studio 2005 (1) DllMainCRTStartup (1) RtlpNtMakeTemporaryKey (1) RtlInitializeSListHead (1) CrtIsValidHeapPointer (1) VB (1) GcpsDotNetApi (1) When
my own string.h C++ / VB Hi, I'm having a weird problem when using Visual Studio. I'm creating a small library with different utility classes. Thing is that everything compiles a string.h / string.cpp files, I get the following errors: * ** \ microsoft platform sdk for windows server 2003 r2 \ include \ guiddef.h(161) : error C3861: 'memcmp': identifier not found \ microsoft platform sdk for windows server 2003 r2 \ include \ stralign.h(101) : error C3861: 'wcscpy': identifier not found * ** Also, if far more errors (please note that 100+ errors are displayed) * ** 1> c: \ program files \ microsoft visual studio 8 \ vc \ include \ cstring(18) : error C2039: 'memchr' : is not a member of '`global namespace'' 1> c: \ program files \ microsoft visual studio 8 \ vc \ include \ cstring(18) : error C2873: 'memchr' : symbol cannot be used in a using
simple .dll question (i hope) C++ / VB Hi, I have installed a fresh XP Pro 32bit OS and ran my c++ program that I compiled on another PC (which runs fine). When I run it on my new install of XP I get: This Application has failed to start because d3dx9d_36.dll was not found. I have looked in windows \ system32 and its not there :( 1: why is my program even looking for this file my program may need? Thanks for any help in this matter. Win32 DirectX Graphics Discussions Windows XP (1) Windows Server 2003 (1) Windows Server 2008 (1) Windows Vista (1) Visual Studio (1) D3DXCreateFontA (1) XP (1) DLLs (1) Your C++ program has
Directx 9c wont work on Vista 64 bit? C++ / VB Not sure where the proper place for this question is? I have an app using Directx 9c. Runs fine on windows 98 through Vista 32 bit. On Vista 64 bit I cant seem to ref the direct3d.dll etc. I get an error distribute (i distribute the directx runtime and my setup runs it to install). I use Visual Studio 2005, .net 2 framwork, vb.net. When I run the source on the Vista 64 ultimat (amd 64 bit chip) I see the error. Says not valid 32 bit app when it loads the form ref with the directx stuff. I compile on an XP 32 system. Thanks, Tom Win32 DirectX Graphics Discussions Visual Studio 2005 (1) Windows Vista (1