Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Densun

what exactly does DSERR_INVALIDPARAM mean?

This topic is 6930 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m getting a DSERR_INVALIDPARAM error handle from CreateSoundBuffer (). Could this mean that some of the variables in DSBUFFERDESC are initialized wrong, or does it mean that I''m passing bad structures?

Share this post


Link to post
Share on other sites
Advertisement
Print for us what your are sending to the function. Usually it''s something easy.

Share this post


Link to post
Share on other sites
Here''s the code that causes the error:

// Theses four variables are what are actually sent to
// the function. I just gave them example values.
unsigned long size = 44100;
unsigned long hz = 22050;
unsigned short channels = 2;
unsigned short bits = 16;

HRESULT hr;
DSBUFFERDESC dsbd;
WAVEFORMATEX wfx;

memset (&dsbd, 0, sizeof (dsbd));

dsbd.dwSize = sizeof (dsbd);
dsbd.dwFlags = DSBCAPS_STATIC;
dsbd.dwBufferBytes = size;

wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = channels;
wfx.nSamplesPerSec = hz;
wfx.wBitsPerSample = bits;
wfx.nAvgBytesPerSec = (unsigned long)(hz * ((channels * bits) / 8));
wfx.cbSize = 0;

dsbd.lpwfxFormat = &wfx;

hr = lpds->CreateSoundBuffer (&dsbd, &lpdss, NULL);

Share this post


Link to post
Share on other sites
Also, look out to make sure you aren''t passing a pointer to a struct when it expects a pointer to a pointer to a struct Or vice versa.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!