Hi
I want to play a sound using directsound. As you can see i'm stuck already.
#include <dsound.h>
#include <iostream>
using namespace std;
int main(void)
{//CREATE OBJECT
LPDIRECTSOUND8 ppDS8;
HRESULT hr = DirectSoundCreate8(NULL, ppDS8 ,NULL);
cout << hr;
Sleep(2000);
}
I get the following error:
1>.\main.cpp(9) : error C2664: 'DirectSoundCreate8' : cannot convert parameter 2 from 'LPDIRECTSOUND8' to 'LPDIRECTSOUND8 *'
1. What is missing to get it to work?
2. What is the LPDIRECTSOUND8 doing and what use do i have of it?
3. What is returned to ppDS8?
4. Why can't i write DSDEVID_DefaultPlayback instead of NULL in the first parameter? The SDK documentation says i can:
NULL for the default device, OR one of the following values.
http://msdn.microsoft.com/en-us/library/bb219693(VS.85).aspx
5. I want to see what the function returns (hopefully DS_OK), is it going to do so right now? i mean hr is not declared. What type should it be?
If i replace the code with the following i get "1>.\main.cpp(9) : error C2078: too many initializers" error:
#include <dsound.h>
#include <iostream>
using namespace std;
int main(void)
{//CREATE OBJECT
int ppDS8;
HRESULT DirectSoundCreate8(NULL, ppDS8 ,NULL);
Sleep(2000);
}'
Im using vista business, visual c++ 2008 and directX SDK march 2009
Please can someone help me?